GNU bug report logs - #6136
Emerge doesn't handle file names with spaces on MS Windows

Previous Next

Package: emacs;

Reported by: Joakim Hårsman <joakim.harsman <at> gmail.com>

Date: Fri, 7 May 2010 19:30:02 UTC

Severity: normal

Fixed in versions 23.3.90, 25.2

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joakim Hårsman <joakim.harsman <at> gmail.com>
Cc: 6136 <at> debbugs.gnu.org
Subject: Re: bug#6136: Emerge doesn't handle file names with spaces on MS
	Windows
Date: Sat, 08 May 2010 18:08:01 +0300
> Date: Fri, 7 May 2010 21:19:36 +0200
> From: Joakim Hårsman <joakim.harsman <at> gmail.com>
> Cc: 
> 
> If any of the file names supplied to Emerge (e.g to
> emerge-files-with-ancestor) has spaces in in its path and Emacs is
> running on MS Windows, the merge fails.
> 
> The problem is the way Emerge passes the file names to diff, it tries
> to escape spaces (and other metchars) with backslashes, but that
> doesn't work on MS Windows since the backslash is a path separator
> there.
> 
> If I change the definition of emerge-protect-metachars to the
> following it works:
> 
> (defun emerge-protect-metachars (s)
>   (if (member system-type '(windows-nt ms-dos))
>       (emerge-protect-metachars-win s)
>     (emerge-protect-metachars-nix s)))
> 
> (defun emerge-protect-metachars-nix (s)
>   (let ((limit 0))
>     (while (string-match emerge-metachars s limit)
>       (setq s (concat (substring s 0 (match-beginning 0))
> 		      "\\"
> 		      (substring s (match-beginning 0))))
>       (setq limit (1+ (match-end 0)))))
>   s)
> 
> (defun emerge-protect-metachars-win (s)
>   (concat "\"" s "\""))

I think emerge-protect-metachars should simply use
shell-quote-argument, on all platforms.  Then it won't need to
distinguish between the different flavors, and it won't need to know
which characters need protection, something that is shell-dependent
and thus tricky even on Unix.

Could you try a patch along those line, and see if it works?





This bug report was last modified 8 years and 293 days ago.

Previous Next


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