* [meta-oe][PATCH] pv: Show progress bar even if no terminal is set as in 1.6.6
@ 2023-07-12 14:57 Michael Weiß
2023-07-12 16:02 ` [oe] " Khem Raj
0 siblings, 1 reply; 3+ messages in thread
From: Michael Weiß @ 2023-07-12 14:57 UTC (permalink / raw)
To: openembedded-devel; +Cc: Michael Weiß
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>
---
...e-error-of-tcgetpgrp-in-pv_in_foregr.patch | 38 +++++++++++++++++++
meta-oe/recipes-support/pv/pv_1.6.20.bb | 1 +
2 files changed, 39 insertions(+)
create mode 100644 meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch
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 000000000..3c364dcc4
--- /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 @@
+From c5cd932fb08e7ce90cdbf9ae6c5cc7e65ac0738e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20Wei=C3=9F?= <michael.weiss@aisec.fraunhofer.de>
+Date: Tue, 9 May 2023 20:00:26 +0200
+Subject: [PATCH] pv/display: handle error of tcgetpgrp() in pv_in_foreground()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Show pv progress bar even if no terminal is set, e.g., in a busybox
+init script. The description of pv_in_forground() states it will
+return true "if we aren't outputting to a terminal". However, this
+is not the case since tcgetpgrg() will return an error and set ERRNO
+to ENOTTY if the output fd is not an tty. We now handle this error
+correctly and pv_in_foreground() returns also true in that case.
+
+Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
+---
+ src/pv/display.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/pv/display.c b/src/pv/display.c
+index aff643b..8d1f4c9 100644
+--- a/src/pv/display.c
++++ b/src/pv/display.c
+@@ -48,6 +48,10 @@ bool pv_in_foreground(void)
+
+ our_process_group = getpgrp();
+ tty_process_group = tcgetpgrp(STDERR_FILENO);
++
++ if (tty_process_group == -1 && errno == ENOTTY)
++ return true;
++
+ if (our_process_group == tty_process_group)
+ return true;
+
+--
+2.30.2
+
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 867a621d1..87b764ac5 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"
LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02"
SRC_URI = "https://www.ivarch.com/programs/sources/${BP}.tar.bz2 \
+ file://0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch" \
file://run-ptest \
"
SRC_URI[sha256sum] = "e831951eff0718fba9b1ef286128773b9d0e723e1fbfae88d5a3188814fdc603"
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [oe] [meta-oe][PATCH] pv: Show progress bar even if no terminal is set as in 1.6.6
2023-07-12 14:57 [meta-oe][PATCH] pv: Show progress bar even if no terminal is set as in 1.6.6 Michael Weiß
@ 2023-07-12 16:02 ` Khem Raj
2023-07-12 17:14 ` Michael Weiß
0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2023-07-12 16:02 UTC (permalink / raw)
To: Michael Weiß; +Cc: openembedded-devel
On Wed, Jul 12, 2023 at 7:58 AM Michael Weiß
<michael.weiss@aisec.fraunhofer.de> wrote:
>
> 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>
> ---
> ...e-error-of-tcgetpgrp-in-pv_in_foregr.patch | 38 +++++++++++++++++++
> meta-oe/recipes-support/pv/pv_1.6.20.bb | 1 +
> 2 files changed, 39 insertions(+)
> create mode 100644 meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch
>
> 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 000000000..3c364dcc4
> --- /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 @@
> +From c5cd932fb08e7ce90cdbf9ae6c5cc7e65ac0738e Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Michael=20Wei=C3=9F?= <michael.weiss@aisec.fraunhofer.de>
> +Date: Tue, 9 May 2023 20:00:26 +0200
> +Subject: [PATCH] pv/display: handle error of tcgetpgrp() in pv_in_foreground()
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Show pv progress bar even if no terminal is set, e.g., in a busybox
> +init script. The description of pv_in_forground() states it will
> +return true "if we aren't outputting to a terminal". However, this
> +is not the case since tcgetpgrg() will return an error and set ERRNO
> +to ENOTTY if the output fd is not an tty. We now handle this error
> +correctly and pv_in_foreground() returns also true in that case.
> +
> +Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
> +---
> + src/pv/display.c | 4 ++++
> + 1 file changed, 4 insertions(+)
> +
> +diff --git a/src/pv/display.c b/src/pv/display.c
> +index aff643b..8d1f4c9 100644
> +--- a/src/pv/display.c
> ++++ b/src/pv/display.c
> +@@ -48,6 +48,10 @@ bool pv_in_foreground(void)
> +
> + our_process_group = getpgrp();
> + tty_process_group = tcgetpgrp(STDERR_FILENO);
> ++
> ++ if (tty_process_group == -1 && errno == ENOTTY)
> ++ return true;
> ++
> + if (our_process_group == tty_process_group)
> + return true;
> +
> +--
> +2.30.2
> +
> 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 867a621d1..87b764ac5 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"
> LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02"
>
> SRC_URI = "https://www.ivarch.com/programs/sources/${BP}.tar.bz2 \
> + file://0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch" \
There is a spurious end of quote ( " ) above. How was this patch tested ?
> file://run-ptest \
> "
> SRC_URI[sha256sum] = "e831951eff0718fba9b1ef286128773b9d0e723e1fbfae88d5a3188814fdc603"
> --
> 2.30.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#103842): https://lists.openembedded.org/g/openembedded-devel/message/103842
> Mute This Topic: https://lists.openembedded.org/mt/100101204/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [oe] [meta-oe][PATCH] pv: Show progress bar even if no terminal is set as in 1.6.6
2023-07-12 16:02 ` [oe] " Khem Raj
@ 2023-07-12 17:14 ` Michael Weiß
0 siblings, 0 replies; 3+ messages in thread
From: Michael Weiß @ 2023-07-12 17:14 UTC (permalink / raw)
To: Khem Raj; +Cc: openembedded-devel
On 12.07.23 18:02, Khem Raj wrote:
> On Wed, Jul 12, 2023 at 7:58 AM Michael Weiß
> <michael.weiss@aisec.fraunhofer.de> wrote:
>>
>> 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>
>> ---
>> ...e-error-of-tcgetpgrp-in-pv_in_foregr.patch | 38 +++++++++++++++++++
>> meta-oe/recipes-support/pv/pv_1.6.20.bb | 1 +
>> 2 files changed, 39 insertions(+)
>> create mode 100644 meta-oe/recipes-support/pv/pv/0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch
>>
>> 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 000000000..3c364dcc4
>> --- /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 @@
>> +From c5cd932fb08e7ce90cdbf9ae6c5cc7e65ac0738e Mon Sep 17 00:00:00 2001
>> +From: =?UTF-8?q?Michael=20Wei=C3=9F?= <michael.weiss@aisec.fraunhofer.de>
>> +Date: Tue, 9 May 2023 20:00:26 +0200
>> +Subject: [PATCH] pv/display: handle error of tcgetpgrp() in pv_in_foreground()
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +Show pv progress bar even if no terminal is set, e.g., in a busybox
>> +init script. The description of pv_in_forground() states it will
>> +return true "if we aren't outputting to a terminal". However, this
>> +is not the case since tcgetpgrg() will return an error and set ERRNO
>> +to ENOTTY if the output fd is not an tty. We now handle this error
>> +correctly and pv_in_foreground() returns also true in that case.
>> +
>> +Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
>> +---
>> + src/pv/display.c | 4 ++++
>> + 1 file changed, 4 insertions(+)
>> +
>> +diff --git a/src/pv/display.c b/src/pv/display.c
>> +index aff643b..8d1f4c9 100644
>> +--- a/src/pv/display.c
>> ++++ b/src/pv/display.c
>> +@@ -48,6 +48,10 @@ bool pv_in_foreground(void)
>> +
>> + our_process_group = getpgrp();
>> + tty_process_group = tcgetpgrp(STDERR_FILENO);
>> ++
>> ++ if (tty_process_group == -1 && errno == ENOTTY)
>> ++ return true;
>> ++
>> + if (our_process_group == tty_process_group)
>> + return true;
>> +
>> +--
>> +2.30.2
>> +
>> 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 867a621d1..87b764ac5 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"
>> LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02"
>>
>> SRC_URI = "https://www.ivarch.com/programs/sources/${BP}.tar.bz2 \
>> + file://0001-pv-display-handle-error-of-tcgetpgrp-in-pv_in_foregr.patch" \
>
> There is a spurious end of quote ( " ) above. How was this patch tested ?
I just ported the patch from our own layer from a bbappend file where the included
patch from pv itself was tested for several month now.
Seems that I have forgotten a "git add" when I was amending to fix that error.
Though the typo was fixed only in my workdir during tests.
I'll come up with a v2 shortly. Thanks for spotting this.
>
>> file://run-ptest \
>> "
>> SRC_URI[sha256sum] = "e831951eff0718fba9b1ef286128773b9d0e723e1fbfae88d5a3188814fdc603"
>> --
>> 2.30.2
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#103842): https://lists.openembedded.org/g/openembedded-devel/message/103842
>> Mute This Topic: https://lists.openembedded.org/mt/100101204/1997914
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-12 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-12 14:57 [meta-oe][PATCH] pv: Show progress bar even if no terminal is set as in 1.6.6 Michael Weiß
2023-07-12 16:02 ` [oe] " Khem Raj
2023-07-12 17:14 ` Michael Weiß
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.