GNU bug report logs - #33755
error: execlp: No such file or directory from guix environment

Previous Next

Package: guix;

Reported by: swedebugia <at> riseup.net

Date: Sat, 15 Dec 2018 07:10:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 33755 <at> debbugs.gnu.org (full text, mbox):

From: Timothy Sample <samplet <at> ngyro.com>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: swedebugia <at> riseup.net, 33755 <at> debbugs.gnu.org,
 Julien Lepiller <julien <at> lepiller.eu>
Subject: Re: bug#33755: error: execlp: No such file or directory from guix
 environment
Date: Sat, 15 Dec 2018 23:26:07 -0500
[Message part 1 (text/plain, inline)]
Hi Danny,

Danny Milosavljevic <dannym <at> scratchpost.org> writes:

> Hi Tim,
>
> I like it in princple, but why special-case ENOENT?  I think it would
> be better to just always print the program name (and maybe program
> args, too!) and the system error message.

You are right.  I got fixated on the fact that it was failing the $PATH
search, and forgot about the more general cases.  I think printing the
program name and the system error message is the right choice.
According to the manual for “execve”, the arguments only cause an error
if they exceed ARG_MAX, in which case we probably don’t want to print
them anyway.

Here’s an updated patch.  I also got rid of the 127 status code, since
doesn’t make sense for the more general cases.

Thanks for the help!


-- Tim

[0001-environment-Print-command-name-on-execlp-error.patch (text/x-patch, inline)]
From aedc745a3f9765ae00dc61a59fa53d22a458551b Mon Sep 17 00:00:00 2001
From: Timothy Sample <samplet <at> ngyro.com>
Date: Sat, 15 Dec 2018 23:17:46 -0500
Subject: [PATCH] environment: Print command name on execlp error.

Fixes <https://bugs.gnu.org/33755>.

* guix/scripts/environment.scm (launch-environment): When execlp fails,
include the command name in the error message.
---
 guix/scripts/environment.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 5965e3426..64035a740 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -389,7 +389,12 @@ variables are cleared before setting the new ones."
   (create-environment profile manifest #:pure? pure?)
   (match command
     ((program . args)
-     (apply execlp program program args))))
+     (catch 'system-error
+       (lambda ()
+         (apply execlp program program args))
+       (lambda args
+         (let ((errno (system-error-errno args)))
+           (leave (G_ "~a: ~a~%") program (strerror errno))))))))
 
 (define* (launch-environment/fork command profile manifest #:key pure?)
   "Run COMMAND in a new process with an environment containing PROFILE, with
-- 
2.20.0


This bug report was last modified 6 years and 240 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.