Skip Menu |
 

This queue is for tickets about the Archive-Tar CPAN distribution.

Report information
The Basics
Id: 119949
Status: new
Priority: 0/
Queue: Archive-Tar

People
Owner: Nobody in particular
Requestors: chris.lindee [...] cpanel.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: list_files() sometimes removes trailing '/' from directories
Date: Mon, 23 Jan 2017 15:53:11 -0600
To: bug-Archive-Tar [...] rt.cpan.org
From: Chris Lindee <chris.lindee [...] cpanel.net>
Download (untitled) / with headers
text/plain 2.2k
When the header for a directory listing in a tarball uses both the 'Prefix’ and ‘Name’ fields, any trailing slashes in the ‘Name' are removed. However, if the directory only uses the ‘Name’ field or uses constructs like ././@LongLink, trailing slashes are not removed from the name. This causes inconsistency in the output of list_files(). In particular, I’ve seen this issue with tarballs created by git-archive (so it appears modern tools still use this format). Can this function be made to not strip trailing ‘/‘ characters [0]? mkdir -p directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/subdir/ echo "hey" > directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/subdir/file tar -H ustar -cvf testing.tar directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/ echo "Tar results:" tar -tf testing.tar echo echo "Archive::Tar results:" perl -MArchive::Tar -e 'print join "\n", Archive::Tar->new("testing.tar")->list_files(), "”;' Which will output (notice the missing slash on ’subdir/‘): Tar results: directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/ directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/subdir/ directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/subdir/file Archive::Tar results: directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/ directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/subdir directory-that-fits-into-the-tar-name-field-but-will-be-put-into-prefix-for-subdirectories-or-files/subdir/file Perl: v5.24.1 Archive::Tar: 2.04_01 See also: https://rt.cpan.org/Public/Bug/Display.html?id=101922 <https://rt.cpan.org/Public/Bug/Display.html?id=101922> [0] Honestly, it would be better to always strip the trailing ‘/‘. This would force developers to use is_dir(), which is the most accurate way to check if the entry is a directory. However, I’m certain this would break compatibility with existing programs that expect directories to end with ‘/‘ and files to not.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.