-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
Filenames containing spaces are not escaped in dfind --exec, which leads to errors.
For instance, given the following file:
$ ls -al /scratch/users/kilian/test/
total 500
drwxr-xr-x 2 kilian ruthm 4096 Nov 8 07:59 .
drwx------ 24 kilian ruthm 507904 Nov 8 07:59 ..
-rw-r--r-- 1 kilian ruthm 0 Nov 8 07:59 filename with spaces
dfind --print displays it fine:
$ srun dfind -v --type f --print /scratch/users/kilian/test/
[2019-11-08T08:03:21] Walking /scratch/users/kilian/test
[2019-11-08T08:03:23] Walked 2 items in 1.449959 seconds (1.379349 files/sec)
/scratch/users/kilian/test/filename with spaces
but dfind --exec fails to find it:
$ srun dfind -v --type f --exec ls -al {} \; /scratch/users/kilian/test/
[2019-11-08T08:04:17] Walking /scratch/users/kilian/test
[2019-11-08T08:04:19] Walked 2 items in 1.458525 seconds (1.371249 files/sec)
ls: cannot access /scratch/users/kilian/test/filename: No such file or directory
ls: cannot access with: No such file or directory
ls: cannot access spaces: No such file or directory
A workaround is to escape-quote the filepath placeholder {}:
# srun dfind -v --type f --exec ls -al \"{}\" \; /scratch/users/kilian/test/
[2019-11-08T08:05:13] Walking /scratch/users/kilian/test
[2019-11-08T08:05:15] Walked 2 items in 1.506326 seconds (1.327734 files/sec)
-rw-r--r-- 1 kilian ruthm 0 Nov 8 07:59 /scratch/users/kilian/test/filename with spaces
but it would be nice if dfind could work like find:
$ find /scratch/users/kilian/test/ -type f -exec ls -al {} \;
-rw-r--r-- 1 kilian ruthm 0 Nov 8 07:59 /scratch/users/kilian/test/filename with spaces
Thanks!
Metadata
Metadata
Assignees
Labels
No labels