unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: Danny Milosavljevic <dannym@scratchpost.org>
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 23:26:07 -0500	[thread overview]
Message-ID: <87efaiyu5c.fsf@ngyro.com> (raw)
In-Reply-To: <20181215203853.1b267a72@scratchpost.org> (Danny Milosavljevic's message of "Sat, 15 Dec 2018 20:38:53 +0100")

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

Hi Danny,

Danny Milosavljevic <dannym@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


[-- 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: 1256 bytes --]

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


  reply	other threads:[~2018-12-16  4:27 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
2018-12-15 19:38       ` Danny Milosavljevic
2018-12-16  4:26         ` Timothy Sample [this message]
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=87efaiyu5c.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=33755@debbugs.gnu.org \
    --cc=dannym@scratchpost.org \
    --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).