Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37058 - "Xargs" manpages give incorrect and dangerous explanation of using "print0" with "find"
Summary: "Xargs" manpages give incorrect and dangerous explanation of using "print0" w...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Aron Griffis (RETIRED)
URL:
Whiteboard:
Keywords:
: 37057 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-02 15:54 UTC by M. Creidieki Crouch
Modified: 2004-01-06 06:18 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M. Creidieki Crouch 2004-01-02 15:54:51 UTC
In "man xargs", under "--null, -0", it explains "The GNU find -print0 option produces input suitable for this mode."

However, "-print0" is not an "option" for GNU find. It is an "action" which, if it is evaluated, *always* prints all filenames and always returns true. Thus,

"find . -print0 -name *.wma | xargs -0 --replace=stuff rm stuff"

will, in fact, delete EVERY file in the current directory and all subdirectories, while

"find . -name *.wma -print0 | xargs -0 --replace=stuff rm stuff"

will only delete all .wma files.

Due to this man file error, I deleted a third of my music collection.

Reproducible: Always
Steps to Reproduce:



Expected Results:  
The "-print0" action, relying on "find"'s lazy evaluation of arguments, has too
complicated a usage to be explained in a one-line description in "man xargs". I
would suggest changing the line to "The GNU find -print0 action can produce
output for this mode; see "man xargs" for syntax information before using it."
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2004-01-05 15:51:24 UTC
Ouch, I'm sorry to hear about your music collection!  Nonetheless, this seems more like user error than anything else.  When doing something like a mass rm, it's advisable to use "echo" in place of "rm" to see what it's going to do.  Your suggestion for changing the documentation isn't a bad one, but I'd rather not patch the documentation in Gentoo unless it's going to be patched upstream.  If you think it should be patched, please take it to the findutils maintainers via bug-findutils@gnu.org and we'll pick up the fix when it is published
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2004-01-06 06:18:59 UTC
*** Bug 37057 has been marked as a duplicate of this bug. ***