git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Junio C Hamano <junkio@cox.net>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Shell quoting
Date: Thu, 15 Sep 2005 13:18:13 -0700	[thread overview]
Message-ID: <4329D705.8050101@zytor.com> (raw)
In-Reply-To: <7vll1yyusn.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> "H. Peter Anvin" <hpa@zytor.com> writes:
> 
> 
>>Linus Torvalds wrote:
>>
>>>Does anybody really still use tcsh? It's a broken mess.
>>>
>>
>>Yes.
> 
> Yes to "still use", or yes to "broken mess" ;-)?
> 

Both :)

>>>Junio's "sq_quote()" works wonderfully on any valid shells. The fact
>>>that tcsh expands ! even inside single quotes is just pure
>>>braindamage.
>>
>>>You could expand "sq_quote" to handle '!' and '\' characters the exact
>>>same way it handles the single tick (end single-tick quoting, do \! or \\
>>>and start single-tick quoting again) and that might be good enough for
>>>tcsh.
>>
>>It seems easier to just \-escape any special characters.
> 
> I am sympathetic.  The beauty of sq_quote() comes directly from
> the behaviour of single quoting rules of "any valid shells" --
> there is no need to maintain a list of special characters.  Just
> single quote itself is special and nothing else.

Well, in the patch I just posted I simply \-escape a blacklist of 
characters.  It should be quite safe, since the blacklist consists of 
all ASCII characters that aren't known to be regularly used on the 
command line.

	-hpa

  reply	other threads:[~2005-09-15 20:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15  5:50 [PATCH] Remove shell dependency in env.c H. Peter Anvin
2005-09-15  7:58 ` Junio C Hamano
2005-09-15 16:30   ` H. Peter Anvin
2005-09-15 18:44   ` Shell quoting H. Peter Anvin
2005-09-15 19:01     ` Linus Torvalds
2005-09-15 19:31       ` H. Peter Anvin
2005-09-15 19:50         ` Junio C Hamano
2005-09-15 20:18           ` H. Peter Anvin [this message]
2005-09-15 19:35       ` Junio C Hamano
2005-09-15 20:02         ` Linus Torvalds
2005-09-16 19:20       ` Junio C Hamano
2005-09-15 19:33     ` [PATCH] rsh.c env and quoting cleanup, take 2 H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4329D705.8050101@zytor.com \
    --to=hpa@zytor.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).