GNU bug report logs - #34884
guix describe fails with --format=json and --format=recutils

Previous Next

Package: guix;

Reported by: Pierre Neidhardt <mail <at> ambrevar.xyz>

Date: Sat, 16 Mar 2019 10:14:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34884 in the body.
You can then email your comments to 34884 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#34884; Package guix. (Sat, 16 Mar 2019 10:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pierre Neidhardt <mail <at> ambrevar.xyz>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 16 Mar 2019 10:14:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: bug-guix <at> gnu.org
Subject: guix describe fails with --format=json and --format=recutils
Date: Sat, 16 Mar 2019 11:12:52 +0100
[Message part 1 (text/plain, inline)]
--8<---------------cut here---------------start------------->8---
> guix describe --format=json
[{"name":"guix","url":"https://git.savannah.gnu.org/git/guix.git","commit":"77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4"}]
Backtrace:
           4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix")
In guix/ui.scm:
  1654:12  3 (run-guix-command _ . _)
In ice-9/boot-9.scm:
    829:9  2 (catch srfi-34 #<procedure 2ff58a0 at guix/ui.scm:624:2 ()> #<procedure 7f711b6c39b8 at guix/ui.scm:624:2 (key c)> _)
    829:9  1 (catch system-error #<procedure 2ff5940 at guix/scripts/describe.scm:203:4 ()> #<procedure 7f711b6c39d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _)
In guix/scripts/describe.scm:
     83:5  0 (display-package-search-path json)

guix/scripts/describe.scm:83:5: In procedure display-package-search-path:
Throw to key `match-error' with args `("match" "no matching pattern" json)'.
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
> guix describe -f recutils
name: guix
url: https://git.savannah.gnu.org/git/guix.git
commit: 77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4

Backtrace:
           4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix")
In guix/ui.scm:
  1654:12  3 (run-guix-command _ . _)
In ice-9/boot-9.scm:
    829:9  2 (catch srfi-34 #<procedure 2ac1d20 at guix/ui.scm:624:2 ()> #<procedure 7fa6695719b8 at guix/ui.scm:624:2 (key c)> _)
    829:9  1 (catch system-error #<procedure 2ac1dc0 at guix/scripts/describe.scm:203:4 ()> #<procedure 7fa6695719d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _)
In guix/scripts/describe.scm:
     83:5  0 (display-package-search-path recutils)

guix/scripts/describe.scm:83:5: In procedure display-package-search-path:
Throw to key `match-error' with args `("match" "no matching pattern" recutils)'.
--8<---------------cut here---------------end--------------->8---

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#34884; Package guix. (Sat, 16 Mar 2019 14:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 34884 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 34884 <at> debbugs.gnu.org
Subject: Re: bug#34884: guix describe fails with --format=json and
 --format=recutils
Date: Sat, 16 Mar 2019 17:11:22 +0300
[Message part 1 (text/plain, inline)]
Hello Pierre,

Good catch!  I prepared a patch in the attachement bellow to fix this.

Also the patch changes behavior of '--format=channels' for
'GUIX_PACKAGE_PATH' warning.  It will print to STDERR instead of STDOUT.

Pierre Neidhardt <mail <at> ambrevar.xyz> writes:

>> guix describe --format=json
> [{"name":"guix","url":"https://git.savannah.gnu.org/git/guix.git","commit":"77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4"}]
> Backtrace:
>            4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix")
> In guix/ui.scm:
>   1654:12  3 (run-guix-command _ . _)
> In ice-9/boot-9.scm:
>     829:9  2 (catch srfi-34 #<procedure 2ff58a0 at guix/ui.scm:624:2 ()> #<procedure 7f711b6c39b8 at guix/ui.scm:624:2 (key c)> _)
>     829:9  1 (catch system-error #<procedure 2ff5940 at guix/scripts/describe.scm:203:4 ()> #<procedure 7f711b6c39d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _)
> In guix/scripts/describe.scm:
>      83:5  0 (display-package-search-path json)
>
> guix/scripts/describe.scm:83:5: In procedure display-package-search-path:
> Throw to key `match-error' with args `("match" "no matching pattern" json)'.

JSON format:
--8<---------------cut here---------------start------------->8---
oleg <at> guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=json
[{"name":"guix","url":"https://gitlab.wugi.info/guix/guix.git","commit":"4161deb4549c39b7d4801cc8aa63c365d19fc649"},{"name":"guix-wigust","url":"https://gitlab.wugi.info/guix/guix-wigust.git","commit":"f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0"}]
{"name":"GUIX_PACKAGE_PATH","paths":["/home/oleg/src/guix-wigust","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist"]}
--8<---------------cut here---------------end--------------->8---

>> guix describe -f recutils
> name: guix
> url: https://git.savannah.gnu.org/git/guix.git
> commit: 77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4
>
> Backtrace:
>            4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix")
> In guix/ui.scm:
>   1654:12  3 (run-guix-command _ . _)
> In ice-9/boot-9.scm:
>     829:9  2 (catch srfi-34 #<procedure 2ac1d20 at guix/ui.scm:624:2 ()> #<procedure 7fa6695719b8 at guix/ui.scm:624:2 (key c)> _)
>     829:9  1 (catch system-error #<procedure 2ac1dc0 at guix/scripts/describe.scm:203:4 ()> #<procedure 7fa6695719d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _)
> In guix/scripts/describe.scm:
>      83:5  0 (display-package-search-path recutils)
>
> guix/scripts/describe.scm:83:5: In procedure display-package-search-path:
> Throw to key `match-error' with args `("match" "no matching pattern" recutils)'.

recutils format:
--8<---------------cut here---------------start------------->8---
oleg <at> guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=recutils
name: guix
url: https://gitlab.wugi.info/guix/guix.git
commit: 4161deb4549c39b7d4801cc8aa63c365d19fc649

name: guix-wigust
url: https://gitlab.wugi.info/guix/guix-wigust.git
commit: f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0

name: GUIX_PACKAGE_PATH
paths: /home/oleg/src/guix-wigust /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist
+ /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist
+ /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist

--8<---------------cut here---------------end--------------->8---

[0001-describe-Handle-JSON-and-recutils-formats-for-GUIX_P.patch (text/x-patch, inline)]
From 4f911d60f96f088876e6bcbed1883cff637507c2 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust <at> gmail.com>
Date: Sat, 16 Mar 2019 16:56:34 +0300
Subject: [PATCH] describe: Handle JSON and recutils formats for
 'GUIX_PACKAGE_PATH'.

Fixes <https://bugs.gnu.org/34884>.
Reported by Pierre Neidhardt <mail <at> ambrevar.xyz>.

* guix/scripts/describe.scm (display-package-search-path): Handle JSON and
recutils formats.
---
 guix/scripts/describe.scm | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index 7d0ecb0a4d..fbc142426e 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Ludovic Courtès <ludo <at> gnu.org>
-;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2018, 2019 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -77,6 +77,16 @@ Display information about the channels currently in use.\n"))
 
 (define (display-package-search-path fmt)
   "Display GUIX_PACKAGE_PATH, if it is set, according to FMT."
+  (define* (paths->recutils paths #:optional (width (%text-width)))
+    (define width*
+      ;; The available number of columns once we've taken into account space
+      ;; for the initial "+ " prefix.
+      (if (> width 2) (- width 2) %text-width))
+
+    (string->recutils
+     (fill-paragraph (string-join (string-split paths #\:)) width*
+                     (string-length "dependencies: "))))
+
   (match (getenv "GUIX_PACKAGE_PATH")
     (#f #t)
     (string
@@ -84,8 +94,18 @@ Display information about the channels currently in use.\n"))
        ('human
         (format #t "~%GUIX_PACKAGE_PATH=\"~a\"~%" string))
        ('channels
-        (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%")
-                string))))))
+        (format (current-warning-port)
+                (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%") string))
+       ('json
+        (format (current-warning-port)
+                (scm->json-string
+                 `((name . "GUIX_PACKAGE_PATH")
+                   (paths . ,(string-split string #\:))))))
+       ('recutils
+        (format (current-warning-port)
+                "name: GUIX_PACKAGE_PATH")
+        (format (current-warning-port)
+                "~%paths: ~a~%~%" (paths->recutils string)))))))
 
 (define (channel->sexp channel)
   `(channel
-- 
2.21.0

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#34884; Package guix. (Sun, 17 Mar 2019 15:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 34884 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: Pierre Neidhardt <mail <at> ambrevar.xyz>, 34884 <at> debbugs.gnu.org
Subject: Re: bug#34884: guix describe fails with --format=json and
 --format=recutils
Date: Sun, 17 Mar 2019 16:40:27 +0100
[Message part 1 (text/plain, inline)]
Hi Oleg,

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> JSON format:
>
> oleg <at> guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=json
> [{"name":"guix","url":"https://gitlab.wugi.info/guix/guix.git","commit":"4161deb4549c39b7d4801cc8aa63c365d19fc649"},{"name":"guix-wigust","url":"https://gitlab.wugi.info/guix/guix-wigust.git","commit":"f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0"}]
> {"name":"GUIX_PACKAGE_PATH","paths":["/home/oleg/src/guix-wigust","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist"]}

Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set
and not captured in the output of ‘guix describe’, because fundamentally
it cannot be captured reliably.

Thus, what about something as attached instead?

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index 7d0ecb0a4d..b6287d3a4c 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2018, 2019 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -85,7 +85,9 @@ Display information about the channels currently in use.\n"))
         (format #t "~%GUIX_PACKAGE_PATH=\"~a\"~%" string))
        ('channels
         (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%")
-                string))))))
+                string))
+       (_
+        (warning (G_ "'GUIX_PACKAGE_PATH' is set but it is not captured~%")))))))
 
 (define (channel->sexp channel)
   `(channel


Information forwarded to bug-guix <at> gnu.org:
bug#34884; Package guix. (Sun, 17 Mar 2019 17:41:02 GMT) Full text and rfc822 format available.

Message #14 received at 34884 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Pierre Neidhardt <mail <at> ambrevar.xyz>, 34884 <at> debbugs.gnu.org
Subject: Re: bug#34884: guix describe fails with --format=json and
 --format=recutils
Date: Sun, 17 Mar 2019 20:40:21 +0300
[Message part 1 (text/plain, inline)]
Hi Ludovic,

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

[…]

> Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set
> and not captured in the output of ‘guix describe’, because fundamentally
> it cannot be captured reliably.
>
> Thus, what about something as attached instead?

OK, no problem for me. ;-) Thanks for explanation.

[…]

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#34884; Package guix. (Mon, 18 Mar 2019 08:46:02 GMT) Full text and rfc822 format available.

Message #17 received at 34884 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>, Pierre Neidhardt <mail <at> ambrevar.xyz>,
 34884 <at> debbugs.gnu.org
Subject: Re: bug#34884: guix describe fails with --format=json and
 --format=recutils
Date: Mon, 18 Mar 2019 09:45:04 +0100
Hi,

> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> JSON format:
>>
>> oleg <at> guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=json
>> [{"name":"guix","url":"https://gitlab.wugi.info/guix/guix.git","commit":"4161deb4549c39b7d4801cc8aa63c365d19fc649"},{"name":"guix-wigust","url":"https://gitlab.wugi.info/guix/guix-wigust.git","commit":"f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0"}]
>> {"name":"GUIX_PACKAGE_PATH","paths":["/home/oleg/src/guix-wigust","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist"]}
>
> Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set
> and not captured in the output of ‘guix describe’, because fundamentally
> it cannot be captured reliably.
>
> Thus, what about something as attached instead?
>
> Thanks,
> Ludo’.
>
> diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
> index 7d0ecb0a4d..b6287d3a4c 100644
> --- a/guix/scripts/describe.scm
> +++ b/guix/scripts/describe.scm
> @@ -1,5 +1,5 @@
>  ;;; GNU Guix --- Functional package management for GNU
> -;;; Copyright © 2018 Ludovic Courtès <ludo <at> gnu.org>
> +;;; Copyright © 2018, 2019 Ludovic Courtès <ludo <at> gnu.org>
>  ;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
> @@ -85,7 +85,9 @@ Display information about the channels currently in use.\n"))
>          (format #t "~%GUIX_PACKAGE_PATH=\"~a\"~%" string))
>         ('channels
>          (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%")
> -                string))))))
> +                string))
> +       (_
> +        (warning (G_ "'GUIX_PACKAGE_PATH' is set but it is not captured~%")))))))
>  
>  (define (channel->sexp channel)
>    `(channel

This looks good to me!

-- 
Ricardo





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 18 Mar 2019 08:53:01 GMT) Full text and rfc822 format available.

Notification sent to Pierre Neidhardt <mail <at> ambrevar.xyz>:
bug acknowledged by developer. (Mon, 18 Mar 2019 08:53:02 GMT) Full text and rfc822 format available.

Message #22 received at 34884-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: Pierre Neidhardt <mail <at> ambrevar.xyz>, 34884-done <at> debbugs.gnu.org
Subject: Re: bug#34884: guix describe fails with --format=json and
 --format=recutils
Date: Mon, 18 Mar 2019 09:52:31 +0100
Hi Oleg,

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
> […]
>
>> Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set
>> and not captured in the output of ‘guix describe’, because fundamentally
>> it cannot be captured reliably.
>>
>> Thus, what about something as attached instead?
>
> OK, no problem for me. ;-) Thanks for explanation.

Cool, thank you.  I’ll push shortly.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Apr 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.