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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33755 in the body.
You can then email your comments to 33755 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sat, 15 Dec 2018 07:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to swedebugia <at> riseup.net:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 15 Dec 2018 07:10:02 GMT) Full text and rfc822 format available.

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

From: swedebugia <at> riseup.net
To: bug-guix <at> gnu.org
Subject: error: execlp: No such file or directory from guix environment
Date: Fri, 14 Dec 2018 23:09:37 -0800
Hi

Is this a bug?

sdb <at> antelope ~/src/guix$ guix environment guix -- ad-hoc libgit2 texinfo
guix environment: error: execlp: No such file or directory

I meant to type: 
sdb <at> antelope ~/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"

-- 
Cheers 
Swedebugia




Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sat, 15 Dec 2018 09:41:02 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: swedebugia <at> riseup.net,33755 <at> debbugs.gnu.org
Subject: Re: bug#33755: error: execlp: No such file or directory from
 guix	environment
Date: Sat, 15 Dec 2018 10:40:48 +0100
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…

Le 15 décembre 2018 08:09:37 GMT+01:00, swedebugia <at> riseup.net a écrit :
>Hi
>
>Is this a bug?
>
>sdb <at> antelope ~/src/guix$ guix environment guix -- ad-hoc libgit2
>texinfo
>guix environment: error: execlp: No such file or directory
>
>I meant to type: 
>sdb <at> antelope ~/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"




Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sat, 15 Dec 2018 18:19:02 GMT) Full text and rfc822 format available.

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

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

Julien Lepiller <julien <at> lepiller.eu> 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, swedebugia <at> riseup.net a écrit :
>>Hi
>>
>>Is this a bug?
>>
>>sdb <at> antelope ~/src/guix$ guix environment guix -- ad-hoc libgit2
>>texinfo
>>guix environment: error: execlp: No such file or directory
>>
>>I meant to type: 
>>sdb <at> antelope ~/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

[/home/samplet/code/3rdparty/guix/0001-environment-Print-command-name-on-execlp-error.patch (message/external-body, inline)]

[Message part 3 (text/x-patch, inline)]


Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sat, 15 Dec 2018 18:37:01 GMT) Full text and rfc822 format available.

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

From: Timothy Sample <samplet <at> ngyro.com>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: swedebugia <at> riseup.net, 33755 <at> debbugs.gnu.org
Subject: Re: bug#33755: error: execlp: No such file or directory from
 guix	environment
Date: Sat, 15 Dec 2018 13:35:52 -0500
[Message part 1 (text/plain, inline)]
Bah!  I goofed on the attachment.  Sorry for the trouble.  Here it is
again.

[0001-environment-Print-command-name-on-execlp-error.patch (text/x-patch, inline)]
From e88baf0363607d4e072f5a29a2cd01ededfa00d2 Mon Sep 17 00:00:00 2001
From: Timothy Sample <samplet <at> ngyro.com>
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
-- 
2.20.0

[Message part 3 (text/plain, inline)]
Timothy Sample <samplet <at> ngyro.com> writes:

> Hi,
>
> Julien Lepiller <julien <at> lepiller.eu> 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, swedebugia <at> riseup.net a écrit :
>>>Hi
>>>
>>>Is this a bug?
>>>
>>>sdb <at> antelope ~/src/guix$ guix environment guix -- ad-hoc libgit2
>>>texinfo
>>>guix environment: error: execlp: No such file or directory
>>>
>>>I meant to type: 
>>>sdb <at> antelope ~/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

Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sat, 15 Dec 2018 19:39:02 GMT) Full text and rfc822 format available.

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

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Timothy Sample <samplet <at> ngyro.com>
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 20:38:53 +0100
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sun, 16 Dec 2018 04:27:01 GMT) Full text and rfc822 format available.

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


Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Sun, 16 Dec 2018 16:06:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Timothy Sample <samplet <at> ngyro.com>
Cc: swedebugia <at> riseup.net, Danny Milosavljevic <dannym <at> scratchpost.org>,
 33755 <at> debbugs.gnu.org
Subject: Re: bug#33755: error: execlp: No such file or directory from guix
 environment
Date: Sun, 16 Dec 2018 17:05:31 +0100
Hello comrades!

Timothy Sample <samplet <at> ngyro.com> skribis:

> 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.
[...]

> 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.

Another option would be to do:

  (set! execl
    (error-reporting-wrapper …))

in (guix ui), as done for a few other procedures that have the same
issue.

WDYT?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#33755; Package guix. (Mon, 17 Dec 2018 04:42:02 GMT) Full text and rfc822 format available.

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

From: Timothy Sample <samplet <at> ngyro.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: swedebugia <at> riseup.net, Danny Milosavljevic <dannym <at> scratchpost.org>,
 33755 <at> debbugs.gnu.org
Subject: Re: bug#33755: error: execlp: No such file or directory from guix
 environment
Date: Sun, 16 Dec 2018 23:41:38 -0500
[Message part 1 (text/plain, inline)]
Hi Ludo,

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

> Hello comrades!
>
> Timothy Sample <samplet <at> ngyro.com> skribis:
>
>> [...]
>>
>> 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.
>
> Another option would be to do:
>
>   (set! execl
>     (error-reporting-wrapper …))
>
> in (guix ui), as done for a few other procedures that have the same
> issue.
>
> WDYT?

Aha!  I didn’t know about “error-reporting-wrapper”.  I think this makes
sense.  It fixes the same issue in the container script, too.  I’ve
attached an updated patch.

I had to modify “error-reporting-wrapper” to deal with the fact that
“execlp” takes a variable number of arguments.  I tested it and it works
for the old use-case as well as the new.  On whether or not it works
stylistically, I defer to you.


-- Tim

[0001-ui-Report-file-names-in-system-error-exceptions-from.patch (text/x-patch, attachment)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 18 Dec 2018 09:06:02 GMT) Full text and rfc822 format available.

Notification sent to swedebugia <at> riseup.net:
bug acknowledged by developer. (Tue, 18 Dec 2018 09:06:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Timothy Sample <samplet <at> ngyro.com>
Cc: swedebugia <at> riseup.net, Danny Milosavljevic <dannym <at> scratchpost.org>,
 33755-done <at> debbugs.gnu.org
Subject: Re: bug#33755: error: execlp: No such file or directory from guix
 environment
Date: Tue, 18 Dec 2018 10:05:12 +0100
Hi Timothy,

Timothy Sample <samplet <at> ngyro.com> skribis:

> Aha!  I didn’t know about “error-reporting-wrapper”.  I think this makes
> sense.  It fixes the same issue in the container script, too.  I’ve
> attached an updated patch.
>
> I had to modify “error-reporting-wrapper” to deal with the fact that
> “execlp” takes a variable number of arguments.  I tested it and it works
> for the old use-case as well as the new.  On whether or not it works
> stylistically, I defer to you.

I like it.  :-)

> From 428b80973026909c915e1f33d4509e82f66355e3 Mon Sep 17 00:00:00 2001
> From: Timothy Sample <samplet <at> ngyro.com>
> Date: Sun, 16 Dec 2018 23:12:13 -0500
> Subject: [PATCH] ui: Report file names in 'system-error' exceptions from
>  'execlp'.
>
> Fixes <https://bugs.gnu.org/33755>.
>
> * guix/ui.scm (apply-formals): New macro.
> (execlp): New error-reporting wrapper.

Applied, thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 15 Jan 2019 12:24:06 GMT) Full text and rfc822 format available.

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.