Skip to contentSkip to conversation

download/git: fix transform regexp for older tar versions

PATCH New Yann E. MORIN 2 participants 2 messages Apr 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 download/git: fix transform regexp for older tar versions

Older versions of tar (e.g. 1.27.1) incorrectly interpret the escaping of the regexp separator, and generate broken tarballs.

For example, given the following transform expression:

    --transform="s/^\.\//squashfs-e38956b92f738518c29734399629e7cdb33072d3\//"

the resulting paths in the generated tarball would be:

    squashfs-e38956b92f738518c29734399629e7cdb33072d3\/

i.e. a directory which last character is indeed a '\'.

We fix that by using a separator which is very unlikely to occur in a filename.

Fixes:

    http://autobuild.buildroot.org/results/742/7427f34e5c9f6d043b0fe6ad2c66cc0f31d2b24f/

and probably a slew of others as well...

Take this opportunity to fix indetation on the following line (leading spaces, not tABs).

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Maxime Hadjinlian <[email protected]>
---
 support/download/git | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
support/download/git +2 -2
index 1172310186..99c4b523b8 100755
@@ -120,8 +120,8 @@ 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}\//" \
-	--numeric-owner --owner=0 --group=0 --mtime="${date}" --format=gnu \
+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}"
 
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 download/git: fix transform regexp for older tar versions

Hello,

Quoted 22 lines · Yann E. MORIN

Older versions of tar (e.g. 1.27.1) incorrectly interpret the escaping of the regexp separator, and generate broken tarballs.

For example, given the following transform expression:

    --transform="s/^\.\//squashfs-e38956b92f738518c29734399629e7cdb33072d3\//"

the resulting paths in the generated tarball would be:

    squashfs-e38956b92f738518c29734399629e7cdb33072d3\/

i.e. a directory which last character is indeed a '\'.

We fix that by using a separator which is very unlikely to occur in a filename.

Fixes:

    http://autobuild.buildroot.org/results/742/7427f34e5c9f6d043b0fe6ad2c66cc0f31d2b24f/

and probably a slew of others as well...

Take this opportunity to fix indetation on the following line (leading spaces, not tABs).

Quoted 7 lines
Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Maxime Hadjinlian <[email protected]>
---
 support/download/git | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com