unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
@ 2011-09-12  7:09 Jambunathan K
  2011-09-12  7:29 ` Eli Zaretskii
  2011-09-13 13:35 ` Stefan Monnier
  0 siblings, 2 replies; 20+ messages in thread
From: Jambunathan K @ 2011-09-12  7:09 UTC (permalink / raw)
  To: 9480

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


While in a *vc-dir* buffer (backed by git) and trying to show or apply a
stash fails.

I am attaching "works for me" patch that shell-quotes stash@{n}
argument. With this "patch", the stash commands work as expected.

My shell-file-name is set to "bash" (cygwin version). My Emacs is

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-09-06 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt'

Additional Info:

,----
| VC backend : Git
| Working dir: ~/src/org-mode/
| Branch     : master
| Remote     : orgmode@orgmode.org:org-mode.git
| Stash      :
|              {0}: On master: custom tables  <-----
`----

FWIW, the stash line has following keymap:

,----
| (keymap
|  (83 . vc-git-stash-snapshot)
|  (80 . vc-git-stash-pop-at-point)
|  (65 . vc-git-stash-apply-at-point)
|  (13 . vc-git-stash-show-at-point)
|  (61 . vc-git-stash-show-at-point)
|  (11 . vc-git-stash-delete-at-point)
|  (down-mouse-3 . vc-git-stash-menu)
|  (mouse-2 . ignore))
`----


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-git.el.patch --]
[-- Type: text/x-patch, Size: 1720 bytes --]

*** a/vc-git.el	Mon Sep 12 12:14:06 2011
--- b/vc-git.el	Mon Sep 12 12:16:41 2011
***************
*** 1066,1085 ****
    (interactive)
    (let ((stash (vc-git-stash-get-at-point (point))))
      (when (y-or-n-p (format "Remove stash %s ? " stash))
!       (vc-git--run-command-string nil "stash" "drop" (format "stash@%s" stash))
        (vc-dir-refresh))))
  
  (defun vc-git-stash-show-at-point ()
    (interactive)
!   (vc-git-stash-show (format "stash@%s" (vc-git-stash-get-at-point (point)))))
  
  (defun vc-git-stash-apply-at-point ()
    (interactive)
!   (vc-git-stash-apply (format "stash@%s" (vc-git-stash-get-at-point (point)))))
  
  (defun vc-git-stash-pop-at-point ()
    (interactive)
!   (vc-git-stash-pop (format "stash@%s" (vc-git-stash-get-at-point (point)))))
  
  (defun vc-git-stash-menu (e)
    (interactive "e")
--- 1066,1093 ----
    (interactive)
    (let ((stash (vc-git-stash-get-at-point (point))))
      (when (y-or-n-p (format "Remove stash %s ? " stash))
!       (vc-git--run-command-string nil "stash" "drop"
! 				  (shell-quote-argument
! 				   (format "stash@%s" stash)))
        (vc-dir-refresh))))
  
  (defun vc-git-stash-show-at-point ()
    (interactive)
!   (vc-git-stash-show
!    (shell-quote-argument
!     (format "stash@%s" (vc-git-stash-get-at-point (point))))))
  
  (defun vc-git-stash-apply-at-point ()
    (interactive)
!   (vc-git-stash-apply
!    (shell-quote-argument
!     (format "stash@%s" (vc-git-stash-get-at-point (point))))))
  
  (defun vc-git-stash-pop-at-point ()
    (interactive)
!   (vc-git-stash-pop
!    (shell-quote-argument
!     (format "stash@%s" (vc-git-stash-get-at-point (point))))))
  
  (defun vc-git-stash-menu (e)
    (interactive "e")

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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12  7:09 bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting? Jambunathan K
@ 2011-09-12  7:29 ` Eli Zaretskii
  2011-09-12  9:05   ` Jambunathan K
  2011-09-13 13:35 ` Stefan Monnier
  1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-12  7:29 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 9480

> From: Jambunathan K <kjambunathan@gmail.com>
> Date: Mon, 12 Sep 2011 12:39:43 +0530
> 
> While in a *vc-dir* buffer (backed by git) and trying to show or apply a
> stash fails.
> 
> I am attaching "works for me" patch that shell-quotes stash@{n}
> argument. With this "patch", the stash commands work as expected.
> 
> My shell-file-name is set to "bash" (cygwin version). My Emacs is
> 
> In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)

Can you tell what does git see as its arguments without the quoting?
I would like to establish whether this is some bug specific to the
Windows build of Emacs, since other systems that use Bash evidently
don't need this change.

TIA





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12  7:29 ` Eli Zaretskii
@ 2011-09-12  9:05   ` Jambunathan K
  2011-09-12 10:51     ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Jambunathan K @ 2011-09-12  9:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jambunathan K <kjambunathan@gmail.com>
>> Date: Mon, 12 Sep 2011 12:39:43 +0530
>> 
>> While in a *vc-dir* buffer (backed by git) and trying to show or apply a
>> stash fails.
>> 
>> I am attaching "works for me" patch that shell-quotes stash@{n}
>> argument. With this "patch", the stash commands work as expected.
>> 
>> My shell-file-name is set to "bash" (cygwin version). My Emacs is
>> 
>> In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
>
> Can you tell what does git see as its arguments without the quoting?
> I would like to establish whether this is some bug specific to the
> Windows build of Emacs, since other systems that use Bash evidently
> don't need this change.

With the failing setup and
(setq vc-command-messages t)

I see the following in the *Messages* buffer and it seems OK to me

,----  *Messages* 
| Running git update-index --refresh . in background... done
| Running git diff-index --relative -z -M HEAD -- . in background... done
| Running git ls-files -z -o --directory --no-empty-directory --exclude-standard -- . in background... done
| Running git stash show -p stash@{0} . in background... done
`----

But in the *vc-git-stash* buffer I see the following message

,----  *vc-git-stash* 
| '-p stash@0' is not a stash
`----

Not the absence of `{' `}' in the error report. I hope that provides
some clue on what the underlying git sees.


With my "works for me" changes, I see the following

,---- *Messages*
| Running git stash show -p stash\@\{0\} . in background... done
`----

,---- *vc-git-stash*
| diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el
| index 5bc73a7..91c98ea 100644
| --- a/contrib/lisp/org-odt.el
| +++ b/contrib/lisp/org-odt.el
| @@ -636,7 +636,28 @@ PUB-DIR is set, use this as the publishing directory."
|  (defvar org-lparse-table-is-styled)
|  (defvar org-lparse-table-rowgrp-info)
|  (defvar org-lparse-table-colalign-vector)
| +
| [snip]
`----

Let me know if you need more information.

FWIW, git is also from cygwin installation.

Jambunathan K.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12  9:05   ` Jambunathan K
@ 2011-09-12 10:51     ` Eli Zaretskii
  2011-09-12 11:22       ` Jambunathan K
  2011-09-13  4:03       ` Glenn Morris
  0 siblings, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-12 10:51 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 9480

> From: Jambunathan K <kjambunathan@gmail.com>
> Cc: 9480@debbugs.gnu.org
> Date: Mon, 12 Sep 2011 14:35:48 +0530
> 
> | Running git stash show -p stash@{0} . in background... done
> `----
> 
> But in the *vc-git-stash* buffer I see the following message
> 
> ,----  *vc-git-stash* 
> | '-p stash@0' is not a stash
> `----
> 
> Not the absence of `{' `}' in the error report. I hope that provides
> some clue on what the underlying git sees.

Yes, I see the problem, but now I wonder how come users of Posix
platforms didn't see it.  Does it happen if your shell-file-name is
set to "sh", not "bash" (assuming the Cygwin Bash comes with such an
executable or a link)?

Perhaps someone who uses this on Unix or GNU system could try this
command and see if it needs quoting in general, not just on Windows
with Cygwin Bash.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12 10:51     ` Eli Zaretskii
@ 2011-09-12 11:22       ` Jambunathan K
  2011-09-12 11:50         ` Antoine Levitt
  2011-09-13  1:39         ` Richard Stallman
  2011-09-13  4:03       ` Glenn Morris
  1 sibling, 2 replies; 20+ messages in thread
From: Jambunathan K @ 2011-09-12 11:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480


> Yes, I see the problem, but now I wonder how come users of Posix
> platforms didn't see it.  Does it happen if your shell-file-name is
> set to "sh", not "bash" (assuming the Cygwin Bash comes with such an
> executable or a link)?

sh and bash are apparently one and the same executable.

,----
| sh-3.2$ bash --version
| GNU bash, version 3.2.51(24)-release (i686-pc-cygwin)
| Copyright (C) 2007 Free Software Foundation, Inc.
| 
| sh-3.2$ sh --version
| GNU bash, version 3.2.51(24)-release (i686-pc-cygwin)
| Copyright (C) 2007 Free Software Foundation, Inc.
| 
| 
| sh-3.2$ pwd
| /usr/bin
| 
| sh-3.2$ diff --binary sh.exe bash.exe
|
| sh-3.2$ ls -al sh.exe
| -rwxr-xr-x 1 kjambunathan root 470542 Aug 13  2010 sh.exe
|
| sh-3.2$ ls -al bash.exe
| -rwxr-xr-x 1 kjambunathan root 470542 Aug 13  2010 bash.exe
`----







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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12 11:22       ` Jambunathan K
@ 2011-09-12 11:50         ` Antoine Levitt
  2011-09-12 11:56           ` Eli Zaretskii
  2011-09-13  1:39         ` Richard Stallman
  1 sibling, 1 reply; 20+ messages in thread
From: Antoine Levitt @ 2011-09-12 11:50 UTC (permalink / raw)
  To: 9480

12/09/11 13:22, Jambunathan K
>> Yes, I see the problem, but now I wonder how come users of Posix
>> platforms didn't see it.  Does it happen if your shell-file-name is
>> set to "sh", not "bash" (assuming the Cygwin Bash comes with such an
>> executable or a link)?
>
> sh and bash are apparently one and the same executable.

Bash runs in sh compatibility mode when invoked with "sh". From man bash:

       If bash is invoked with the name sh, it tries to mimic the
       startup behavior of historical versions of sh as closely as
       possible, while conforming to the POSIX standard as well.






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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12 11:50         ` Antoine Levitt
@ 2011-09-12 11:56           ` Eli Zaretskii
  2011-09-13  4:46             ` Jambunathan K
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-12 11:56 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9480, Jambunathan K

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Date: Mon, 12 Sep 2011 13:50:56 +0200
> 
> 12/09/11 13:22, Jambunathan K
> >> Yes, I see the problem, but now I wonder how come users of Posix
> >> platforms didn't see it.  Does it happen if your shell-file-name is
> >> set to "sh", not "bash" (assuming the Cygwin Bash comes with such an
> >> executable or a link)?
> >
> > sh and bash are apparently one and the same executable.
> 
> Bash runs in sh compatibility mode when invoked with "sh". From man bash:
> 
>        If bash is invoked with the name sh, it tries to mimic the
>        startup behavior of historical versions of sh as closely as
>        possible, while conforming to the POSIX standard as well.

Right.  So results could be different, even though it's the same
binary.  Jambunathan, please try that if you can.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12 11:22       ` Jambunathan K
  2011-09-12 11:50         ` Antoine Levitt
@ 2011-09-13  1:39         ` Richard Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Richard Stallman @ 2011-09-13  1:39 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 9480

    sh and bash are apparently one and the same executable.

That is a bad practice -- the file's name should not change its
behavior.  They ought to be two executables.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use free telephony http://directory.fsf.org/category/tel/





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12 10:51     ` Eli Zaretskii
  2011-09-12 11:22       ` Jambunathan K
@ 2011-09-13  4:03       ` Glenn Morris
  2011-09-13  4:37         ` Eli Zaretskii
  1 sibling, 1 reply; 20+ messages in thread
From: Glenn Morris @ 2011-09-13  4:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480, Jambunathan K

Eli Zaretskii wrote:

> Perhaps someone who uses this on Unix or GNU system could try this
> command and see if it needs quoting in general, not just on Windows
> with Cygwin Bash.

FWIW, I can only find (t)csh where `echo stash@{0}' does not print "stash@{0}".





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13  4:03       ` Glenn Morris
@ 2011-09-13  4:37         ` Eli Zaretskii
  2011-09-13  5:14           ` Jambunathan K
  2011-09-13  6:17           ` Jambunathan K
  0 siblings, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-13  4:37 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9480, kjambunathan

> From: Glenn Morris <rgm@gnu.org>
> Cc: Jambunathan K <kjambunathan@gmail.com>,  9480@debbugs.gnu.org
> Date: Tue, 13 Sep 2011 00:03:10 -0400
> 
> Eli Zaretskii wrote:
> 
> > Perhaps someone who uses this on Unix or GNU system could try this
> > command and see if it needs quoting in general, not just on Windows
> > with Cygwin Bash.
> 
> FWIW, I can only find (t)csh where `echo stash@{0}' does not print "stash@{0}".

I wasn't able to reproduce it with Bash on a GNU system, either, but I
thought I was missing something.  Neither do I see any special
handling of the braces in the w32-specific parts of Emacs.

So it's a mystery why this happens with the Cygwin Bash.  Jambunathan,
could you perhaps post a question to the Cygwin mailing list?





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12 11:56           ` Eli Zaretskii
@ 2011-09-13  4:46             ` Jambunathan K
  0 siblings, 0 replies; 20+ messages in thread
From: Jambunathan K @ 2011-09-13  4:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480, Antoine Levitt

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Date: Mon, 12 Sep 2011 13:50:56 +0200
>> 
>> 12/09/11 13:22, Jambunathan K
>> >> Yes, I see the problem, but now I wonder how come users of Posix
>> >> platforms didn't see it.  Does it happen if your shell-file-name is
>> >> set to "sh", not "bash" (assuming the Cygwin Bash comes with such an
>> >> executable or a link)?
>> >
>> > sh and bash are apparently one and the same executable.
>> 
>> Bash runs in sh compatibility mode when invoked with "sh". From man bash:
>> 
>>        If bash is invoked with the name sh, it tries to mimic the
>>        startup behavior of historical versions of sh as closely as
>>        possible, while conforming to the POSIX standard as well.
>
> Right.  So results could be different, even though it's the same
> binary.  Jambunathan, please try that if you can.

The reported problem persists even if I run with emacs -Q and for ALL
THREE settings of shell-file-name

1. The default value - cmdproxy.exe
2. (setq shell-file-name "sh")
3. (setq shell-file-name "bash")

*vc-dir* correctly reports modified files in my work area correctly for
 ALL the above settings.

side note: My "shell quoting" changes produces the expected behaviour in
case of 2 and 3. But fails for scenario 1.

ps: I see that my remark about sh.exe and bash.exe being same has
produced some confusion. What I meant was sh.exe and bash.exe are
DIFFERENT EXECUTABLE FILES (in physical sense) but with the SAME
CONTENT.

,----
| $ ls -al *sh.exe
| -rwxr-xr-x 2 kjambunathan root  82446 2010-06-30 04:18 ash.exe
| -rwxr-xr-x 1 kjambunathan root 470542 2010-08-13 22:28 bash.exe
| -rwxr-xr-x 2 kjambunathan root  82446 2010-06-30 04:18 dash.exe
| -rwxr-xr-x 1 kjambunathan root   8718 2010-02-11 13:25 ppmflash.exe
| -rwxr-xr-x 1 kjambunathan root 470542 2010-08-13 22:28 sh.exe
| -rwxr-xr-x 1 kjambunathan root 342030 2010-09-03 14:14 ssh.exe
| lrwxrwxrwx 1 kjambunathan root     11 2011-03-16 14:31 tclsh.exe -> tclsh84.exe
| lrwxrwxrwx 1 kjambunathan root     10 2011-03-16 14:31 wish.exe -> wish84.exe
`----





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13  4:37         ` Eli Zaretskii
@ 2011-09-13  5:14           ` Jambunathan K
  2011-09-13  6:17           ` Jambunathan K
  1 sibling, 0 replies; 20+ messages in thread
From: Jambunathan K @ 2011-09-13  5:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480


> I wasn't able to reproduce it with Bash on a GNU system, either, but I
> thought I was missing something.  Neither do I see any special
> handling of the braces in the w32-specific parts of Emacs.

> So it's a mystery why this happens with the Cygwin Bash.  Jambunathan,
> could you perhaps post a question to the Cygwin mailing list?

If I open my regular Cygwin/XTerm [1] and type the command as you see
below (What you see is what I have typed) it reports the stash
correctly.

,---- From regular Cygwin/Xterm 
| $ git stash show -p stash@{0}
| diff --git a/Makefile b/Makefile
| index ce419c1..7183545 100644
| --- a/Makefile
| +++ b/Makefile
`----

It does seem like Emacs is messing up before handing over things.

That said, let me do some more debugging before I follow it up with
Cygwin folks.

Footnotes: 
[1]  This is launched like this:
C:\cygwin\bin\run.exe -p /usr/X11R6/bin xterm -fg green  -bg black  -sb
-sl 1000 -geom  80x15   -display 127.0.0.1:0.0 -ls







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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13  4:37         ` Eli Zaretskii
  2011-09-13  5:14           ` Jambunathan K
@ 2011-09-13  6:17           ` Jambunathan K
  2011-09-13  6:54             ` Eli Zaretskii
  1 sibling, 1 reply; 20+ messages in thread
From: Jambunathan K @ 2011-09-13  6:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480



> So it's a mystery why this happens with the Cygwin Bash.  Jambunathan,
> could you perhaps post a question to the Cygwin mailing list?

(setenv "CYGWIN" "noglob") 

solves the reported problem.

I was led to try the above option based on the below post which is
fairly recent: http://sourceware.org/ml/cygwin/2011-07/msg00218.html

Now I leave the table to the experts.

Jambunathan K.










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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13  6:17           ` Jambunathan K
@ 2011-09-13  6:54             ` Eli Zaretskii
  2011-09-13 18:05               ` Stefan Monnier
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-13  6:54 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 9480

> From: Jambunathan K <kjambunathan@gmail.com>
> Cc: Glenn Morris <rgm@gnu.org>,  9480@debbugs.gnu.org
> Date: Tue, 13 Sep 2011 11:47:00 +0530
> 
> > So it's a mystery why this happens with the Cygwin Bash.  Jambunathan,
> > could you perhaps post a question to the Cygwin mailing list?
> 
> (setenv "CYGWIN" "noglob") 
> 
> solves the reported problem.
> 
> I was led to try the above option based on the below post which is
> fairly recent: http://sourceware.org/ml/cygwin/2011-07/msg00218.html

Thanks.  This unlocks the mystery.  I think we can now close the bug
report, do you agree?  Perhaps etc/PROBLEMS should advise Cygwin users
to set CYGWIN=noglob (as I understand the default is CYGWIN=glob).

I still don't understand why GLOB_BRACE causes "{0}" be expanded --
that sounds like a bug in the implementation of `glob' used by Cygwin,
no?  Perhaps a Cygwin bug report is in order.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-12  7:09 bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting? Jambunathan K
  2011-09-12  7:29 ` Eli Zaretskii
@ 2011-09-13 13:35 ` Stefan Monnier
  2011-09-13 15:27   ` Eli Zaretskii
  1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2011-09-13 13:35 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 9480

> My shell-file-name is set to "bash" (cygwin version). My Emacs is

AFAIK this code does not run any shell.  Can you try to run those
commands by hand to see what kind of quoting (single quoting or double
quoting) is needed in a bash shell?


        Stefan





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13 13:35 ` Stefan Monnier
@ 2011-09-13 15:27   ` Eli Zaretskii
  2011-09-13 18:21     ` Glenn Morris
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-13 15:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9480, kjambunathan

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 13 Sep 2011 09:35:11 -0400
> Cc: 9480@debbugs.gnu.org
> 
> > My shell-file-name is set to "bash" (cygwin version). My Emacs is
> 
> AFAIK this code does not run any shell.

Yes, and that's the problem: by default Cygwin apps glob their
command-line arguments when invoked from a non-Cygwin program,
assuming that those non-Cygwin programs expect them to.

This should generally work fine, except that IMO globbing in this case
is simply buggy: the braces are removed although a real shell would
expand "{0}" into itself.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13  6:54             ` Eli Zaretskii
@ 2011-09-13 18:05               ` Stefan Monnier
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Monnier @ 2011-09-13 18:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480, Jambunathan K

> Thanks.  This unlocks the mystery.  I think we can now close the bug
> report, do you agree?  Perhaps etc/PROBLEMS should advise Cygwin users
> to set CYGWIN=noglob (as I understand the default is CYGWIN=glob).

Yes, it seems that cygwin's globbing is never desired for programs run
by Emacs.  But of course, Emacs may start non-cygwin programs which in
turn execute cygwin programs expecting them to do the globbing
(e.g. running cygwin programs from a CMD process in *shell*), so setting
CYGWIN=noglob might not be right either.



        Stefan





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13 15:27   ` Eli Zaretskii
@ 2011-09-13 18:21     ` Glenn Morris
  2011-09-14 10:58       ` Jambunathan K
  0 siblings, 1 reply; 20+ messages in thread
From: Glenn Morris @ 2011-09-13 18:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9480, kjambunathan

Eli Zaretskii wrote:

> This should generally work fine, except that IMO globbing in this case
> is simply buggy: the braces are removed although a real shell would
> expand "{0}" into itself.

I agree.

http://www.gnu.org/s/bash/manual/bash.html#Brace-Expansion

  A correctly-formed brace expansion must contain unquoted opening and
  closing braces, and at least one unquoted comma or a valid sequence
  expression. Any incorrectly formed brace expansion is left unchanged.

http://tiswww.case.edu/php/chet/bash/FAQ

Bash FAQ D2:

D2) Why doesn't bash treat brace expansions exactly like csh?

    The only difference between bash and csh brace expansion is that
    bash requires a brace expression to contain at least one unquoted
    comma if it is to be expanded.  Any brace-surrounded word not
    containing an unquoted comma is left unchanged by the brace
    expansion code.  This affords the greatest degree of sh
    compatibility.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-13 18:21     ` Glenn Morris
@ 2011-09-14 10:58       ` Jambunathan K
  2011-09-14 11:57         ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Jambunathan K @ 2011-09-14 10:58 UTC (permalink / raw)
  To: Glenn Morris, Eli Zaretskii; +Cc: 9480

Glenn Morris <rgm@gnu.org> writes:

> Eli Zaretskii wrote:
>
>> This should generally work fine, except that IMO globbing in this case
>> is simply buggy: the braces are removed although a real shell would
>> expand "{0}" into itself.
>
> I agree.

Glenn
Thanks for the reference note. I will file a bug report with Cygwin very
soon.

Eli
Feel free to close this bug.

> http://www.gnu.org/s/bash/manual/bash.html#Brace-Expansion
>
>   A correctly-formed brace expansion must contain unquoted opening and
>   closing braces, and at least one unquoted comma or a valid sequence
>   expression. Any incorrectly formed brace expansion is left unchanged.
>
> http://tiswww.case.edu/php/chet/bash/FAQ
>
> Bash FAQ D2:
>
> D2) Why doesn't bash treat brace expansions exactly like csh?
>
>     The only difference between bash and csh brace expansion is that
>     bash requires a brace expression to contain at least one unquoted
>     comma if it is to be expanded.  Any brace-surrounded word not
>     containing an unquoted comma is left unchanged by the brace
>     expansion code.  This affords the greatest degree of sh
>     compatibility.





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

* bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting?
  2011-09-14 10:58       ` Jambunathan K
@ 2011-09-14 11:57         ` Eli Zaretskii
  0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-09-14 11:57 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 9480-done

> From: Jambunathan K <kjambunathan@gmail.com>
> Cc:  Stefan Monnier <monnier@iro.umontreal.ca>,  9480@debbugs.gnu.org
> Date: Wed, 14 Sep 2011 16:28:27 +0530
> 
> Glenn Morris <rgm@gnu.org> writes:
> 
> > Eli Zaretskii wrote:
> >
> >> This should generally work fine, except that IMO globbing in this case
> >> is simply buggy: the braces are removed although a real shell would
> >> expand "{0}" into itself.
> >
> > I agree.
> 
> Glenn
> Thanks for the reference note. I will file a bug report with Cygwin very
> soon.
> 
> Eli
> Feel free to close this bug.

Done.





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

end of thread, other threads:[~2011-09-14 11:57 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-12  7:09 bug#9480: 24.0.50; (vc-git) stash@{n} - requires shell quoting? Jambunathan K
2011-09-12  7:29 ` Eli Zaretskii
2011-09-12  9:05   ` Jambunathan K
2011-09-12 10:51     ` Eli Zaretskii
2011-09-12 11:22       ` Jambunathan K
2011-09-12 11:50         ` Antoine Levitt
2011-09-12 11:56           ` Eli Zaretskii
2011-09-13  4:46             ` Jambunathan K
2011-09-13  1:39         ` Richard Stallman
2011-09-13  4:03       ` Glenn Morris
2011-09-13  4:37         ` Eli Zaretskii
2011-09-13  5:14           ` Jambunathan K
2011-09-13  6:17           ` Jambunathan K
2011-09-13  6:54             ` Eli Zaretskii
2011-09-13 18:05               ` Stefan Monnier
2011-09-13 13:35 ` Stefan Monnier
2011-09-13 15:27   ` Eli Zaretskii
2011-09-13 18:21     ` Glenn Morris
2011-09-14 10:58       ` Jambunathan K
2011-09-14 11:57         ` Eli Zaretskii

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