From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: vc-git-previous-revision and cmd.exe Date: Mon, 17 Nov 2014 20:04:50 +0200 Message-ID: <8361edbt4t.fsf@gnu.org> References: <83bno5bwir.fsf@gnu.org> <87ppcl1zlt.fsf@igel.home> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1416247541 20276 80.91.229.3 (17 Nov 2014 18:05:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2014 18:05:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 17 19:05:34 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XqQgA-00082D-Hr for ged-emacs-devel@m.gmane.org; Mon, 17 Nov 2014 19:05:34 +0100 Original-Received: from localhost ([::1]:49549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQg9-0006wS-Le for ged-emacs-devel@m.gmane.org; Mon, 17 Nov 2014 13:05:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQfi-0006lR-Qk for emacs-devel@gnu.org; Mon, 17 Nov 2014 13:05:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqQfd-0001nf-GT for emacs-devel@gnu.org; Mon, 17 Nov 2014 13:05:06 -0500 Original-Received: from mtaout29.012.net.il ([80.179.55.185]:37472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQfc-0001nP-Vt for emacs-devel@gnu.org; Mon, 17 Nov 2014 13:05:01 -0500 Original-Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0NF70080034SB900@mtaout29.012.net.il> for emacs-devel@gnu.org; Mon, 17 Nov 2014 20:03:11 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NF700PQW3HB1U80@mtaout29.012.net.il>; Mon, 17 Nov 2014 20:03:11 +0200 (IST) In-reply-to: <87ppcl1zlt.fsf@igel.home> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.185 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:177465 Archived-At: > From: Andreas Schwab > Cc: emacs-devel@gnu.org > Date: Mon, 17 Nov 2014 18:55:10 +0100 > > Eli Zaretskii writes: > > > vc-git-previous-revision appends "^" to a revision to get the previous > > one. But "^" is a special character for the Windows cmd.exe shell, so > > 'D' in the *vc-change-log* buffer doesn't work if the 'git' command is > > actually a batch file that invokes the real Git executable, in which > > case we call cmd.exe to run the batch file, and cmd.exe removes the ^ > > (because it's the escape character). > > Why is that a problem? process-file should properly quote the arguments > when it needs to go through a shell. It's a Windows-specific conundrum: '^' is only special to cmd.exe, not to argv[] processing of any other .exe program. On top of that, the only way to escape '^' is to double it. But if we always double it, then passing it to anything except cmd.exe will result in 2 ^^ in the program's argv[]. And since most of the programs we invoke are not cmd.exe or batch files, we don't quote '^' in shell-quote-argument. On top of that, I don't think process-file knows it will go through a shell in this case, since git.cmd it finds is just an executable file for it. (I bumped into this because 'D' in the *vc-change-log* buffer claimed there were "no differences between 1234567 and 123456789...abc", because cmd.exe removed the ^ part.)