[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shell-command - missing shell-quote-argument for program?
From: |
Eli Zaretskii |
Subject: |
Re: shell-command - missing shell-quote-argument for program? |
Date: |
Sat, 14 Oct 2006 20:15:21 +0200 |
> From: Andreas Schwab <address@hidden>
> Cc: Eli Zaretskii <address@hidden>,
> Carsten Dominik <address@hidden>, address@hidden
> Date: Sat, 14 Oct 2006 19:50:01 +0200
>
> > diff -c -r1.26 ada-xref.el
> > *** ada-xref.el 10 Feb 2006 09:00:31 -0000 1.26
> > --- ada-xref.el 11 Oct 2006 22:55:48 -0000
> > ***************
> > *** 1916,1923 ****
> > (set-buffer (get-buffer-create "*grep*"))
> > (while dirs
> > (insert (shell-command-to-string
> > ! (concat "egrep -i -h '^X|" regexp "( |$)' "
> > ! (file-name-as-directory (car dirs)) "*.ali")))
> > (set 'dirs (cdr dirs)))
> >
> > ;; Now parse the output
> > --- 1916,1926 ----
> > (set-buffer (get-buffer-create "*grep*"))
> > (while dirs
> > (insert (shell-command-to-string
> > ! (concat "egrep -i -h '^X|"
> > ! (shell-quote-argument regexp)
>
> This is wrong, the argument is already enclosed in single quotes.
Actually, I think that using '..' quoting is wrong, because it assumes
a Posix shell. I think this should be rewritten by removing the
single quotes and instead quoting (via shell-quote-argument) the
entire regexp that is the result of `(concat "^X|" regexp "( |$)")'.
Do you agree that this is more portable?
Also, I thought that the issue here was with quoting the elements of
the `dirs' list, since they are file names that could include embedded
whitespace and other characters special to the shell.
Btw, while we are at that, `egrep' might not work with the latest
versions of GNU Grep, where `egrep' is a shell script that requires
/bin/sh. "grep -E" is better, I think.
Re: shell-command - missing shell-quote-argument for program?, Eli Zaretskii, 2006/10/14
Re: shell-command - missing shell-quote-argument for program?, Eli Zaretskii, 2006/10/14
Re: shell-command - missing shell-quote-argument for program?, Kim F. Storm, 2006/10/14
Re: shell-command - missing shell-quote-argument for program?, Lennart Borgman, 2006/10/15
Re: shell-command - missing shell-quote-argument for program?, Lennart Borgman, 2006/10/15
Re: shell-command - missing shell-quote-argument for program?, Kim F. Storm, 2006/10/15
Re: shell-command - missing shell-quote-argument for program?, Richard Stallman, 2006/10/15
Re: shell-command - missing shell-quote-argument for program?, Slawomir Nowaczyk, 2006/10/15
Re: shell-command - missing shell-quote-argument for program?, Richard Stallman, 2006/10/15