From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 24 06:24:35 2011 Received: (at submit) by debbugs.gnu.org; 24 Apr 2011 10:24:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QDwUU-0007Lm-Jw for submit@debbugs.gnu.org; Sun, 24 Apr 2011 06:24:35 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QDw87-0006rX-II for submit@debbugs.gnu.org; Sun, 24 Apr 2011 06:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QDw81-0003Zi-Ds for submit@debbugs.gnu.org; Sun, 24 Apr 2011 06:01:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:43246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDw81-0003Ze-CU for submit@debbugs.gnu.org; Sun, 24 Apr 2011 06:01:21 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDw80-00026H-0T for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2011 06:01:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QDw7z-0003ZS-1z for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2011 06:01:19 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:56638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDw7y-0003ZO-Nd for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2011 06:01:18 -0400 Received: by fxm18 with SMTP id 18so1172402fxm.0 for ; Sun, 24 Apr 2011 03:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=jQeCJukecdWVxiO4V+ZXtLlxBZQRHbP+WdWdnvKN1wU=; b=aaBs8ccMFTQdHUdiJ+Ey2UqnO+kw0kCZSXS2RNimQSIYl3kc5aZCfozqLXeMz0A4iw Svc7InYj48k6T9smMb6YjFWzaOfs1FN8bfckUsQYcT/V7zHJdNXEDbyICcQZTLOTZiT1 P5OhIufgi1jlrcQBI1clQRuLLXTDul2UsI2qs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=hHs2bMR2P/Jneh+7KccELqKg8G8IG5XUniNp4kh0MLUl1EUFx8KLD1YgnMoXX0VTLD ztEiJTU3gbywOkhAGGd8O7x1p0/bhlZNiNCURIdsuFRS7KGVYSVunDojNe4Z6bXmrByO tRJNItd0F8qmpaudb87BuJk7BJo75/dRpN46s= MIME-Version: 1.0 Received: by 10.223.97.219 with SMTP id m27mr3153804fan.81.1303639277139; Sun, 24 Apr 2011 03:01:17 -0700 (PDT) Received: by 10.223.83.137 with HTTP; Sun, 24 Apr 2011 03:01:17 -0700 (PDT) Date: Sun, 24 Apr 2011 12:01:17 +0200 Message-ID: Subject: start-process fails when both the program path and an argument contain spaces From: Ivar Rummelhoff To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 24 Apr 2011 06:24:33 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) 1. Trying to execute (start-process "name" "buffer" "D:\\tmp\\xxx yyy\\foo.bat" "yada yada") writes the following to "buffer": 'd:\tmp\xxx' is not recognized as an internal or external command, operable program or batch file. Process name exited abnormally with code 1 Emacs version: GNU Emacs 23.3.1 (i386-mingw-nt6.1.7601) of 2011-03-10 on 3249CTO 2. If space is avoided in either the program path or the argument, as in (start-process "name" "buffer" "D:\\tmp\\foo.bat" "yada yada") or (start-process "name" "buffer" "D:\\tmp\\xxx yyy\\foo.bat" "yada-yada") then everything works well. 3. The same problem occurs when I give `start-process' the program name only (instead of the full path) as long as the full path to the program contains spaces (and one of the arguments contains spaces). 4. Quoting the program path or the argument (with " or \) does not help. If quote the program path, I get "no such file or directory"; and quoting the argument has no effect as long as there is still a space character "in there". (Besides, it seems any quoting of the arguments is passed on to the program.) 5. There seems to be no work-around for this in emacs lisp. Best Regards, Ivar Rummelhoff From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 24 15:42:23 2011 Received: (at 8541) by debbugs.gnu.org; 24 Apr 2011 19:42:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QE5CJ-0004KB-54 for submit@debbugs.gnu.org; Sun, 24 Apr 2011 15:42:23 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QE5CF-0004Jy-PM for 8541@debbugs.gnu.org; Sun, 24 Apr 2011 15:42:20 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LK60020096BGQ00@a-mtaout20.012.net.il> for 8541@debbugs.gnu.org; Sun, 24 Apr 2011 22:41:51 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.127.55.52]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LK6001O39DPVO70@a-mtaout20.012.net.il>; Sun, 24 Apr 2011 22:41:51 +0300 (IDT) Date: Sun, 24 Apr 2011 22:41:53 +0300 From: Eli Zaretskii Subject: Re: bug#8541: start-process fails when both the program path and an argument contain spaces In-reply-to: X-012-Sender: halo1@inter.net.il To: Ivar Rummelhoff Message-id: <83zknfa132.fsf@gnu.org> References: X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 8541 Cc: 8541@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > Date: Sun, 24 Apr 2011 12:01:17 +0200 > From: Ivar Rummelhoff > > 1. Trying to execute > > (start-process "name" "buffer" "D:\\tmp\\xxx yyy\\foo.bat" "yada yada") > > writes the following to "buffer": > > 'd:\tmp\xxx' is not recognized as an internal or external command, > operable program or batch file. > > Process name exited abnormally with code 1 > > Emacs version: GNU Emacs 23.3.1 (i386-mingw-nt6.1.7601) of 2011-03-10 on 3249CTO > > > 2. If space is avoided in either the program path or the argument, as in > > (start-process "name" "buffer" "D:\\tmp\\foo.bat" "yada yada") > or > (start-process "name" "buffer" "D:\\tmp\\xxx yyy\\foo.bat" "yada-yada") > > then everything works well. > > > 3. The same problem occurs when I give `start-process' the program > name only (instead of the full path) as long as the full path to the > program contains spaces (and one of the arguments contains spaces). > > > 4. Quoting the program path or the argument (with " or \) does not > help. If quote the program path, I get "no such file or directory"; > and quoting the argument has no effect as long as there is still a > space character "in there". (Besides, it seems any quoting of the > arguments is passed on to the program.) This is due to deficiencies in the Windows API for launching programs (CreateProcess): it concatenates the command arguments into a single string, separated by blanks.. To work around, invoke the command through cmd.exe, and use cmd.exe-specific quoting character '^'. Like this: (start-process "name" "buffer" "cmd.exe" "/c" "D:\\tmp\\xxx^ yyy\\foo.bat yada^ yada") This is fragile, and you will need to redo the quoting if you invoke other programs or have whitespace in other places. But I don't know how to do better, given the Windows API misfeatures. It is best to avoid whitespace in the arguments. For file names, you can use 8+3 aliases, if you cannot control the names of the files or directories. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 30 12:29:49 2015 Received: (at 8541) by debbugs.gnu.org; 30 Sep 2015 16:29:49 +0000 Received: from localhost ([127.0.0.1]:49485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhKGK-0008JI-SZ for submit@debbugs.gnu.org; Wed, 30 Sep 2015 12:29:49 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:35499) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhKGJ-0008Iy-PF for 8541@debbugs.gnu.org; Wed, 30 Sep 2015 12:29:48 -0400 Received: by wicge5 with SMTP id ge5so204881948wic.0 for <8541@debbugs.gnu.org>; Wed, 30 Sep 2015 09:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=QbxGZLIgFrkL1E7+0hvYRVdSzOBjThmVXiVCHPbH234=; b=cMV71sWXAtnrPTR36+4KJQFTd1Xt41GTUwEQbMTLNAwyyEDYhK/lX/O9wKRBpm/lPm Qf1tv5ItQJijKV9hyXWWaUtSaB5ln+emCXdB0HjrN/7OF+O7hHnRjRdKXnr7v7joyCaX qjBFXAUrLEITfp9JLI6RftMo0RCR6YRrcGYUovu0h6OucyghcQycuE4svol934QnR/7e pnVJeXKWeqoYnfQZyUz03Ymg+KAVLB7bC6HNGf0heHaVtGyd7lBO1rWXt1pqg09lyq+o JHoNhNpBiMhS93K+0ccqtCWLb6k5euifpimp3nEWzv3UcaqqCRlTxNuO+uV/tiNJJOHy g0QQ== MIME-Version: 1.0 X-Received: by 10.180.93.168 with SMTP id cv8mr26388963wib.54.1443630581984; Wed, 30 Sep 2015 09:29:41 -0700 (PDT) Received: by 10.28.210.68 with HTTP; Wed, 30 Sep 2015 09:29:41 -0700 (PDT) Date: Wed, 30 Sep 2015 12:29:41 -0400 X-Google-Sender-Auth: eClQDZFLGcDcbJKtKOYugNfeIyU Message-ID: Subject: Re: bug#8541: start-process fails when both the program path and an argument contain spaces From: Noam Postavsky To: 8541@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 8541 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) I believe this was fixed along with #18745 (while searching for it I happened to stumble upon this one). A nicer workaround suggested by Eli on that bug is to use w32-short-file-name: (start-process "name" "buffer" (w32-short-file-name "D:\\tmp\\xxx yyy\\foo.bat") "yada yada") From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 01 03:55:04 2015 Received: (at 8541-done) by debbugs.gnu.org; 1 Oct 2015 07:55:04 +0000 Received: from localhost ([127.0.0.1]:49861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhYhk-0005Qe-9A for submit@debbugs.gnu.org; Thu, 01 Oct 2015 03:55:04 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:34958) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhYhi-0005QB-1Q for 8541-done@debbugs.gnu.org; Thu, 01 Oct 2015 03:55:03 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NVJ00N0078Z2600@a-mtaout20.012.net.il> for 8541-done@debbugs.gnu.org; Thu, 01 Oct 2015 10:54:06 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NVJ00MKA7A6JGB0@a-mtaout20.012.net.il>; Thu, 01 Oct 2015 10:54:06 +0300 (IDT) Date: Thu, 01 Oct 2015 10:53:56 +0300 From: Eli Zaretskii Subject: Re: bug#8541: start-process fails when both the program path and an argument contain spaces In-reply-to: X-012-Sender: halo1@inter.net.il To: Noam Postavsky Message-id: <83pp0z9g8b.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 8541-done Cc: 8541-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Wed, 30 Sep 2015 12:29:41 -0400 > From: Noam Postavsky > > I believe this was fixed along with #18745 (while searching for it I > happened to stumble upon this one). Indeed, so closing this one. From unknown Sat Aug 16 18:19:28 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 29 Oct 2015 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator