buildroot/support/download
Yann E. MORIN ac2e6b3927 support/download/check-hash: accept hash files without terminating \n
Lots of people are using broken text editors that 1. do not naturally
terminate text files with a final \n as is customary in UNIX text files,
and 2. do not respect our .editorconfig settings, which explicitly
require adding that final newline. See this nice summary of what a text
file is (with references to applicable standards):

    https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line/12916758#12916758

So, it is not surprising that read does not read the last "line" of a
file, when said "line" does not end with a newline, because it is thus
not really a line.

Even though we do mandate actual text files, let's be a little bit lax
in this respect, because people may write packages, and their hash
files, in a br2-external tree, and they may not have our .editorconfig
in the directory heierarchy (e.g. if buildroot is a submodule of their
br2-external tree, or whatever).

mapfile does not suffer from this limitation, though, and correctly
reads all lines from a file, even the final line-that-is-not-a-line.

mapfile was introduced in bash 4.0, released on 2009-01-20, more than
15 years ago. Debian squeeze, released in 2011 already had bash 4.1.
Those are really ancient. So, it means we can indeed expect bash
version 4.0 or later; which means mapfile is available.

"It should be fine!"

Fixes: #15976

Reported-by: masonwardle@gmail.com
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2024-07-14 22:58:04 +02:00
..
bzr support/download: fix git/svn corrupted cache 2021-03-19 21:22:59 +01:00
cargo-post-process support/download: no longer support BR_CARGO_MANIFEST_PATH in cargo post-process 2024-07-14 10:31:09 +02:00
check-hash support/download/check-hash: accept hash files without terminating \n 2024-07-14 22:58:04 +02:00
curl support/download: introduce curl backend for FTP transfers 2024-07-12 13:12:55 +02:00
cvs support/download/cvs: use appropriate TAR 2024-06-05 23:39:13 +02:00
dl-wrapper support/download: pass post-process options to post-process helper 2024-07-14 10:19:00 +02:00
file support/download: fix git/svn corrupted cache 2021-03-19 21:22:59 +01:00
git support/download: force fetching tags 2024-05-09 22:45:14 +02:00
go-post-process support/download/go-post-process: drop -o pipefail 2022-01-09 11:07:37 +01:00
helpers support/download: move tracing functions to helpers 2024-07-14 10:18:23 +02:00
hg support/download/hg: fix broken method 2021-04-28 21:51:10 +02:00
scp support/download: fix git/svn corrupted cache 2021-03-19 21:22:59 +01:00
sftp support/download: Add SFTP support 2022-01-06 09:34:05 +01:00
svn support/download: add support to exclude svn externals 2023-08-06 16:35:52 +02:00
wget support/download: fix git/svn corrupted cache 2021-03-19 21:22:59 +01:00