GNU bug report logs - #39192
[PATCH] gnu: hexedit: Make F1 help more reliable

Previous Next

Package: guix-patches;

Reported by: Jakub Kądziołka <kuba <at> kadziolka.net>

Date: Sun, 19 Jan 2020 12:45:02 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <mbakke <at> fastmail.com>

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 39192 in the body.
You can then email your comments to 39192 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 guix-patches <at> gnu.org:
bug#39192; Package guix-patches. (Sun, 19 Jan 2020 12:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 19 Jan 2020 12:45:03 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: hexedit: Make F1 help more reliable
Date: Sun, 19 Jan 2020 13:44:34 +0100
* gnu/packages/hexedit.scm (hexedit)[arguments](patch-man-path): New
  phase.
  [inputs]: Add MAN-DB.
---
 gnu/packages/hexedit.scm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/hexedit.scm b/gnu/packages/hexedit.scm
index 39dcb2e0f7..e788c7f766 100644
--- a/gnu/packages/hexedit.scm
+++ b/gnu/packages/hexedit.scm
@@ -24,6 +24,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages man)
   #:use-module (gnu packages ncurses)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -43,12 +44,24 @@
                (base32
                 "1xsxa5mip892jkvz9jshj73y6c7j3mgp8y393ciihqlyf2nmfs67"))))
     (build-system gnu-build-system)
-    (arguments '(#:tests? #f))          ; no check target
+    (arguments
+     `(#:tests? #f                      ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         ;; Make F1 open the man page even if man-db is not in the profile
+         (add-after 'unpack 'patch-man-path
+           (lambda _
+             (substitute* "interact.c"
+               (("\"man\"")
+                (string-append "\"" (assoc-ref %build-inputs "man-db") "/bin/man\""))
+               (("\"hexedit\"")
+                (string-append "\"" (assoc-ref %outputs "out") "/share/man/man1/hexedit.1.gz\""))))))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)))
     (inputs
-     `(("ncurses" ,ncurses)))
+     `(("ncurses" ,ncurses)
+       ("man-db" ,man-db)))
     (synopsis "View and edit files or devices in hexadecimal or ASCII")
     (description "hexedit shows a file both in ASCII and in hexadecimal.  The
 file can be a device as the file is read a piece at a time.  You can modify
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39192; Package guix-patches. (Mon, 27 Jan 2020 23:37:02 GMT) Full text and rfc822 format available.

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

From: Marius Bakke <mbakke <at> fastmail.com>
To: Jakub Kądziołka <kuba <at> kadziolka.net>,
 39192 <at> debbugs.gnu.org
Subject: Re: [bug#39192] [PATCH] gnu: hexedit: Make F1 help more reliable
Date: Tue, 28 Jan 2020 00:36:04 +0100
[Message part 1 (text/plain, inline)]
Jakub Kądziołka <kuba <at> kadziolka.net> writes:

> * gnu/packages/hexedit.scm (hexedit)[arguments](patch-man-path): New
>   phase.
>   [inputs]: Add MAN-DB.

While this change is harmless, I think we can generally expect "man" to
be available.  Does the program crash if man-db is not installed?  Or
does it print an actionable error message?

In the latter case I'm inclined to leave things as-is, in the former
case let's patch it.  But no strong opinion, mostly curious :-)
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39192; Package guix-patches. (Tue, 28 Jan 2020 07:37:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 39192 <at> debbugs.gnu.org
Subject: Re: [bug#39192] [PATCH] gnu: hexedit: Make F1 help more reliable
Date: Tue, 28 Jan 2020 08:36:53 +0100
On Tue, Jan 28, 2020 at 12:36:04AM +0100, Marius Bakke wrote:
> Jakub Kądziołka <kuba <at> kadziolka.net> writes:
> 
> > * gnu/packages/hexedit.scm (hexedit)[arguments](patch-man-path): New
> >   phase.
> >   [inputs]: Add MAN-DB.
> 
> While this change is harmless, I think we can generally expect "man" to
> be available.  Does the program crash if man-db is not installed?  Or
> does it print an actionable error message?
> 
> In the latter case I'm inclined to leave things as-is, in the former
> case let's patch it.  But no strong opinion, mostly curious :-)

Currently, the problem appears when hexedit is used in a `guix
environment', and man-db is not specified as an input for the
environment. In this case (assuming --pure hasn't been used), man prints
an error message saying "no manpage for hexedit" when the user presses
F1, but it cannot be seen until one exits hexedit. For a new user, this
is not a trivial feat. Moreover, the error is confusing - it suggests
that the manpage just hasn't been packaged.

When man isn't found at all, no error message is printed, the F1 key
just makes the screen blink. This could happen in a --pure environment.

In hindsight, this is something I should've explained in my first message.
Sorry about that.




Reply sent to Marius Bakke <mbakke <at> fastmail.com>:
You have taken responsibility. (Wed, 29 Jan 2020 10:09:02 GMT) Full text and rfc822 format available.

Notification sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
bug acknowledged by developer. (Wed, 29 Jan 2020 10:09:02 GMT) Full text and rfc822 format available.

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

From: Marius Bakke <mbakke <at> fastmail.com>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: 39192-done <at> debbugs.gnu.org
Subject: Re: [bug#39192] [PATCH] gnu: hexedit: Make F1 help more reliable
Date: Wed, 29 Jan 2020 11:08:14 +0100
[Message part 1 (text/plain, inline)]
Jakub Kądziołka <kuba <at> kadziolka.net> writes:

> On Tue, Jan 28, 2020 at 12:36:04AM +0100, Marius Bakke wrote:
>> Jakub Kądziołka <kuba <at> kadziolka.net> writes:
>> 
>> > * gnu/packages/hexedit.scm (hexedit)[arguments](patch-man-path): New
>> >   phase.
>> >   [inputs]: Add MAN-DB.
>> 
>> While this change is harmless, I think we can generally expect "man" to
>> be available.  Does the program crash if man-db is not installed?  Or
>> does it print an actionable error message?
>> 
>> In the latter case I'm inclined to leave things as-is, in the former
>> case let's patch it.  But no strong opinion, mostly curious :-)
>
> Currently, the problem appears when hexedit is used in a `guix
> environment', and man-db is not specified as an input for the
> environment. In this case (assuming --pure hasn't been used), man prints
> an error message saying "no manpage for hexedit" when the user presses
> F1, but it cannot be seen until one exits hexedit. For a new user, this
> is not a trivial feat. Moreover, the error is confusing - it suggests
> that the manpage just hasn't been packaged.

Right.  The problem of manpages being unavailable unless man-db is
included in the profile is not unique to hexedit.  'git foo --help' has
the same problem in a --pure environment.  But at least then you get a
good error message.

> When man isn't found at all, no error message is printed, the F1 key
> just makes the screen blink. This could happen in a --pure environment.

I see, not great.  Sounds like a good reason to add man-db as an input
in this case.

> In hindsight, this is something I should've explained in my first message.
> Sorry about that.

No worries, these things are difficult.  :-)

Pushed in 602059e79, with a few cosmetic modifications:

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages/hexedit.scm b/gnu/packages/hexedit.scm
index 368a902ce3..e1a029167a 100644
--- a/gnu/packages/hexedit.scm
+++ b/gnu/packages/hexedit.scm
@@ -49,20 +49,22 @@
      `(#:tests? #f                      ; no check target
        #:phases
        (modify-phases %standard-phases
-         ;; Make F1 open the man page even if man-db is not in the profile
+         ;; Make F1 open the man page even if man-db is not in the profile.
          (add-after 'unpack 'patch-man-path
-           (lambda _
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              (substitute* "interact.c"
                (("\"man\"")
-                (string-append "\"" (assoc-ref %build-inputs "man-db") "/bin/man\""))
+                (string-append "\"" (assoc-ref inputs "man-db") "/bin/man\""))
                (("\"hexedit\"")
-                (string-append "\"" (assoc-ref %outputs "out") "/share/man/man1/hexedit.1.gz\""))))))))
+                (string-append "\"" (assoc-ref outputs "out")
+                               "/share/man/man1/hexedit.1.gz\"")))
+             #t)))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)))
     (inputs
-     `(("ncurses" ,ncurses)
-       ("man-db" ,man-db)))
+     `(("man-db" ,man-db)
+       ("ncurses" ,ncurses)))
     (synopsis "View and edit files or devices in hexadecimal or ASCII")
     (description "hexedit shows a file both in ASCII and in hexadecimal.  The
 file can be a device as the file is read a piece at a time.  You can modify
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 26 Feb 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 60 days ago.

Previous Next


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