unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 53358@debbugs.gnu.org
Subject: bug#53358: 29.0.50; Compilation output messed up again
Date: Wed, 19 Jan 2022 15:32:50 -0800	[thread overview]
Message-ID: <46443e67-1a43-cfa6-35c1-8284af383389@cs.ucla.edu> (raw)
In-Reply-To: <877dawdr1o.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On 1/19/22 01:16, Lars Ingebrigtsen wrote:

> echo was presumably changed to info
> for a reason

Yes, it avoids a fork-and-exec and this simplifies strace-style 
debugging of make+sh invocations that go awry.

I am not seeing the problem on my platform (Ubuntu 21.10, Xeon E3-1225 
v2); what platform are you using?

How are you viewing the 'make' output? Are you using M-x compile under 
Emacs, or something else?

Does the problem go away if you use 'make -Oline'?

Does the problem go away if you apply the attached patch to the GNU Make 
source code?

[-- Attachment #2: 0001-Fix-interleaved-info-output.patch --]
[-- Type: text/x-patch, Size: 1600 bytes --]

From d1d2269fbafde7c1b0115dd5c85d82ac4b58677d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 19 Jan 2022 15:20:40 -0800
Subject: [PATCH] Fix interleaved $(info) output
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/function.c (func_error): On POSIX-compatible platforms,
cause $(info xxx) output to a pipe to be atomic when xxx is small,
the same way that $(warning xxx) and $(error xxx) is.  Problem
reported by Lars Ingebrigtsen <https://bugs.gnu.org/r/53358>.
Also, shrink allocation by 1 byte (the byte isn’t ever used)
and avoid an unnecessary initialization of msg[0].
---
 src/function.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/function.c b/src/function.c
index c107a387..05c77c32 100644
--- a/src/function.c
+++ b/src/function.c
@@ -1180,17 +1180,16 @@ func_error (char *o, char **argv, const char *funcname)
   for (len=0, argvp=argv; *argvp != 0; ++argvp)
     len += strlen (*argvp) + 2;
 
-  p = msg = alloca (len + 1);
-  msg[0] = '\0';
+  p = msg = alloca (len);
 
-  for (argvp=argv; argvp[1] != 0; ++argvp)
+  for (argvp=argv; *argvp != 0; ++argvp)
     {
       strcpy (p, *argvp);
       p += strlen (*argvp);
       *(p++) = ',';
       *(p++) = ' ';
     }
-  strcpy (p, *argvp);
+  p[-2] = '\0';
 
   switch (*funcname)
     {
@@ -1202,8 +1201,8 @@ func_error (char *o, char **argv, const char *funcname)
       break;
 
     case 'i':
+      strcpy (p - 2, "\n");
       outputs (0, msg);
-      outputs (0, "\n");
       break;
 
     default:
-- 
2.32.0


  reply	other threads:[~2022-01-19 23:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  8:20 bug#53358: 29.0.50; Compilation output messed up again Lars Ingebrigtsen
2022-01-19  8:36 ` Lars Ingebrigtsen
2022-01-19  9:07 ` Eli Zaretskii
2022-01-19  9:16   ` Lars Ingebrigtsen
2022-01-19 23:32     ` Paul Eggert [this message]
2022-01-19 23:53       ` Paul Eggert
2022-01-20  8:10         ` Lars Ingebrigtsen
2022-01-20 18:21           ` Paul Eggert
2022-01-21  9:24             ` Lars Ingebrigtsen
2022-01-21 22:52               ` Paul Eggert
2022-01-22 10:16                 ` Lars Ingebrigtsen
2022-01-24  7:25                   ` Paul Eggert
2022-01-24  9:47                     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46443e67-1a43-cfa6-35c1-8284af383389@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=53358@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).