From 573ea2c7d4a69626155ef099fe767f9098869e49 Mon Sep 17 00:00:00 2001 From: Ricardo Martincoski Date: Thu, 5 Apr 2018 00:16:00 -0300 Subject: [PATCH] download/git: fix basename for files inside tarballs Commit "6d938bcb52 download: git: introduce cache feature" introduced a typo that makes the tarball to contain files without the package basename: $ tar -tvf good-a238b1dfcd825d47d834af3c5223417c8411d90d.tar.gz -rw-r--r-- 0/0 8 2017-10-14 02:10 ./file Historically, all tarballs are generated with the basename: $ tar -tvf good-a238b1dfcd825d47d834af3c5223417c8411d90d.tar.gz -rw-r--r-- 0/0 8 2017-10-14 02:10 good-a238b1dfcd825d47d834af3c5223417c8411d90d/file The hashes in the tree were calculated with the basename. In the most common scenario, after the download ends the tarball is generated, the hash mismatches and the download mechanism falls back to use the tarball from http://sources.buildroot.net . The problem can be reproduced by forcing the download of any git package PKG that has a hash file to check against: $ make defconfig $ ./utils/config --set-str BR2_BACKUP_SITE "" $ BR2_DL_DIR=$(mktemp -d) make PKG-dirclean PKG-source Fix the typo so the basename is really added to the files, that was clearly the intention of the code. Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Cc: Maxime Hadjinlian Cc: Peter Korsgaard Cc: Thomas Petazzoni Cc: Yann E. MORIN Signed-off-by: Peter Korsgaard --- support/download/git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/download/git b/support/download/git index 58dbcd211c..f07195b0d1 100755 --- a/support/download/git +++ b/support/download/git @@ -111,7 +111,7 @@ LC_ALL=C sort <"${output}.list" >"${output}.list.sorted" # Create GNU-format tarballs, since that's the format of the tarballs on # sources.buildroot.org and used in the *.hash files -tar cf - --transform="s/^\.$/${basename}/" \ +tar cf - --transform="s/^\./${basename}/" \ --numeric-owner --owner=0 --group=0 --mtime="${date}" --format=gnu \ -T "${output}.list.sorted" >"${output}.tar" gzip -6 -n <"${output}.tar" >"${output}" -- 2.30.2