From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timothy Sample Subject: bug#33755: error: execlp: No such file or directory from guix environment Date: Sat, 15 Dec 2018 23:26:07 -0500 Message-ID: <87efaiyu5c.fsf@ngyro.com> References: <6d6639a0587b793ec342c7d1de36e7c3@riseup.net> <87h8femz5z.fsf@ngyro.com> <875zvumyd3.fsf@ngyro.com> <20181215203853.1b267a72@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYO1B-0004Ik-MQ for bug-guix@gnu.org; Sat, 15 Dec 2018 23:27:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYO18-0003az-HT for bug-guix@gnu.org; Sat, 15 Dec 2018 23:27:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:45569) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gYO18-0003aW-89 for bug-guix@gnu.org; Sat, 15 Dec 2018 23:27:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gYO17-0003kf-UF for bug-guix@gnu.org; Sat, 15 Dec 2018 23:27:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20181215203853.1b267a72@scratchpost.org> (Danny Milosavljevic's message of "Sat, 15 Dec 2018 20:38:53 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Danny Milosavljevic Cc: swedebugia@riseup.net, 33755@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Danny, Danny Milosavljevic 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 =E2=80=9Cexecve=E2=80=9D, the arguments only ca= use an error if they exceed ARG_MAX, in which case we probably don=E2=80=99t want to pri= nt them anyway. Here=E2=80=99s an updated patch. I also got rid of the 127 status code, si= nce doesn=E2=80=99t make sense for the more general cases. Thanks for the help! -- Tim --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-environment-Print-command-name-on-execlp-error.patch >From aedc745a3f9765ae00dc61a59fa53d22a458551b Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Sat, 15 Dec 2018 23:17:46 -0500 Subject: [PATCH] environment: Print command name on execlp error. Fixes . * 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 --=-=-=--