-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow --format=ustar option for ptar #45
base: master
Are you sure you want to change the base?
Conversation
I’ve considered two edge cases here:
This proposed change handles both of these cases. I think doing so makes sense as a matter of principle. But if you should feel there is no need for that, this PR could be simplified to just a single line: @ARGV = grep !/^--format=ustar$/, @ARGV; |
655a55a
to
9af4de9
Compare
I love it! Shouldn't there be a test for |
GNU tar allows replacing the equals sign in long options with a space (--format ustar). That variant is also accepted by this change. ptar allows creating archives including a file named literally "--format=ustar" by using "--" to separate options from other command line arguments. That way to use ptar is not affected by this change.
9af4de9
to
988363e
Compare
Good idea, thanks. PR updated. |
I suspect that switching to Getopt::Long so the option can be parsed there is the more maintainable solution. |
I agree that converting from Getopt::Std to Getopt::Long would improve readability. I, for one, fail to understand Getopt::Std’s syntax. But that’s kinda a different change. This change is about increasing CLI compatibility with GNU tar. |
It's a different change, but it would make help by being the more maintainable solution. Once you have Getopt::Long you could not only add a format flag as a one-liner, you could also trivially give a sensible warning if someone does |
I agree completely. Sorry for not responding earlier, and for not being clear before. The point I was trying to make is that the change discussed here is in effect a feature update, while the change you’re proposing is a refactoring. I think the two shouldn’t be conflated. |
CPAN distributions should use the standard tar format, “ustar”. However, many modern
tar
utilties create archives in the extended “pax” format instead, which prevents installing affected dists on some systems. Modules like ExtUtils::MakeMaker have been struggling a bit with this problem.There is a proposal to have ExtUtils::MakeMaker use Archive::Tar’s
ptar
by default, instead of systemtar
:Perl-Toolchain-Gang/ExtUtils-MakeMaker#349
Meanwhile, some CPAN dists have worked around the problem by adding the
--format=ustar
option to their ExtUtils::MakeMakerTARFLAGS
. Unfortunately, that option is currently not accepted byptar
, so changing EU:MM to useptar
by default would break those workarounds.This PR proposes to allow
ptar
to accept a--format=ustar
option. If this option is given,ptar
silently ignores it, because Archive::Tar always uses the “ustar” format anyway.