Closed akrherz closed 7 years ago
@akrherz The scour(1) utility used to use the find(1) arguments -exec rm -f {};
. That was replaced by the use of xargs(1) to increase performance. Do you have a lot of files that get scoured and, if so, is performance of scour(1) an issue?
@semmerson thanks for the response. I always assumed slow scour was a result of poor filesystem performance and not from a slow command line option. Execing rm
once for a thousand files vs execing rm
a thousand times will certainly be faster. The issue at hand is having a file with a filename that causes the current command to fail. This bit us in development with a corrupt BUFR file caused a filename to get written with an apostrophe in the filename.
@akrherz I can sympathize.
I think a better solution would be rewrite scour(1) as a C program. I'll add an issue to that effect.
Added escaping of all characters except newlines. That should do it.
Thanks @semmerson , but where is the commit?
The escaping of all pathname characters goes back to April, 2010. The latest version definitely has it.
Filenames with quotes or other characters may cause xargs to fail like so $ ldmadmin scour xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
Use POSIX
-exec rm -f {} +
which should be more forgiving.