unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
@ 2009-03-09  6:23 ` Drew Adams
  2009-03-09 22:31   ` Eli Zaretskii
  2009-03-28 12:35   ` bug#2607: marked as done (23.0.90; `system-type' test in `shell-quote-wildcard-pattern') Emacs bug Tracking System
  0 siblings, 2 replies; 6+ messages in thread
From: Drew Adams @ 2009-03-09  6:23 UTC (permalink / raw)
  To: emacs-pretest-bug

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)'
 







^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
  2009-03-09  6:23 ` bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern' Drew Adams
@ 2009-03-09 22:31   ` Eli Zaretskii
  2009-03-09 22:40     ` Drew Adams
       [not found]     ` <jwvprgqji8o.fsf-monnier+emacsbugreports@gnu.org>
  2009-03-28 12:35   ` bug#2607: marked as done (23.0.90; `system-type' test in `shell-quote-wildcard-pattern') Emacs bug Tracking System
  1 sibling, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2009-03-09 22:31 UTC (permalink / raw)
  To: Drew Adams, 2607

> From: "Drew Adams" <drew.adams@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.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
  2009-03-09 22:31   ` Eli Zaretskii
@ 2009-03-09 22:40     ` Drew Adams
       [not found]     ` <jwvprgqji8o.fsf-monnier+emacsbugreports@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-03-09 22:40 UTC (permalink / raw)
  To: 'Eli Zaretskii', 2607

> > 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.







^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
       [not found]     ` <jwvprgqji8o.fsf-monnier+emacsbugreports@gnu.org>
@ 2009-03-10 20:02       ` Eli Zaretskii
  2009-03-11  2:02         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-03-10 20:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 2607

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 2607@emacsbugs.donarmstrong.com,  Drew Adams <drew.adams@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?






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
  2009-03-10 20:02       ` Eli Zaretskii
@ 2009-03-11  2:02         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2009-03-11  2:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 2607

> 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






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2607: marked as done (23.0.90; `system-type' test in  `shell-quote-wildcard-pattern')
  2009-03-09  6:23 ` bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern' Drew Adams
  2009-03-09 22:31   ` Eli Zaretskii
@ 2009-03-28 12:35   ` Emacs bug Tracking System
  1 sibling, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2009-03-28 12:35 UTC (permalink / raw)
  To: Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]


Your message dated Sat, 28 Mar 2009 15:27:04 +0300
with message-id <utz5dltnr.fsf@gnu.org>
and subject line Re: bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
has caused the Emacs bug report #2607,
regarding 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
2607: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2607
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 4148 bytes --]

From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-pretest-bug@gnu.org>
Subject: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
Date: Sun, 8 Mar 2009 23:23:39 -0700
Message-ID: <005601c9a07f$96946c50$0200a8c0@us.oracle.com>

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)'
 




[-- Attachment #3: Type: message/rfc822, Size: 2449 bytes --]

From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 2607-done@emacsbugs.donarmstrong.com, drew.adams@oracle.com
Subject: Re: bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern'
Date: Sat, 28 Mar 2009 15:27:04 +0300
Message-ID: <utz5dltnr.fsf@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 2607@emacsbugs.donarmstrong.com,  drew.adams@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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-28 12:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <utz5dltnr.fsf@gnu.org>
2009-03-09  6:23 ` bug#2607: 23.0.90; `system-type' test in `shell-quote-wildcard-pattern' Drew Adams
2009-03-09 22:31   ` Eli Zaretskii
2009-03-09 22:40     ` Drew Adams
     [not found]     ` <jwvprgqji8o.fsf-monnier+emacsbugreports@gnu.org>
2009-03-10 20:02       ` Eli Zaretskii
2009-03-11  2:02         ` Stefan Monnier
2009-03-28 12:35   ` bug#2607: marked as done (23.0.90; `system-type' test in `shell-quote-wildcard-pattern') Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).