From findutils' manual about
In many applications, if xargs botches processing a file because its name contains special characters, some data might be lost.
However, here is an extreme example of the problems that using blank-delimited names can cause. If the following command is run daily from cron, then any user can remove any file on the system:
find / -name ’#*’ -atime +7 -print | xargs rm
For example, you could do something like this:
eg$ echo > ’# vmunix’
and then cron would delete /vmunix, if it ran xargs with / as its current directory.
To delete other files, for example /u/joeuser/.plan, you could do this:
eg$ mkdir ’# ’ eg$ cd ’# ’ eg$ mkdir u u/joeuser u/joeuser/.plan’ ’ eg$ echo > u/joeuser/.plan’ /#foo’ eg$ cd .. eg$ find . -name ’#*’ -print | xargs echo ./# ./# /u/joeuser/.plan /#foo
In the above examples, how does
xargs work on the filenames provided by
find, and how can that delete files?