GNU bug report logs - #10160
24.0.91; diff-hunk-file-names returns quoted file names

Previous Next

Package: emacs;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Tue, 29 Nov 2011 11:35:02 UTC

Severity: normal

Tags: moreinfo

Found in version 24.0.91

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10160 in the body.
You can then email your comments to 10160 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10160; Package emacs. (Tue, 29 Nov 2011 11:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Albinus <michael.albinus <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 29 Nov 2011 11:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.91; diff-hunk-file-names returns quoted file names
Date: Tue, 29 Nov 2011 12:32:33 +0100
diff-hunk-file-names reads file names from the *Diff* buffer. The first
line (the diff command itself) can contain labels, marked with -L. If
these labels contains quoted characters like in remote file names, the
quotation is returned. Example:

diff -c -L /ftp\:slbhao\:/home/albinus/src/tramp/lisp/tramp.el -L /ftp\:slbhao\:/home/albinus/src/emacs/lisp/net/tramp.el /tmp/ange-ftp13518wvE.el /tmp/ange-ftp1351895K.el

Such quoted file names result in problems when used as parameter for
file name functions, like in diff-find-file-name.


In GNU Emacs 24.0.91.14 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.6)
 of 2011-11-28 on detlef
Windowing system distributor `GraphOn Corporation', version 11.0.60900000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  iswitchb-mode: t
  icomplete-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<f2> <escape> x r e p o r t <tab> <return>

Recent messages:
Reading active file from news via nntp...
Opening nntp server on news...failed: >>> (error Selecting deleted buffer)
Opening connection to imap.gmx.net via tls...
Reading active file via nnml...
Reading incoming mail from pop...
nnml: Reading incoming mail (no new mail)...done
Reading active file via nnml...done
Reading active file via nndraft...done
Checking new news...done
Warning: Opening nntp server on news...failed: >>> (error Selecting deleted buffer)

Load-path shadows:
/home/albinus/.emacs.d/elpa/debbugs-0.3/debbugs hides ~/lisp/debbugs
/home/albinus/.emacs.d/elpa/debbugs-0.3/debbugs-gnu hides ~/lisp/debbugs-gnu
~/src/tramp/lisp/tramp-uu hides /home/albinus/src/emacs/lisp/net/tramp-uu
~/src/tramp/lisp/tramp-cmds hides /home/albinus/src/emacs/lisp/net/tramp-cmds
~/src/tramp/lisp/tramp-cache hides /home/albinus/src/emacs/lisp/net/tramp-cache
~/src/tramp/lisp/tramp-gvfs hides /home/albinus/src/emacs/lisp/net/tramp-gvfs
~/src/tramp/lisp/tramp-gw hides /home/albinus/src/emacs/lisp/net/tramp-gw
~/src/tramp/lisp/tramp hides /home/albinus/src/emacs/lisp/net/tramp
~/src/tramp/lisp/tramp-smb hides /home/albinus/src/emacs/lisp/net/tramp-smb
~/src/tramp/lisp/tramp-sh hides /home/albinus/src/emacs/lisp/net/tramp-sh
~/src/tramp/lisp/trampver hides /home/albinus/src/emacs/lisp/net/trampver
~/src/tramp/lisp/tramp-ftp hides /home/albinus/src/emacs/lisp/net/tramp-ftp
~/src/tramp/lisp/tramp-compat hides /home/albinus/src/emacs/lisp/net/tramp-compat
~/lisp/soap-client hides /home/albinus/src/emacs/lisp/net/soap-client
~/lisp/dbus hides /home/albinus/src/emacs/lisp/net/dbus

Features:
(shadow sort mail-extr warnings emacsbug pop3 utf-7 gnutls nnimap
parse-time utf7 nndraft nnmh netrc nnml network-stream starttls tls
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 epg-config mm-view mml-smime smime dig mailcap gnus-cache
nnir gnus-sum nnnil smtpmail sendmail gnus-demon nntp gnus-group
gnus-undo nnmail mail-source nnoo gnus-start gnus-spec gnus-int
gnus-range message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win gnus gnus-ems nnheader mail-utils wid-edit
debbugs-autoloads package tabulated-list cperl-mode easymenu time tramp
tramp-compat auth-source eieio byte-opt bytecomp byte-compile cconv
macroexp assoc gnus-util mm-util mail-prsvr password-cache shell
pcomplete comint ring format-spec advice help-fns advice-preload cl
tramp-loaddefs iswitchb jka-compr icomplete paren ps-print ps-def lpr vc
ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult
ediff-init ediff vc-dispatcher dired regexp-opt time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer loaddefs button faces cus-face files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10160; Package emacs. (Tue, 29 Nov 2011 18:53:01 GMT) Full text and rfc822 format available.

Message #8 received at 10160 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 10160 <at> debbugs.gnu.org
Subject: Re: bug#10160: 24.0.91; diff-hunk-file-names returns quoted file names
Date: Tue, 29 Nov 2011 13:50:00 -0500
> diff-hunk-file-names reads file names from the *Diff* buffer. The first
> line (the diff command itself) can contain labels, marked with -L. If
> these labels contains quoted characters like in remote file names, the
> quotation is returned. Example:

> diff -c -L /ftp\:slbhao\:/home/albinus/src/tramp/lisp/tramp.el -L /ftp\:slbhao\:/home/albinus/src/emacs/lisp/net/tramp.el /tmp/ange-ftp13518wvE.el /tmp/ange-ftp1351895K.el

> Such quoted file names result in problems when used as parameter for
> file name functions, like in diff-find-file-name.

Not sure what to do about them: this "parsing the diff command line" is
brittle in any case because this line is printed by various tools, and
I don't think they're very consistent in how they handle quoting.
We should probably try to minimize the problem first, by using relative
file names when possible.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10160; Package emacs. (Tue, 29 Nov 2011 19:04:01 GMT) Full text and rfc822 format available.

Message #11 received at 10160 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 10160 <at> debbugs.gnu.org
Subject: Re: bug#10160: 24.0.91; diff-hunk-file-names returns quoted file names
Date: Tue, 29 Nov 2011 20:01:21 +0100
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> diff-hunk-file-names reads file names from the *Diff* buffer. The first
>> line (the diff command itself) can contain labels, marked with -L. If
>> these labels contains quoted characters like in remote file names, the
>> quotation is returned. Example:
>
>> diff -c -L /ftp\:slbhao\:/home/albinus/src/tramp/lisp/tramp.el -L
>> /ftp\:slbhao\:/home/albinus/src/emacs/lisp/net/tramp.el
>> /tmp/ange-ftp13518wvE.el /tmp/ange-ftp1351895K.el
>
>> Such quoted file names result in problems when used as parameter for
>> file name functions, like in diff-find-file-name.
>
> Not sure what to do about them: this "parsing the diff command line" is
> brittle in any case because this line is printed by various tools, and
> I don't think they're very consistent in how they handle quoting.
> We should probably try to minimize the problem first, by using relative
> file names when possible.

In my use case, it was superfluous, because the correct file names are
also parsed in the diff output (thanks to the -L label option). I don't
know whether we could generalize this, trusting just the given file
names of the diff result.

(And, btw, ediff could also use the -L argument. This would look better
than the local temp file names, as produced by Tramp for remote
files. But this is another story).

>         Stefan

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10160; Package emacs. (Fri, 16 Jul 2021 13:51:02 GMT) Full text and rfc822 format available.

Message #14 received at 10160 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 10160 <at> debbugs.gnu.org
Subject: Re: bug#10160: 24.0.91; diff-hunk-file-names returns quoted file names
Date: Fri, 16 Jul 2021 15:50:41 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> diff-hunk-file-names reads file names from the *Diff* buffer. The first
> line (the diff command itself) can contain labels, marked with -L. If
> these labels contains quoted characters like in remote file names, the
> quotation is returned. Example:
>
> diff -c -L /ftp\:slbhao\:/home/albinus/src/tramp/lisp/tramp.el -L /ftp\:slbhao\:/home/albinus/src/emacs/lisp/net/tramp.el /tmp/ange-ftp13518wvE.el /tmp/ange-ftp1351895K.el

Looking at the code, it just returns the first two "words" after
"diff -OPTION":

             ;; this assumes that there are no spaces in filenames
	     (when (re-search-backward
		    "^diff \\(-\\S-+ +\\)*\\(\\S-+\\)\\( +\\(\\S-+\\)\\)?"
		    nil t)
	       (list (if old (match-string 2) (match-string 4))
		     (if old (match-string 4) (match-string 2)))))))))

I guess we could filter out "-L +\\S-+" before matching?  But I don't
think I've ever seen "-L" in the wild, so I don't know whether it's
worth doing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 16 Jul 2021 13:51:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10160; Package emacs. (Sat, 14 Aug 2021 13:52:01 GMT) Full text and rfc822 format available.

Message #19 received at 10160 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 10160 <at> debbugs.gnu.org
Subject: Re: bug#10160: 24.0.91; diff-hunk-file-names returns quoted file names
Date: Sat, 14 Aug 2021 15:51:21 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I guess we could filter out "-L +\\S-+" before matching?  But I don't
> think I've ever seen "-L" in the wild, so I don't know whether it's
> worth doing.

Nobody had an opinion, but it seemed easy enough to add, so I've done so
in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 10160 <at> debbugs.gnu.org and Michael Albinus <michael.albinus <at> gmx.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 14 Aug 2021 13:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Sep 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 284 days ago.

Previous Next


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