From 364d24dbe83b6b875db1088b10df73d06136ad5d Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Tue, 4 Aug 2015 07:54:48 +0100 Subject: Ignore extended header fields in tar archives bsd tar stores file attributes as extended headers, which are ignored by gnu tar. The tar importer currently treats these headers as regular files, so regular files containing attribute data are created on extraction even though they never existed at archive creation. This can be a problem for CPAN imports, some CPAN distributions are created using bsd tar, the extended headers in these archives result in a modified directory structure, e.g. where the structure on the developer's machine would be Foo: META.json META.yml Makefile.PL ... in trove we could have, Foo: Foo/ Foo/META.json Foo/META.yml Foo/Makefile.PL PAXHeader/ PAXHeader/Foo ... this structure causes the default build-commands to fail because they expect to find Makefile.PL in the repo's root dir. Change-Id: Ia8f90c3be7b31f7a4ac774022cb606fc1c57c002 --- lorry.tar-importer | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lorry.tar-importer b/lorry.tar-importer index 904f8d8..d4d27f5 100755 --- a/lorry.tar-importer +++ b/lorry.tar-importer @@ -103,11 +103,16 @@ foreach my $tar_file (@ARGV) $mtime = oct $mtime; next if $typeflag == 5; # directory - print FI "blob\n", "mark :$next_mark\n"; if ($typeflag == 2) { # symbolic link + print FI "blob\n", "mark :$next_mark\n"; print FI "data ", length($linkname), "\n", $linkname; $mode = 0120000; + } elsif ($typeflag eq 'x') { # extended header + # skip header contents + $size -= 512 while ($size > 0 && read(I, $_, 512) == 512); + next; } else { + print FI "blob\n", "mark :$next_mark\n"; print FI "data $size\n"; while ($size > 0 && read(I, $_, 512) == 512) { print FI substr($_, 0, $size); -- cgit v1.2.1