[Top][All Lists]

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

bug#33755: error: execlp: No such file or directory from guix environmen

From: Timothy Sample
Subject: bug#33755: error: execlp: No such file or directory from guix environment
Date: Sat, 15 Dec 2018 13:35:52 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Bah!  I goofed on the attachment.  Sorry for the trouble.  Here it is

>From e88baf0363607d4e072f5a29a2cd01ededfa00d2 Mon Sep 17 00:00:00 2001
From: Timothy Sample <address@hidden>
Date: Sat, 15 Dec 2018 12:57:52 -0500
Subject: [PATCH] environment: Print command name on execlp error.

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

* guix/scripts/environment.scm: When execlp raises ENOENT, print a
clear error message and exit with status 127 (like a shell would).
 guix/scripts/environment.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 5965e3426..27483acb2 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -389,7 +389,15 @@ 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
+         (if (= ENOENT (system-error-errno args))
+             (begin
+               (report-error (G_ "~a: command not found~%") program)
+               (exit 127))
+             (apply throw args)))))))
 (define* (launch-environment/fork command profile manifest #:key pure?)
   "Run COMMAND in a new process with an environment containing PROFILE, with

Timothy Sample <address@hidden> writes:

> Hi,
> Julien Lepiller <address@hidden> writes:
>> Hi, this is because we have a -- option. "guix environment guix --
>> ad-hoc libgit2" means you want to run "ad-hoc libgit2" in a guix
>> environment. The error message tells you that it can't find an ad-hoc
>> executable in that environment. There is no "ad-hoc" package involved
>> here…
> This is true, but I would argue that the error message is not quite as
> clear as you say.  Specifically, it does not mention “ad-hoc” at all.
> I’ve attached a patch that so that the command
>     $ guix environment guix -- ad-hoc
> prints
>     guix environment: error: ad-hoc: command not found
> and exits with status 127.  (In imitation of “bash -c 'ad-hoc'”.)
> Thoughts?
>> Le 15 décembre 2018 08:09:37 GMT+01:00, address@hidden a écrit :
>>>Is this a bug?
>>>address@hidden ~/src/guix$ guix environment guix -- ad-hoc libgit2
>>>guix environment: error: execlp: No such file or directory
>>>I meant to type: 
>>>address@hidden ~/src/guix$ guix environment guix --ad-hoc libgit2 texinfo
>>>I would have liked an error saying "error: package ad-hoc not found -
>>>cannot add it to the environment"
> -- Tim

reply via email to

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