coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using posix_spawn in coreutils?


From: Bernhard Voelker
Subject: Re: Using posix_spawn in coreutils?
Date: Wed, 22 Oct 2025 08:21:22 +0200
User-agent: Mozilla Thunderbird

On 10/22/25 05:51, Collin Funk wrote:
PƔdraig Brady <P@draigBrady.com> writes:

I notice that glibc's posix_spawn() reaps the child itself upon exec
error
(which I confirmed with `strace -ff`) but means we only get a single error
now from the following:
# Old behavior
     $ install src/install.c foo -s --strip-program=./foo
     install: cannot run './foo': Permission denied
     install: strip process terminated abnormally
# New behavior
     $ src/ginstall src/install.c foo -s --strip-program=./foo
     ginstall: cannot run './foo': Permission denied
That's fine though, and probably a slight improvement.

Yep, that is my preference as well. The second error message didn't seem
very helpful to me. Hopefully 'install' isn't running so long that you
forget you passed it '--strip-program=./foo'. :)

What about enhancing the diagnostic message?

diff --git a/src/install.c b/src/install.c
index 9cb13d429..40e901f24 100644
--- a/src/install.c
+++ b/src/install.c
@@ -518,7 +518,7 @@ strip (char const *name)

   bool ok = false;
   if (result != 0)
-    error (0, result, _("cannot run %s"), quoteaf (strip_program));
+    error (0, result, _("cannot run strip program %s"), quoteaf 
(strip_program));
   else
     {
       /* Wait for 'strip' to complete, and emit a warning message on failure  
*/


I'm not sure whether it's worth to add a condition to issue the previous message
with the default strip program:

diff --git a/src/install.c b/src/install.c
index 9cb13d429..40e901f24 100644
--- a/src/install.c
+++ b/src/install.c
@@ -518,7 +518,11 @@ strip (char const *name)

   bool ok = false;
   if (result != 0)
-    error (0, result, _("cannot run %s"), quoteaf (strip_program));
+    {
+      error (0, result, _("cannot run %s%s"),
+             streq (strip_program, "strip") ? "" : "strip program ",
+             quoteaf (strip_program));
+    }
   else
     {
       /* Wait for 'strip' to complete, and emit a warning message on failure  
*/

This yields:

  $ src/ginstall src/install.c foo -s   # with a non-working strip in PATH
  ginstall: cannot run 'strip': Exec format error

  $ src/ginstall src/install.c foo -s --strip-program=./README
  ginstall: cannot run strip program './README': Permission denied


Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]