GNU bug report logs -
#2607
23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2607 in the body.
You can then email your comments to 2607 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2607
; Package
emacs
.
(Mon, 09 Mar 2009 06:30:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Drew Adams" <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Mon, 09 Mar 2009 06:30:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
This is not so much a bug report as a report of a possible bug, or at
least a question.
The code of `shell-quote-wildcard-pattern' has this test:
(memq system-type '(ms-dos windows-nt cygwin)). Looking at that
code, the inclusion of `cygwin' here seems suspect to me.
The Elisp manual says only that a `system-type' of `cygwin' means
Emacs running on Cygwin ("type of operating system Emacs is operating
on"). Dunno what that means, really, but I'm guessing that such a
system would use a shell, such as `bash', that treats characters in
file names similarly to how `bash' treats them for GNU/Linux or UNIX.
I use Emacs on Windows, but not built on Cygwin. I use it with Cygwin
and with `bash' as my shell, however, and that is how the shell
behaves for me. I have no problem with `shell-quote-wildcard-pattern'
AFAIK (my `system-type' is `windows-nt'), but I'm guessing that
someone with a `system-type' of `cygwin' might have trouble with it.
If these guesses are wrong, then please ignore this report.
If these guesses are correct, then perhaps `cygwin' should be removed
from that `system-type' test. The code would then treat `cygwin' Emacs
like Emacs on UNIX or GNU/Linux, as far as quoting file-name chars in
shell commands is concerned.
In GNU Emacs 23.0.90.1 (i386-mingw-nt5.1.2600)
of 2009-02-01 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2607
; Package
emacs
.
(Mon, 09 Mar 2009 22:40:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Mon, 09 Mar 2009 22:40:06 GMT)
Full text and
rfc822 format available.
Message #10 received at 2607 <at> emacsbugs.donarmstrong.com (full text, mbox):
> From: "Drew Adams" <drew.adams <at> oracle.com>
> Date: Sun, 8 Mar 2009 23:23:39 -0700
> Cc:
>
> The code of `shell-quote-wildcard-pattern' has this test:
> (memq system-type '(ms-dos windows-nt cygwin)). Looking at that
> code, the inclusion of `cygwin' here seems suspect to me.
>
> The Elisp manual says only that a `system-type' of `cygwin' means
> Emacs running on Cygwin ("type of operating system Emacs is operating
> on"). Dunno what that means, really, but I'm guessing that such a
> system would use a shell, such as `bash', that treats characters in
> file names similarly to how `bash' treats them for GNU/Linux or UNIX.
Cygwin is in the same list because Cygwin runs on Windows, and Windows
does not allow the `"' character in file names. It's true that Cygwin
uses Bash as the shell, but no shell can fix what the underlying
filesystem does not support.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2607
; Package
emacs
.
(Mon, 09 Mar 2009 22:45:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Drew Adams" <drew.adams <at> oracle.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Mon, 09 Mar 2009 22:45:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 2607 <at> emacsbugs.donarmstrong.com (full text, mbox):
> > The code of `shell-quote-wildcard-pattern' has this test:
> > (memq system-type '(ms-dos windows-nt cygwin)). Looking at that
> > code, the inclusion of `cygwin' here seems suspect to me.
> >
> > The Elisp manual says only that a `system-type' of `cygwin' means
> > Emacs running on Cygwin ("type of operating system Emacs is
> > operating on"). Dunno what that means, really, but I'm guessing
> > that such a system would use a shell, such as `bash', that treats
> > characters in file names similarly to how `bash' treats them for
> > GNU/Linux or UNIX.
>
> Cygwin is in the same list because Cygwin runs on Windows, and Windows
> does not allow the `"' character in file names. It's true that Cygwin
> uses Bash as the shell, but no shell can fix what the underlying
> filesystem does not support.
OK, thanks for checking. I'm not claiming the code is wrong; I just thought it
might be.
For me, using `bash' with Cygwin, but with Emacs built natively, escaping the
chars that are handled in the UNIX part of the code makes most sense. But yes,
the `"' thing is of course true. That seems to be a separate matter.
It was mainly the set of chars for which escaping occurs that seemed to me might
better follow the UNIX model (for Cygwin). But if you've checked the code and
feel it is right, that's good enough for me.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2607
; Package
emacs
.
(Tue, 10 Mar 2009 01:20:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 10 Mar 2009 01:20:04 GMT)
Full text and
rfc822 format available.
Message #20 received at 2607 <at> emacsbugs.donarmstrong.com (full text, mbox):
>> The code of `shell-quote-wildcard-pattern' has this test:
>> (memq system-type '(ms-dos windows-nt cygwin)). Looking at that
>> code, the inclusion of `cygwin' here seems suspect to me.
>>
>> The Elisp manual says only that a `system-type' of `cygwin' means
>> Emacs running on Cygwin ("type of operating system Emacs is operating
>> on"). Dunno what that means, really, but I'm guessing that such a
>> system would use a shell, such as `bash', that treats characters in
>> file names similarly to how `bash' treats them for GNU/Linux or UNIX.
> Cygwin is in the same list because Cygwin runs on Windows, and Windows
> does not allow the `"' character in file names. It's true that Cygwin
> uses Bash as the shell, but no shell can fix what the underlying
> filesystem does not support.
BTW, Reading the docstring makes me wonder what this function is really
intended to do. Especially the last sentence:
Existing quote characters in PATTERN are left alone, so you can pass
PATTERN that already quotes some of the special characters.
I see what it corresponds to in the DOS part of the code, but I don't
see anything equivalent in the Unix side. And furthermore, even seeing
the code, I don't understand what is this special case supposed to be
used for.
Stefan
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2607
; Package
emacs
.
(Tue, 10 Mar 2009 20:10:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 10 Mar 2009 20:10:05 GMT)
Full text and
rfc822 format available.
Message #25 received at 2607 <at> emacsbugs.donarmstrong.com (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 2607 <at> emacsbugs.donarmstrong.com, Drew Adams <drew.adams <at> oracle.com>
> Date: Mon, 09 Mar 2009 21:14:30 -0400
>
> BTW, Reading the docstring makes me wonder what this function is really
> intended to do. Especially the last sentence:
>
> Existing quote characters in PATTERN are left alone, so you can pass
> PATTERN that already quotes some of the special characters.
>
> I see what it corresponds to in the DOS part of the code, but I don't
> see anything equivalent in the Unix side.
Wonderful, isn't it? code that solves a non-trivial problem by doing
absolutely nothing?
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.
> 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?
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2607
; Package
emacs
.
(Wed, 11 Mar 2009 02:10:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 11 Mar 2009 02:10:05 GMT)
Full text and
rfc822 format available.
Message #30 received at 2607 <at> emacsbugs.donarmstrong.com (full text, mbox):
> 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
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 28 Mar 2009 12:35:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Drew Adams" <drew.adams <at> oracle.com>
:
bug acknowledged by developer.
(Sat, 28 Mar 2009 12:35:03 GMT)
Full text and
rfc822 format available.
Message #35 received at 2607-done <at> emacsbugs.donarmstrong.com (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 2607 <at> emacsbugs.donarmstrong.com, drew.adams <at> oracle.com
> Date: Tue, 10 Mar 2009 22:02:30 -0400
>
> 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.
I installed something similar.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Sat, 25 Apr 2009 14:24:13 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 62 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.