all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dired cannot access file names with a quote
@ 2007-10-03 14:47 Francesco Potorti`
  2007-10-05  7:38 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Francesco Potorti` @ 2007-10-03 14:47 UTC (permalink / raw)
  To: bug-gnu-emacs

The subject describes what I suspect is the cause of the bug, but I am
not sure, because I made no real investigation

$ touch /tmp/First-October\ \'07.pdf
$ emacs -Q
C-x d /tmp/Firs TAB RET
 ==> Listing directory failed but `access-file' worked

In GNU Emacs 22.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.10.13)
 of 2007-08-22 on excelsior, modified by Debian
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2''

Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: it_IT@euro
  value of $LC_CTYPE: it_IT@euro
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: C
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Shell

Minor modes in effect:
  desktop-save-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
6 ~ d S q ESC x r m a RET n SPC ESC > ESC O A C-c C-c 
RET C-x d ESC O A RET ESC O B ESC O A C-x d ESC O A 
RET C-x d ESC O A ESC DEL ESC DEL ESC DEL ESC DEL RET 
s ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC 
O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A 
ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC 
O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A 
ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC 
O A ESC O B ESC O B ESC O A C-x k RET ESC x m a n ESC 
DEL C-g ESC O A ESC O A ESC O A ESC O A ESC O C ESC 
O C ESC O C ESC O C ESC O C ESC O C ESC O C ESC O C 
ESC O C ESC O C ESC O C ESC O C C-k C-x C-g ESC x s 
h e l l RET t o u c h SPC / t m p / C-y ESC O D ESC 
O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D 
\ ESC O C \ RET C-x d / t m p / F i r TAB RET ESC x 
r e p o r t TAB TAB e m TAB RET

Recent messages:
2 new messages read
Formatting MIME message... done
Mark set
Wrote /home/pot/cng/First-October '07.pdf
insert-directory: Listing directory failed but `access-file' worked [2 times]
Quit
byte-code: Buffer is read-only: #<buffer RMAIL>
Mark set
insert-directory: Listing directory failed but `access-file' worked
Making completion list...




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

* Re: dired cannot access file names with a quote
  2007-10-03 14:47 dired cannot access file names with a quote Francesco Potorti`
@ 2007-10-05  7:38 ` Glenn Morris
  0 siblings, 0 replies; 7+ messages in thread
From: Glenn Morris @ 2007-10-05  7:38 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: bug-gnu-emacs

Francesco Potorti` wrote:

> The subject describes what I suspect is the cause of the bug, but I am
> not sure, because I made no real investigation
>
> $ touch /tmp/First-October\ \'07.pdf
> $ emacs -Q
> C-x d /tmp/Firs TAB RET
>  ==> Listing directory failed but `access-file' worked

This comment from insert-directory looks relevant:

   Quote some characters that have special meanings in shells; but
   don't quote the wildcards--we want them to be special. We also
   currently don't quote the quoting characters in case people want to
   use them explicitly to quote wildcard characters.

Ie,

(shell-quote-wildcard-pattern "/tmp/First-October '07.pdf")

returns "/tmp/First-October\\ '07.pdf", rather than
"/tmp/First-October\\ \\'07.pdf".




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

* Re: dired cannot access file names with a quote
  2008-01-21 20:31 [jidanni@jidanni.org: find-library-name perhaps should try .emacs] Richard Stallman
@ 2008-02-23 22:28 ` Chong Yidong
  2008-02-23 22:49   ` Glenn Morris
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chong Yidong @ 2008-02-23 22:28 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: emacs-devel

> The subject describes what I suspect is the cause of the bug, but I am
> not sure, because I made no real investigation
>
> $ touch /tmp/First-October\ \'07.pdf
> $ emacs -Q
> C-x d /tmp/Firs TAB RET
>  ==> Listing directory failed but `access-file' worked

I think the fix is to quote ' as well in shell-quote-wildcard-pattern.
Could someone on this list double-check?


*** emacs/lisp/files.el.~1.896.2.37.~	2008-01-29 13:34:43.000000000 -0500
--- emacs/lisp/files.el	2008-02-23 17:25:50.000000000 -0500
***************
*** 4774,4780 ****
  
  PATTERN is assumed to represent a file-name wildcard suitable for the
  underlying filesystem.  For Unix and GNU/Linux, the characters from the
! set [ \\t\\n;<>&|()#$] are quoted with a backslash; for DOS/Windows, all
  the parts of the pattern which don't include wildcard characters are
  quoted with double quotes.
  Existing quote characters in PATTERN are left alone, so you can pass
--- 4774,4780 ----
  
  PATTERN is assumed to represent a file-name wildcard suitable for the
  underlying filesystem.  For Unix and GNU/Linux, the characters from the
! set [ \\t\\n;<>&|()#$'] are quoted with a backslash; for DOS/Windows, all
  the parts of the pattern which don't include wildcard characters are
  quoted with double quotes.
  Existing quote characters in PATTERN are left alone, so you can pass
***************
*** 4806,4812 ****
  	  (concat result (substring pattern beg) "\""))))
       (t
        (let ((beg 0))
! 	(while (string-match "[ \t\n;<>&|()#$]" pattern beg)
  	  (setq pattern
  		(concat (substring pattern 0 (match-beginning 0))
  			"\\"
--- 4806,4812 ----
  	  (concat result (substring pattern beg) "\""))))
       (t
        (let ((beg 0))
! 	(while (string-match "[ \t\n;<>&|()#$']" pattern beg)
  	  (setq pattern
  		(concat (substring pattern 0 (match-beginning 0))
  			"\\"




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

* Re: dired cannot access file names with a quote
  2008-02-23 22:28 ` dired cannot access file names with a quote Chong Yidong
@ 2008-02-23 22:49   ` Glenn Morris
  2008-02-23 23:55     ` Chong Yidong
  2008-02-24  0:26   ` Stefan Monnier
  2008-02-25 17:41   ` Chong Yidong
  2 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2008-02-23 22:49 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Francesco Potortì, emacs-devel

Chong Yidong wrote:

> I think the fix is to quote ' as well in shell-quote-wildcard-pattern.
> Could someone on this list double-check?

Won't that break things like 'foo*' that people might want to pass to
shell-quote-wildcard-pattern, as per the comment in the function's
doc-string?

'foo*' and \'foo*\' are not the same to the shell.




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

* Re: dired cannot access file names with a quote
  2008-02-23 22:49   ` Glenn Morris
@ 2008-02-23 23:55     ` Chong Yidong
  0 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2008-02-23 23:55 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Francesco Potortì, emacs-devel

Glenn Morris <rgm@gnu.org> writes:

> Chong Yidong wrote:
>
>> I think the fix is to quote ' as well in shell-quote-wildcard-pattern.
>> Could someone on this list double-check?
>
> Won't that break things like 'foo*' that people might want to pass to
> shell-quote-wildcard-pattern, as per the comment in the function's
> doc-string?
>
> 'foo*' and \'foo*\' are not the same to the shell.

Don't the quote characters referred to in the docstring refer to
backslash (\)?

The only place that calls shell-quote-wildcard-pattern in the Emacs
source tree is insert-directory, and the logic in insert-directory
indicates that shell-quote-wildcard-pattern is simply intended to
quote special characters that would screw up the call to `ls'.  Is
there any way of passing a ' character in the file argument to
insert-directory, except as a literal part of a filename?




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

* Re: dired cannot access file names with a quote
  2008-02-23 22:28 ` dired cannot access file names with a quote Chong Yidong
  2008-02-23 22:49   ` Glenn Morris
@ 2008-02-24  0:26   ` Stefan Monnier
  2008-02-25 17:41   ` Chong Yidong
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2008-02-24  0:26 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Francesco Potort\x1fFFFFFF, emacs-devel

> I think the fix is to quote ' as well in shell-quote-wildcard-pattern.
> Could someone on this list double-check?

I haven't had time to check if that makes sense, but if it makes sense,
then " should probably be added as well.


        Stefan


> *** emacs/lisp/files.el.~1.896.2.37.~	2008-01-29 13:34:43.000000000 -0500
> --- emacs/lisp/files.el	2008-02-23 17:25:50.000000000 -0500
> ***************
> *** 4774,4780 ****
  
>   PATTERN is assumed to represent a file-name wildcard suitable for the
>   underlying filesystem.  For Unix and GNU/Linux, the characters from the
> ! set [ \\t\\n;<>&|()#$] are quoted with a backslash; for DOS/Windows, all
>   the parts of the pattern which don't include wildcard characters are
>   quoted with double quotes.
>   Existing quote characters in PATTERN are left alone, so you can pass
> --- 4774,4780 ----
  
>   PATTERN is assumed to represent a file-name wildcard suitable for the
>   underlying filesystem.  For Unix and GNU/Linux, the characters from the
> ! set [ \\t\\n;<>&|()#$'] are quoted with a backslash; for DOS/Windows, all
>   the parts of the pattern which don't include wildcard characters are
>   quoted with double quotes.
>   Existing quote characters in PATTERN are left alone, so you can pass
> ***************
> *** 4806,4812 ****
>   	  (concat result (substring pattern beg) "\""))))
>        (t
>         (let ((beg 0))
> ! 	(while (string-match "[ \t\n;<>&|()#$]" pattern beg)
>   	  (setq pattern
>   		(concat (substring pattern 0 (match-beginning 0))
>   			"\\"
> --- 4806,4812 ----
>   	  (concat result (substring pattern beg) "\""))))
>        (t
>         (let ((beg 0))
> ! 	(while (string-match "[ \t\n;<>&|()#$']" pattern beg)
>   	  (setq pattern
>   		(concat (substring pattern 0 (match-beginning 0))
>   			"\\"





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

* Re: dired cannot access file names with a quote
  2008-02-23 22:28 ` dired cannot access file names with a quote Chong Yidong
  2008-02-23 22:49   ` Glenn Morris
  2008-02-24  0:26   ` Stefan Monnier
@ 2008-02-25 17:41   ` Chong Yidong
  2 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2008-02-25 17:41 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

>> The subject describes what I suspect is the cause of the bug, but I am
>> not sure, because I made no real investigation
>>
>> $ touch /tmp/First-October\ \'07.pdf
>> $ emacs -Q
>> C-x d /tmp/Firs TAB RET
>>  ==> Listing directory failed but `access-file' worked
>
> I think the fix is to quote ' as well in shell-quote-wildcard-pattern.
> Could someone on this list double-check?

I've checked this change into both the branch and the trunk.  I think
it's safe, but please keep an eye out for anything unusual.




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

end of thread, other threads:[~2008-02-25 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-03 14:47 dired cannot access file names with a quote Francesco Potorti`
2007-10-05  7:38 ` Glenn Morris
  -- strict thread matches above, loose matches on Subject: below --
2008-01-21 20:31 [jidanni@jidanni.org: find-library-name perhaps should try .emacs] Richard Stallman
2008-02-23 22:28 ` dired cannot access file names with a quote Chong Yidong
2008-02-23 22:49   ` Glenn Morris
2008-02-23 23:55     ` Chong Yidong
2008-02-24  0:26   ` Stefan Monnier
2008-02-25 17:41   ` Chong Yidong

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.