emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't stop find-grep-dired when using Cygwin for the inferior proces


From: Lennart Borgman
Subject: Re: Can't stop find-grep-dired when using Cygwin for the inferior process - bug in shell-quote-argument?
Date: Mon, 28 Aug 2006 07:21:58 +0200
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)

Jason Rumney wrote:
Lennart Borgman wrote:
In any case the command string that is built and send to CMD does not work. Here I am using the GnuWin32 port of find, version 4.2.20. Find complains about the first -exec:

find . \( -type f -exec grep -q -e "message" {} \; \) -exec ls -ld {} \;
   find: missing argument to `-exec'

Stepping through shell-quote-argument it I can see that it tales the 'windows-nt path so that should be ok. There is only one call to shell-quote-argument involved and that is from find-grep-dired. How should the above command look in this case? I am not very familiar with find. Perhaps is it not possible to give this command with CMD.EXE?

I haven't tried it myself, but I think the following will work with cmd.exe and a native port of GNU find:

find . ( -type f -exec grep -q -e "message" {} ; ) -exec ls -ld {} ;

The problem appears to be that although the string to pass to grep is passed to shell-quote-argument, other parts of the expression have hard-coded backslashes. However, passing them to shell-quote-argument will introduce extra double-quotes on Windows, and I am not sure whether that will work or not.


Thanks, that expression works with the GnuWin32 port of GNU find and CMD.exe.

To remove the bugs I suggest the following approach:

1) A new function quote-special-characters that will quote characters like (); if it is a unix style shell.

2) A new function w32-shell-is-unix-style that looks at shell-file-name.

3) A new variable w32-unix-style-shells that have a list of regexps for the function in 2 to use for matching shell-file-name

4) Use 2 in 1 and in shell-quote-argument

How about this approach?


BTW the doc string for find-grep-dired is incorrect in several ways.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]