Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 51817 - app-arch/par2cmdline v0.4: wildcard expansion fix
Summary: app-arch/par2cmdline v0.4: wildcard expansion fix
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-23 05:50 UTC by Bardur Arantsson
Modified: 2013-08-05 09:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
par2cmdline-0.4-wildcard-fix.patch (par2cmdline-0.4-wildcard-fix.patch,1.42 KB, patch)
2004-05-23 05:51 UTC, Bardur Arantsson
Details | Diff
par2cmdline-0.4-r1.ebuild (par2cmdline-0.4-r1.ebuild,942 bytes, text/plain)
2004-05-23 05:51 UTC, Bardur Arantsson
Details
par2cmdline-0.4-wildcard-fix-2.patch (par2cmdline-0.4-wildcard-fix.patch,1.84 KB, patch)
2004-05-24 00:07 UTC, Bardur Arantsson
Details | Diff
shell expanded wildcard patch for par2cmdline (par2cmdline.shellexpandedwildcard.patch,888 bytes, patch)
2006-04-07 00:28 UTC, Michael Evans
Details | Diff
Updated the original patch (par2cmdline-0.4-wildcard-fix.patch,886 bytes, patch)
2013-07-31 08:52 UTC, Eric Draven
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bardur Arantsson 2004-05-23 05:50:26 UTC
Hi,

Version 0.4 of par2cmdline contains a bug whereby wildcard expansion on UNIX systems results in directories (and other non-regular files like sockets, character devices, etc.) being added to the file list. The par2 executable subsequently fails because it cannot handle such cases.

The attached patch fixes this issue. The patch has been submitted to the SourceForge bug tracking system for inclusion into the next version, but it is unclear when/if this will happen (there does not seem to have been too much recent activity on the part of the developer, so it may take a while...), so I think it might be good to put the patch into portage.

I've also attached a revised ebuild; the only change is the addition of the src_unpack() function.

Cheers,
Comment 1 Bardur Arantsson 2004-05-23 05:51:07 UTC
Created attachment 31883 [details, diff]
par2cmdline-0.4-wildcard-fix.patch
Comment 2 Bardur Arantsson 2004-05-23 05:51:56 UTC
Created attachment 31884 [details]
par2cmdline-0.4-r1.ebuild
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-05-23 18:34:13 UTC
Bardur: could you please email the upstream author about your patch?
I'm not certain what the correct behavior should be.

My gut feeling is that it should throw an error or warning rather than siliently work around it.
Comment 4 Bardur Arantsson 2004-05-24 00:06:29 UTC
Well, the was a similar bug in the Win32 version which is detailed here:

http://sourceforge.net/tracker/index.php?func=detail&aid=892377&group_id=30568&atid=399698

See also this bug report (which is mine):

https://sourceforge.net/tracker/index.php?func=detail&aid=958902&group_id=30568&atid=399698

In the last comment on the Win32-related bug (which was filed against 0.3), the developer suggests that he will change the behavior such that it will ignore directories specified on the command line. I haven't checked to see if he has actually changed this yet (and if so, whether it is _silently_ ignored or not).

The trouble with the current behavior is that there is no workaround. This makes it impossible to add more files than can fit on a command-line. With 'find' and 'xargs' it is possible to add a number of files up to the command line length limit, but IIRC xargs cannot be told to die if it needs to use more than 1 command line; so in this case you get even more dangerous silent errors because some *files* will just be missing from the .par2 'archive'.
Another annoying problem is that it is impossible to use wildcards like '*' in directories which contain subdirectories.

Btw, I don't think silently ignoring specials/directories is as dangerous as you might think, since the par2 executable explicitly shows each file added to the 'archive'. There is also the fact that adding anything but regular files to archives doesn't make sense, and since the wildcards were never recursive to begin with I felt that silently ignoring directories/specials would be fine.

But in any case, I've added code which emits warnings whenever a directory/special is omitted and uploaded the new patch.
Comment 5 Bardur Arantsson 2004-05-24 00:07:08 UTC
Created attachment 31931 [details, diff]
par2cmdline-0.4-wildcard-fix-2.patch
Comment 6 SpanKY gentoo-dev 2005-08-13 15:25:25 UTC
fixed in cvs, thanks
Comment 7 Michael Evans 2006-04-07 00:28:41 UTC
Created attachment 84110 [details, diff]
shell expanded wildcard patch for par2cmdline

This is Still a bug... I just figured out what's missing my self, and this is my shot at the patch...

the par2cmdline-0.4-r1.ebuild is the one I'm currently using...

This patch fixes the case of the wildcards being expanded by the shell, instead of par2.  The previous patches seem to work inside of par2 if you manage to pass it * instead of \* or '*'.  (Which is the best I could do when trying to pass par2 all it's arguments inside of a single argument to a shellscript.)
Comment 8 Eric Draven 2013-07-31 08:52:09 UTC
Created attachment 354700 [details, diff]
Updated the original patch

Original patch only works when creating par2 files, have corrected this for all par2 functions(repair,verify,create).
Comment 9 Eric Draven 2013-07-31 08:54:05 UTC
As a side note i see that Bardur's patch has been dropped from 0.4-r2 which will surface again if par2 command is given a none expanded wildcard(*) to validate files/dirs. Can this be re-added?