From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71081: 30.0.50; shell-command-on-region outputs boilerplate text on Windows Date: Mon, 20 May 2024 21:59:21 +0300 Message-ID: <86y1848g3a.fsf@gnu.org> References: <875xv8qqlv.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11485"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71081@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 20 21:02:32 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 1s98HI-0002l7-Db for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 May 2024 21:02:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s98Gl-0007S4-Ry; Mon, 20 May 2024 15:02:00 -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 1s98Gk-0007Ri-F8 for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 15:01: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 1s98Gk-0000QF-77 for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 15:01:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s98Go-0005nr-Gx for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 15:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 May 2024 19:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71081 X-GNU-PR-Package: emacs Original-Received: via spool by 71081-submit@debbugs.gnu.org id=B71081.171623171022295 (code B ref 71081); Mon, 20 May 2024 19:02:02 +0000 Original-Received: (at 71081) by debbugs.gnu.org; 20 May 2024 19:01:50 +0000 Original-Received: from localhost ([127.0.0.1]:44222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s98Gb-0005nW-Ne for submit@debbugs.gnu.org; Mon, 20 May 2024 15:01:50 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s98GX-0005nJ-Oc; Mon, 20 May 2024 15:01:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s98EF-0008FF-VA; Mon, 20 May 2024 14:59:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=OtnTbBLSEfDbLkUuFIZrxckYKNuTyYQFs/cnIWg2ZE4=; b=NQusyWC4ELOJ F8201r9Nd/VEEFXzmT5F3o2C9efp+0rSMXxK8S1qv6JQOziksJzNE0kIueKzwqrotc/gjCgvntnfE LRY2MuChB9zwKDtouYOg1yAveQ6NfuPJCv1BfXTyRVN2qYBCEWlqQ3yupg62/9F0+oBkLcBnqdfP0 HQY8ucZhvlKmz7Nh7FnsY2eM3AKygfJ3VVmF0w3HmDN5jNLEYZN2Lb9CIy4RxtrakYFFFQHXCy/1i f3NqxlAQU+P/k4/aoaDotQQUPi0jp9/JZTehLIvkwnAVw1MJZXsckk8FtoRND/WAjvQEAuDx4ks5t lRa4NY/M681LXLaOohfxMQ==; In-Reply-To: <875xv8qqlv.fsf@localhost> (message from Ihor Radchenko on Mon, 20 May 2024 18:34:52 +0000) 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:285494 Archived-At: tags 71081 notabug thanks > From: Ihor Radchenko > Date: Mon, 20 May 2024 18:34:52 +0000 > > Hello, > > On Linux, if I put > > echo foo > > into scratch, select it, and run M-x shell-command-on-region sh, > I get "foo" in echo area. > > However, on Windows, the result of M-x shell-command-on-region cmdproxy is > > Microsoft Windows [Version 10.0.19045.2251] > (c) Microsoft Corporation. All rights reserved. > > c:\Users\johndoe\Org>echo foo > foo > > I expected just "foo". > > Original bug report: > https://list.orgmode.org/orgmode/CACjq+cy8G+EkMgSwr5KWNbN7jjLE3tzqKwbQiTy84ZvJsumMwQ@mail.gmail.com/ > > AFAIU, the culprit is how cmdproxy handles piped input: > > cmdproxy -c 'echo foo' works fine, outputting "foo". > However (in powershell) echo 'echo foo' | cmdproxy yields the above > verbose text - all in stdout. It is not cmdproxy that does this, it's cmd.exe. cmdproxy is not a shell, it's a simply proxy of the shell that is there to fix some obscure problems (such as some quoting issues). To run shell commands, it eventually invokes cmd.exe. Try echo echo foo | cmd and you will see the same behavior. Conclusion: Windows is not a Posix system. But you already knew that... As for the original bug report: AFAIR, when cmd.exe says "More?", it needs a final newline. Other than that, I don't really understand what is the problem that bug report is trying to solve (I don't use org-babel). If it expects the same behavior from cmd.exe as a Posix shell would produce, the expectation is simply incorrect and unjustified. I see no Emacs bug here.