From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH 3/3] Inherit process output coding system to stderr process. Date: Sun, 08 Apr 2018 16:18:10 +0300 Message-ID: <83k1thzvjh.fsf@gnu.org> References: <20180404120218.257212-1-phst@google.com> <20180404120218.257212-3-phst@google.com> <83370b3xas.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1523193428 26350 195.159.176.226 (8 Apr 2018 13:17:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Apr 2018 13:17:08 +0000 (UTC) Cc: phst@google.com, emacs-devel@gnu.org To: Philipp Stephani Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 08 15:17:03 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f5ABq-0006kV-SQ for ged-emacs-devel@m.gmane.org; Sun, 08 Apr 2018 15:17:02 +0200 Original-Received: from localhost ([::1]:54391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5ADw-0008TG-Ll for ged-emacs-devel@m.gmane.org; Sun, 08 Apr 2018 09:19:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5AD1-0008Rk-Uf for emacs-devel@gnu.org; Sun, 08 Apr 2018 09:18:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5AD0-0003cK-IS for emacs-devel@gnu.org; Sun, 08 Apr 2018 09:18:15 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5ACw-0003SL-6y; Sun, 08 Apr 2018 09:18:10 -0400 Original-Received: from [176.228.60.248] (port=3130 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f5ACu-0004Mw-6Q; Sun, 08 Apr 2018 09:18:09 -0400 In-reply-to: (message from Philipp Stephani on Sat, 07 Apr 2018 21:12:10 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:224429 Archived-At: > From: Philipp Stephani > Date: Sat, 07 Apr 2018 21:12:10 +0000 > Cc: emacs-devel@gnu.org, phst@google.com > > > * src/process.c (Fmake_process): Inherit output coding system to > > newly-created pipe process. > > I'm sorry, I don't understand the need for this "inheriting". If the > problem is that make-process and make-pipe-process use different logic > to decide on the default coding-systems, then I think we should make > them use the same logic, and then there will be no need for > "inheriting". Or is there something else I'm missing? > > At least I would expect Emacs to use the same output encoding for both standard output and error streams if > an explicit output encoding is provided, given that most external programs will also use the same encoding for > both streams. But currently Emacs uses the default encoding for the standard error stream if it creates the > pipe itself. But that's easy to fix: just pass the same :coding argument with which make-process was invoked to Fmake_pipe_process. (And make the code which determines the encoding in both functions be identical while at that.) > > + (let ((process (make-process > > + :name "stderr-coding" > > + :command (list shell-file-name shell-command-switch > > + (concat "echo -e '\\xC3\\xA4\\r'; " > > + "echo -e '\\xC3\\xB6\\r' >&2")) > > This shell command is non-portable. I think even "echo -e" is not > portable enough, let alone with hex escapes and the trailing \r. > Can't we use Emacs instead? There's also the ";" issue again. > > Is it possible to write raw bytes to the standard output/error streams using Emacs? Yes, use raw-text or no-conversion as the encoding (the former allows to produce DOS and Mac EOLs, the latter doesn't). > > + (should (equal (buffer-string) "\u00C3\u00B6\n")))) > > + (should (equal (buffer-string) "\u00C3\u00A4\n"))))) > > Why not use literal characters here? It will make the source more > readable, IMO. > > I don't care much, but using the character escapes here makes it obvious that the output is decoded as > Latin-1. On the contrary, it might miss that if the output is decoded as raw bytes. Using the actual characters, OTOH, will make sure that, I think.