From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Ihor Radchenko <yantar92@posteo.net>
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:36:22 +0000
Message-ID: <87y180wq6x.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>
 <875xv4y6er.fsf@localhost> <867cfk4nus.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="39673"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: dmitry@gutov.dev, 71081@debbugs.gnu.org, matt@excalamus.com
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 23 16:35:22 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1sA9XN-000A4M-BT
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 May 2024 16:35:21 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1sA9Wz-0000dh-Gk; Thu, 23 May 2024 10:34:57 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1sA9Wy-0000dL-3H
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 10:34:56 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1sA9Wx-0007f4-QZ
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 10:34:55 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sA9X3-0003Tb-SF
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 10:35:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Ihor Radchenko <yantar92@posteo.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 23 May 2024 14:35:01 +0000
Resent-Message-ID: <handler.71081.B71081.171647489713350@debbugs.gnu.org>
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.171647489713350
 (code B ref 71081); Thu, 23 May 2024 14:35:01 +0000
Original-Received: (at 71081) by debbugs.gnu.org; 23 May 2024 14:34:57 +0000
Original-Received: from localhost ([127.0.0.1]:59310 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1sA9Wy-0003TG-Ty
 for submit@debbugs.gnu.org; Thu, 23 May 2024 10:34:57 -0400
Original-Received: from mout01.posteo.de ([185.67.36.65]:60115)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@posteo.net>) id 1sA9Ws-0003TA-PQ
 for 71081@debbugs.gnu.org; Thu, 23 May 2024 10:34:55 -0400
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 2607D240027
 for <71081@debbugs.gnu.org>; Thu, 23 May 2024 16:34:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1716474878; bh=FuIIHZQF6VblCqb/piOlzPrdANcTjPVzwNVNxcKrgEs=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=NmR4eCwcrca8ZhsrDYMGUDj0/peeBJSirYDhqJQrlBKHpb0zqIRVaFygUJAvSO7wN
 mE6mapZ0VSxrIBLs4i+AOW/01/60AVr4cc7sM3ybSvRjHfXhA5Vypkn9NigKo4Yoog
 8EckQKz8A7xqvbU8TG0PrbaLBTJn/TJgpBg50sRCc6egUhwFdrEEUBHRsjU0iklu5D
 /uw09ls8EtlB2pTM6SzsK0mGQv2pzp8A0ZyzIjst3B+79K+e+yZCFtjv95NEJtkS9H
 Fc3Lcoh+qi8nCU05TcmQdns47mLSetYILWaDzK1NYwRlVi/Ud1kGHcmeb2vQ/b1wWG
 2loLtActr0JYQ==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4VlW0D534lz9rxK;
 Thu, 23 May 2024 16:34:36 +0200 (CEST)
In-Reply-To: <867cfk4nus.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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=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:285715
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/285715>

Eli Zaretskii <eliz@gnu.org> writes:

>> Should it be documented in the docstring of `shell-command-to-string'?
>
> We could, but IMO such tangential information belongs to the manual,
> not to the doc string.  We should also somehow avoid the slippery
> slope of describing all the differences between the Posix shells and
> the Windows shell.  E.g., newlines are also not allowed in Windows
> file names, but we don't mention that in doc strings of every function
> that deals with file names.

Understood.

>> Why would anyone assume that `shell-command-to-string' is
>> passed as an argument to cmd.exe and not piped as input?
>
> Because the doc string says so:
>
>   Execute shell command COMMAND and return its output as a string.
>
> "Execute COMMAND" means run it as "SHELL -c COMMAND", in any
> reasonable interpretation.  Anything else is not the usual way of
> running commands.

Another reasonable interpretation is: "do the same thing as if I type
COMMAND into shell prompt". But that's me. If you think that my
interpretation is uncommon, so be it.

>> more over, on Linux, different shells have different behaviors wrt
>> input/command argument/script file).
>
> Same on Windows.  Try PowerShell some day.  Does it mean we need to
> document all of that in our documentation?

It would be nice, yes. Without details - just point that there is a
difference. Maybe in the "41.3 Creating a Synchronous Process" section
of the manual.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>