diff options
| author | Michael Weiß <michael.weiss@aisec.fraunhofer.de> | 2023-07-13 09:48:11 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-07-13 07:22:45 -0700 |
| commit | ad0c005f9ead2590e3f8e91dcba5f968a0dae03a (patch) | |
| tree | b52dcad6cfafd661578f20264874b3dbd444e357 | |
| parent | e6a562bef712dc022d5cde4fcee1dc08d2989352 (diff) | |
| download | meta-openembedded-ad0c005f9ead2590e3f8e91dcba5f968a0dae03a.tar.gz | |
pv: Show progress bar even if no terminal is set as in 1.6.6
The currently used version 1.6.20 of pv does not show the progress
bar if no controlling terminal is set. Added a patch which restores
previous behavior of pv as in version 1.6.6.
Tested with pv in the busybox initscript of GyroidOS which is
running on /dev/console (which has no controlling tty). With this
fix, we get the progress bar back on /dev/console as before.
This was also submitted upstream but dangling since several Months:
https://github.com/a-j-wood/pv/pull/64
Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch | 38 | ||||
| -rw-r--r-- | meta-oe/recipes-support/pv/pv_1.6.20.bb | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch b/meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch new file mode 100644 index 0000000000..3c364dcc4e --- /dev/null +++ b/meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | From c5cd932fb08e7ce90cdbf9ae6c5cc7e65ac0738e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Michael=20Wei=C3=9F?= <michael.weiss@aisec.fraunhofer.de> | ||
| 3 | Date: Tue, 9 May 2023 20:00:26 +0200 | ||
| 4 | Subject: [PATCH] pv/display: handle error of tcgetpgrp() in pv_in_foreground() | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Show pv progress bar even if no terminal is set, e.g., in a busybox | ||
| 10 | init script. The description of pv_in_forground() states it will | ||
| 11 | return true "if we aren't outputting to a terminal". However, this | ||
| 12 | is not the case since tcgetpgrg() will return an error and set ERRNO | ||
| 13 | to ENOTTY if the output fd is not an tty. We now handle this error | ||
| 14 | correctly and pv_in_foreground() returns also true in that case. | ||
| 15 | |||
| 16 | Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de> | ||
| 17 | --- | ||
| 18 | src/pv/display.c | 4 ++++ | ||
| 19 | 1 file changed, 4 insertions(+) | ||
| 20 | |||
| 21 | diff --git a/src/pv/display.c b/src/pv/display.c | ||
| 22 | index aff643b..8d1f4c9 100644 | ||
| 23 | --- a/src/pv/display.c | ||
| 24 | +++ b/src/pv/display.c | ||
| 25 | @@ -48,6 +48,10 @@ bool pv_in_foreground(void) | ||
| 26 | |||
| 27 | our_process_group = getpgrp(); | ||
| 28 | tty_process_group = tcgetpgrp(STDERR_FILENO); | ||
| 29 | + | ||
| 30 | + if (tty_process_group == -1 && errno == ENOTTY) | ||
| 31 | + return true; | ||
| 32 | + | ||
| 33 | if (our_process_group == tty_process_group) | ||
| 34 | return true; | ||
| 35 | |||
| 36 | -- | ||
| 37 | 2.30.2 | ||
| 38 | |||
diff --git a/meta-oe/recipes-support/pv/pv_1.6.20.bb b/meta-oe/recipes-support/pv/pv_1.6.20.bb index 867a621d1a..6d449a945b 100644 --- a/meta-oe/recipes-support/pv/pv_1.6.20.bb +++ b/meta-oe/recipes-support/pv/pv_1.6.20.bb | |||
| @@ -5,6 +5,7 @@ LICENSE = "Artistic-2.0" | |||
| 5 | LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02" | 5 | LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02" |
| 6 | 6 | ||
| 7 | SRC_URI = "https://www.ivarch.com/programs/sources/${BP}.tar.bz2 \ | 7 | SRC_URI = "https://www.ivarch.com/programs/sources/${BP}.tar.bz2 \ |
| 8 | file://0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch \ | ||
| 8 | file://run-ptest \ | 9 | file://run-ptest \ |
| 9 | " | 10 | " |
| 10 | SRC_URI[sha256sum] = "e831951eff0718fba9b1ef286128773b9d0e723e1fbfae88d5a3188814fdc603" | 11 | SRC_URI[sha256sum] = "e831951eff0718fba9b1ef286128773b9d0e723e1fbfae88d5a3188814fdc603" |
