emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Add shell-quasiquote.


From: Taylan Ulrich Bayırlı/Kammer
Subject: Re: [PATCH] Add shell-quasiquote.
Date: Mon, 19 Oct 2015 10:16:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Stephen J. Turnbull" <address@hidden> writes:

> IMHO Emacs is unlikely to meet modern security standards in my
> lifetime.  I am discouraged from even thinking about it when the
> advocates of security are passing strings to an unknown shell program
> and then complaining that Emacs's quoting function may be insecure.
> Putting a shell in the loop is already saying "Security?  What, me
> worry??"  After all, even if you check for POSIX, it might be a
> slightly dated installation of GNU Bash. :-(

I have to confess that's a good point.  Maybe it's silly to even ask for
security, in general, when it comes to generating shell commands.  Then
again consider a fairly simple but still pretty useful example like:

  (shqq (cp -- ,@files target))

When the resulting string is passed verbatim as a command to a POSIX
shell, there's really no place for error there, so long as it's ensured
that each member of 'files' will be inserted verbatim into the ARGV of
cp(1).

Most commands will look more or less like that...


On a tangentially related topic, I just discovered there's more semantic
differences between using shqq--quote-string and shell-quote-argument.
The former quotes *everything*, e.g. "if" becomes "'if'", meaning you
cannot use shell keywords.  After a bit of pondering, I would say that's
a feature.  (Try constructing an if statement with shqq even when it
uses shell-quote-argument.  You can't (without the "double-unquote")
because you can't insert a bare newline or semicolon anyway.)

Taylan



reply via email to

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