GNU bug report logs - #2607
23.0.90; `system-type' test in `shell-quote-wildcard-pattern'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 9 Mar 2009 06:30:03 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #30 received at 2607 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 2607 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: Re: bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
Date: Tue, 10 Mar 2009 22:02:30 -0400
> Wonderful, isn't it? code that solves a non-trivial problem by doing
> absolutely nothing?

Awesome!

> Seriously, though: that function does do what the doc string promises,
> on Unix as well as on DOS/Windows.  It does that by not quoting the
> Unix quote character: the backslash itself.  Thus
>   (shell-quote-wildcard-pattern "'foo*")
>    => "\\'foo*"
> but
>   (shell-quote-wildcard-pattern "foo\\*")
>    => "foo\\*"
> Perhaps we should make the doc string less of a riddle by saying
> explicitly that "quote characters" in this context means " on Windows
> and backslash on Unix.

OK, I now kind of understand what it does, but...

>> And furthermore, even seeing the code, I don't understand what is
>> this special case supposed to be used for.
> Sorry, I don't understand: what special case did you have in mind?

... why is this behavior useful?
I.e. when is it useful to have this function be idempotent?
[... thinking ...]
I think I understand: idempotency is actually not important, and is not
really what is meant by the 2 lines.
Indeed (shell-quote-wildcard-pattern "\\'foo*") => "\\\\'foo*"
so it's not idempotent: \ can be used to escape [*?\] but not [;<>&|()'"#$].

How 'bout something like:

   Quote characters special to the shell in pattern, leave wildcards alone.

   PATTERN should be a file-name wildcard pattern suitable for the
   underlying filesystem.  PATTERN can use \ under Unix and " in Windows
   to quote wildcard characters.


-- Stefan




This bug report was last modified 16 years and 63 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.