unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: swedebugia@riseup.net, 33755@debbugs.gnu.org
Subject: bug#33755: error: execlp: No such file or directory from guix environment
Date: Sun, 16 Dec 2018 23:41:38 -0500	[thread overview]
Message-ID: <875zvszrwd.fsf@ngyro.com> (raw)
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")

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

Hi Ludo,

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

> Hello comrades!
>
> Timothy Sample <samplet@ngyro.com> skribis:
>
>> [...]
>>
>> 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.
>
> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ui-Report-file-names-in-system-error-exceptions-from.patch --]
[-- Type: text/x-patch, Size: 1693 bytes --]

From 428b80973026909c915e1f33d4509e82f66355e3 Mon Sep 17 00:00:00 2001
From: Timothy Sample <samplet@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.
---
 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: <http://www.gnu.org/gethelp/>"))
            (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


  reply	other threads:[~2018-12-17  4:50 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
2018-12-16 16:05           ` Ludovic Courtès
2018-12-17  4:41             ` Timothy Sample [this message]
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=875zvszrwd.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=33755@debbugs.gnu.org \
    --cc=ludo@gnu.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).