unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: Julien Lepiller <julien@lepiller.eu>
Cc: swedebugia@riseup.net, 33755@debbugs.gnu.org
Subject: bug#33755: error: execlp: No such file or directory from guix	environment
Date: Sat, 15 Dec 2018 13:35:52 -0500	[thread overview]
Message-ID: <875zvumyd3.fsf@ngyro.com> (raw)
In-Reply-To: <87h8femz5z.fsf@ngyro.com> (Timothy Sample's message of "Sat, 15 Dec 2018 13:18:32 -0500")

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

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-environment-Print-command-name-on-execlp-error.patch --]
[-- Type: text/x-patch, Size: 1366 bytes --]

From e88baf0363607d4e072f5a29a2cd01ededfa00d2 Mon Sep 17 00:00:00 2001
From: Timothy Sample <samplet@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


[-- Attachment #3: Type: text/plain, Size: 1322 bytes --]


Timothy Sample <samplet@ngyro.com> writes:

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

  reply	other threads:[~2018-12-15 18:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15  7:09 bug#33755: error: execlp: No such file or directory from guix environment swedebugia
2018-12-15  9:40 ` Julien Lepiller
2018-12-15 18:18   ` Timothy Sample
2018-12-15 18:35     ` Timothy Sample [this message]
2018-12-15 19:38       ` Danny Milosavljevic
2018-12-16  4:26         ` Timothy Sample
2018-12-16 16:05           ` Ludovic Courtès
2018-12-17  4:41             ` Timothy Sample
2018-12-18  9:05               ` Ludovic Courtès

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=875zvumyd3.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=33755@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    --cc=swedebugia@riseup.net \
    /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/guix.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).