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: Sun, 16 Dec 2018 23:41:38 -0500 Message-ID: <875zvszrwd.fsf@ngyro.com> References: <6d6639a0587b793ec342c7d1de36e7c3@riseup.net> <87h8femz5z.fsf@ngyro.com> <875zvumyd3.fsf@ngyro.com> <20181215203853.1b267a72@scratchpost.org> <87efaiyu5c.fsf@ngyro.com> <8736qxtq2c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYkr1-0006CA-PW for bug-guix@gnu.org; Sun, 16 Dec 2018 23:50:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYkjC-00077x-GT for bug-guix@gnu.org; Sun, 16 Dec 2018 23:42:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:46503) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gYkjC-00077g-AR for bug-guix@gnu.org; Sun, 16 Dec 2018 23:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gYkjC-0004tQ-7t for bug-guix@gnu.org; Sun, 16 Dec 2018 23:42:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <8736qxtq2c.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 16 Dec 2018 17:05:31 +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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: swedebugia@riseup.net, 33755@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, Ludovic Court=C3=A8s writes: > Hello comrades! > > Timothy Sample skribis: > >> [...] >> >> 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. > > Another option would be to do: > > (set! execl > (error-reporting-wrapper =E2=80=A6)) > > in (guix ui), as done for a few other procedures that have the same > issue. > > WDYT? Aha! I didn=E2=80=99t know about =E2=80=9Cerror-reporting-wrapper=E2=80=9D= . I think this makes sense. It fixes the same issue in the container script, too. I=E2=80=99ve attached an updated patch. I had to modify =E2=80=9Cerror-reporting-wrapper=E2=80=9D to deal with the = fact that =E2=80=9Cexeclp=E2=80=9D 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ui-Report-file-names-in-system-error-exceptions-from.patch >From 428b80973026909c915e1f33d4509e82f66355e3 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Sun, 16 Dec 2018 23:12:13 -0500 Subject: [PATCH] ui: Report file names in 'system-error' exceptions from 'execlp'. Fixes . * guix/ui.scm (apply-formals): New macro. (execlp): New error-reporting wrapper. --- guix/ui.scm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index 60636edac..148c18103 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -502,14 +502,19 @@ General help using GNU software: ")) (list (strerror (car errno)) file) (list errno)))) -(define-syntax-rule (error-reporting-wrapper proc (args ...) file) +(define-syntax apply-formals + (syntax-rules () + ((_ proc (args ...)) (proc args ...)) + ((_ proc (arg1 args ... . rest)) (apply proc arg1 args ... rest)))) + +(define-syntax-rule (error-reporting-wrapper proc formals file) "Wrap PROC such that its 'system-error' exceptions are augmented to mention FILE." (let ((real-proc (@ (guile) proc))) - (lambda (args ...) + (lambda formals (catch 'system-error (lambda () - (real-proc args ...)) + (apply-formals real-proc formals)) (augmented-system-error-handler file))))) (set! symlink @@ -528,6 +533,8 @@ FILE." (set! delete-file (error-reporting-wrapper delete-file (file) file)) +(set! execlp + (error-reporting-wrapper execlp (filename . args) filename)) (define (make-regexp* regexp . flags) "Like 'make-regexp' but error out if REGEXP is invalid, reporting the error -- 2.20.0 --=-=-=--