Package: findutils Version: 4.2.28-1 Severity: normal When action "-execdir" was used with find, a string "./" was prepended to any argument containing replace pattern "{}", leading to this error:
$ find -type f ! -name "*.gz" -execdir sh -c \ > 'file -b {} | grep -q "gzip compressed data" && mv {} {}.gz' \; sh: ./file: No such file or directory I've gone through codes related with this prefixing behavior in the source code of findutils, and found these relevant lines: line 509 in find/pred.c : const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./"; lines 278+ in lib/buildcmd.c : if (prefix) { strcpy (state->argbuf + state->cmd_argv_chars, prefix); state->cmd_argv_chars += pfxlen; } ... In most cases such design was not a bad idea since {} was generally placed alone, sometimes even quite good for dealing with unusual file names like "-l". But if we want to do some complex operations as shown above, this will turn to be a mess. Possible resolution could be discarding this feature since those who need prefix "./" can specify it explicitly at the beginning of argument; or at least a switch to turn off this behavior should be provided. Another possible bug concerning "-execdir" shown below: $ pwd /tmp $ find / -maxdepth 1 -wholename / -execdir pwd \; /tmp $ find / -maxdepth 1 -wholename /boot -execdir pwd \; / Among these two find invocations, the latter conforms to the description in find's manpage while the former does not. This inconsistency seems to occur only when the matching filename was "/". I'm not sure if this is another special handling or not. ps: action "-okdir" works basically the same way as "-execdir". -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17-1-k7 Locale: LANG=zh_CN.GBK, LC_CTYPE=zh_CN.GBK (charmap=GBK) Versions of packages findutils depends on: ii libc6 2.3.6-15 GNU C Library: Shared libraries findutils recommends no packages. -- no debconf information -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]