From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#71081: 30.0.50; shell-command-on-region outputs boilerplate text on Windows Date: Thu, 23 May 2024 14:00:44 +0000 Message-ID: <875xv4y6er.fsf@localhost> References: <875xv8qqlv.fsf@localhost> <86y1848g3a.fsf@gnu.org> <863fc61b-5ad5-47e5-9f95-96cdcfcfd016@gutov.dev> <8634qa8tp0.fsf@gnu.org> <87le42jcj0.fsf@localhost> <86a5ki6kf1.fsf@gnu.org> <875xv5kjmg.fsf@localhost> <86zfsh6gpp.fsf@gnu.org> <87cypcybpa.fsf@localhost> <86bk4w4pjg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14861"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 71081@debbugs.gnu.org, matt@excalamus.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 23 16:01:09 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sA90H-0003eF-A4 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 May 2024 16:01:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sA8zF-00059O-Hv; Thu, 23 May 2024 10:00:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sA8z8-00056I-80 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 09:59:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sA8z5-0000QP-WF for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 09:59:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sA8zC-00036S-0c for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 10:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 May 2024 14:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71081 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 71081-submit@debbugs.gnu.org id=B71081.171647276311879 (code B ref 71081); Thu, 23 May 2024 14:00:01 +0000 Original-Received: (at 71081) by debbugs.gnu.org; 23 May 2024 13:59:23 +0000 Original-Received: from localhost ([127.0.0.1]:59148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sA8yX-00035X-8m for submit@debbugs.gnu.org; Thu, 23 May 2024 09:59:23 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:47707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sA8yN-00035R-Qu for 71081@debbugs.gnu.org; Thu, 23 May 2024 09:59:20 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 924C4240028 for <71081@debbugs.gnu.org>; Thu, 23 May 2024 15:58:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1716472739; bh=O/W3js85Rts533GHn/zs9FVUxh9ExU3ppJhdsoLcMuk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=POH4mmvPbSGLT8VjaYnDa2L0dptIQuvRdzQoEbv7WHcJfkE6Bl+QFpFgDJIxNnfNm jJ12ErLChRrgjpEDI57XuRT6aNhm4PIRBDV3LEhjo/slrj2novK9joi7A3ShUaHED+ wio/JeKdZ04KBRIpSlm3lJ7LxAXrlOvjaWq3wsQfYNKM3uLEoM0pJbcHwq6V5FESSU XBlr1+1GUucQdV/nOF0MCX09rZNqUqU/sfrc5388iYW8/EltviiFsbCszIlV0ezCM+ L/SnKm4KtWm4Md1B9aIJXfvgMvzc3PW9am7TKZSRxZfLn5dEHWMkqGVY1Zv+MpGIk8 v56Yhx6jQLEBA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VlVC662Wyz9rxB; Thu, 23 May 2024 15:58:58 +0200 (CEST) In-Reply-To: <86bk4w4pjg.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285711 Archived-At: Eli Zaretskii writes: >> On Windows, it yields >> >> "foo" > > Yes, because the Windows shell doesn't support command lines with > embedded newlines, so it ignores everything past the first newline. > (Actually, there are complicated tricks to do that, but I'll spare > you.) Should it be documented in the docstring of `shell-command-to-string'? Currently, it only mentions `shell-quote-argument' and the current behaviour is not expected - there is nothing indicating that one should be careful about newlines (or any other characters passed to system shell). > Instead, you should do this on Windows: > > (shell-command-to-string "echo foo && echo bar") > > This is the documented method of invoking cmd.exe with multiple > commands. Maybe. But `shell-command-on-region' does work with multi-line commands, so it all boils down to implementation details, which are not really described... Why would anyone assume that `shell-command-to-string' is passed as an argument to cmd.exe and not piped as input? Or wise versa. Or maybe by some other means - all the cases have subtle differences. (not just on Windows; on Linux as well; more over, on Linux, different shells have different behaviors wrt input/command argument/script file). -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at