Bug 15976

Summary: .hash file requires newline to process correctly
Product: buildroot Reporter: masonwardle
Component: OtherAssignee: Yann E. MORIN <yann.morin.1998>
Status: RESOLVED MOVED    
Severity: minor CC: buildroot
Priority: P5    
Version: 2023.02.9   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description masonwardle 2024-03-08 16:01:06 UTC
I have a <package-name>.hash file with

# Calculated by hand
sha256  <64 hex character hash>  <downloaded package name>



I failed to put a newline at the end of the file. This caused support/download/check-hash to fail with a "No hash found" error. A quick look at the code suggests this error occurs in my case because the "read" command exits abnormally if it reaches the end of the file before encountering a newline.

I initially thought this could be addressed in the documentation but perhaps there is a simple fix. 

I'm running buildroot 2023.02.9 on Ubuntu 22.04. check-hash hasn't changed since that release.

Thanks!
Comment 1 Yann E. MORIN 2024-03-09 18:58:13 UTC
masonwardle, All,

Thanks for the report.

> I have a <package-name>.hash file with [...]
> I failed to put a newline at the end of the file.

We do have a .editorconfig file at the root of the Buildroot tree,
that instructs text editors to always "insert_final_newline", as
it is customary for UNIX-style text files.

What is your text editor? Can you configure it to respect the
.editorconfig directives?

> this could be addressed in the documentation

Yes, it would be nice to have a patch that points to the existing
.editorconfig, and points to the documentation on how to configure
usual rext editors: https://editorconfig.org/#pre-installed

Would you like to send such patch, please?

Regards,
Yann E. MORIN.
Comment 2 Yann E. MORIN 2024-06-15 15:24:30 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!