From 1913f318665cdb2633f160c6840f17b2c422d450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sat, 2 Nov 2024 10:13:33 -0300 Subject: [PATCH] pinfo: fix showing of man pages To show a man page (e.g. when there is no info file) this program uses `man -w -W ` but option `-W` is unsupported by our `man(1)`. This results in: $ pinfo man man: BADARG: bad command line argument: -W man Error executing command 'man -w -W man' and the terminal is left in a broken state. Fix by applying this PR: https://github.com/baszoetekouw/pinfo/pull/36 --- srcpkgs/pinfo/patches/36.patch | 57 ++++++++++++++++++++++++++++++++++ srcpkgs/pinfo/template | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/pinfo/patches/36.patch diff --git a/srcpkgs/pinfo/patches/36.patch b/srcpkgs/pinfo/patches/36.patch new file mode 100644 index 00000000000..946aff15be3 --- /dev/null +++ b/srcpkgs/pinfo/patches/36.patch @@ -0,0 +1,57 @@ +From 032dbfc4bf9ff45719de64d251244ab1307db17c Mon Sep 17 00:00:00 2001 +From: "David H. Bronke" +Date: Sun, 9 Jun 2024 12:12:05 +0200 +Subject: [PATCH 1/2] Fall back to running man without -W since some + implementations don't allow that + +Fixes #12. + +Change courtesy of loreb: https://github.com/baszoetekouw/pinfo/issues/12#issuecomment-884322986 +--- + src/manual.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/manual.c b/src/manual.c +index 5f058ff..791df32 100644 +--- a/src/manual.c ++++ b/src/manual.c +@@ -186,8 +186,14 @@ set_initial_history(char *name) + pathFile = popen(buf, "r"); + if (fgets(buf, sizeof(buf), pathFile)==NULL) + { +- fprintf(stderr, "Error executing command '%s'\n", buf); +- exit(1); ++ /* Try without -W */ ++ snprintf(buf, sizeof(buf), "man -w %s %s", ManOptions, name); ++ pathFile = popen(buf, "r"); ++ if (fgets(buf, sizeof(buf), pathFile)==NULL) ++ { ++ fprintf(stderr, "Error executing command '%s'\n", buf); ++ exit(1); ++ } + } + pclose(pathFile); + /* buf will be of the form "/usr/share/man/man1/sleep.1.gz". We + +From c3722aa478420b6671ed932503e06886e04d4287 Mon Sep 17 00:00:00 2001 +From: "David H. Bronke" +Date: Sat, 29 Jun 2024 14:55:46 +0200 +Subject: [PATCH 2/2] fix(src/manual.c): close pathFile before reopening + +Suggested by @xaizek +--- + src/manual.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/manual.c b/src/manual.c +index 791df32..bb730ee 100644 +--- a/src/manual.c ++++ b/src/manual.c +@@ -186,6 +186,7 @@ set_initial_history(char *name) + pathFile = popen(buf, "r"); + if (fgets(buf, sizeof(buf), pathFile)==NULL) + { ++ pclose(pathFile); + /* Try without -W */ + snprintf(buf, sizeof(buf), "man -w %s %s", ManOptions, name); + pathFile = popen(buf, "r"); diff --git a/srcpkgs/pinfo/template b/srcpkgs/pinfo/template index 7f6cd17f900..fa4fb001f8c 100644 --- a/srcpkgs/pinfo/template +++ b/srcpkgs/pinfo/template @@ -1,7 +1,7 @@ # Template file for 'pinfo' pkgname=pinfo version=0.6.13 -revision=2 +revision=3 build_style=gnu-configure hostmakedepends="automake gettext gettext-devel tar texinfo" makedepends="ncurses-devel"