public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] seccomp.sh: Silence stty errors
@ 2025-02-21 11:53 Michal Privoznik
  2025-02-24  2:05 ` David Gibson
  2025-02-24 19:37 ` Stefano Brivio
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Privoznik @ 2025-02-21 11:53 UTC (permalink / raw)
  To: passt-dev; +Cc: sbrivio

When printing list of allowed syscalls the width of terminal is
obtained for nicer output (see commit below). The width is
obtained by running 'stty'. While this works when building from a
console, it doesn't work during rpmbuild/emerge/.. as stdout is
usually not a console but a logfile and stdin is usually
/dev/null or something. This results in stty reporting errors
like this:

  stty: 'standard input': Inappropriate ioctl for device

Redirect stty's stderr to /dev/null to silence it.

Fixes: 712ca3235329b049bf9a4e481ba38a4c64768e8b
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

I've noticed the error when running emerge on my local system, but then
also found it on a recent koji build:

https://kojipkgs.fedoraproject.org//packages/passt/0%5E20250217.ga1e48a0/2.fc41/data/logs/x86_64/build.log

 seccomp.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/seccomp.sh b/seccomp.sh
index 4c521ae..a7bc417 100755
--- a/seccomp.sh
+++ b/seccomp.sh
@@ -255,7 +255,7 @@ for __p in ${__profiles}; do
 	__calls="${__calls} ${EXTRA_SYSCALLS:-}"
 	__calls="$(filter ${__calls})"
 
-	cols="$(stty -a | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
+	cols="$(stty -a 2>/dev/null | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
 	case $cols in [0-9]*) col_args="-w ${cols}";; *) col_args="";; esac
 	echo "seccomp profile ${__p} allows: ${__calls}" | tr '\n' ' ' | fmt -t ${col_args}
 
-- 
@@ -255,7 +255,7 @@ for __p in ${__profiles}; do
 	__calls="${__calls} ${EXTRA_SYSCALLS:-}"
 	__calls="$(filter ${__calls})"
 
-	cols="$(stty -a | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
+	cols="$(stty -a 2>/dev/null | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
 	case $cols in [0-9]*) col_args="-w ${cols}";; *) col_args="";; esac
 	echo "seccomp profile ${__p} allows: ${__calls}" | tr '\n' ' ' | fmt -t ${col_args}
 
-- 
2.45.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] seccomp.sh: Silence stty errors
  2025-02-21 11:53 [PATCH] seccomp.sh: Silence stty errors Michal Privoznik
@ 2025-02-24  2:05 ` David Gibson
  2025-02-24  7:38   ` Stefano Brivio
  2025-02-24 19:37 ` Stefano Brivio
  1 sibling, 1 reply; 5+ messages in thread
From: David Gibson @ 2025-02-24  2:05 UTC (permalink / raw)
  To: Michal Privoznik; +Cc: passt-dev, sbrivio

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]

On Fri, Feb 21, 2025 at 12:53:13PM +0100, Michal Privoznik wrote:
> When printing list of allowed syscalls the width of terminal is
> obtained for nicer output (see commit below). The width is
> obtained by running 'stty'. While this works when building from a
> console, it doesn't work during rpmbuild/emerge/.. as stdout is
> usually not a console but a logfile and stdin is usually
> /dev/null or something. This results in stty reporting errors
> like this:
> 
>   stty: 'standard input': Inappropriate ioctl for device
> 
> Redirect stty's stderr to /dev/null to silence it.
> 
> Fixes: 712ca3235329b049bf9a4e481ba38a4c64768e8b
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Although, I also wonder if we'd do just as well to use the shell
provided $COLUMNS variable without poking at the terminal ourselves.

> ---
> 
> I've noticed the error when running emerge on my local system, but then
> also found it on a recent koji build:
> 
> https://kojipkgs.fedoraproject.org//packages/passt/0%5E20250217.ga1e48a0/2.fc41/data/logs/x86_64/build.log
> 
>  seccomp.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/seccomp.sh b/seccomp.sh
> index 4c521ae..a7bc417 100755
> --- a/seccomp.sh
> +++ b/seccomp.sh
> @@ -255,7 +255,7 @@ for __p in ${__profiles}; do
>  	__calls="${__calls} ${EXTRA_SYSCALLS:-}"
>  	__calls="$(filter ${__calls})"
>  
> -	cols="$(stty -a | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
> +	cols="$(stty -a 2>/dev/null | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
>  	case $cols in [0-9]*) col_args="-w ${cols}";; *) col_args="";; esac
>  	echo "seccomp profile ${__p} allows: ${__calls}" | tr '\n' ' ' | fmt -t ${col_args}
>  

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] seccomp.sh: Silence stty errors
  2025-02-24  2:05 ` David Gibson
@ 2025-02-24  7:38   ` Stefano Brivio
  2025-02-24  7:41     ` David Gibson
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Brivio @ 2025-02-24  7:38 UTC (permalink / raw)
  To: David Gibson; +Cc: Michal Privoznik, passt-dev

On Mon, 24 Feb 2025 13:05:40 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Fri, Feb 21, 2025 at 12:53:13PM +0100, Michal Privoznik wrote:
> > When printing list of allowed syscalls the width of terminal is
> > obtained for nicer output (see commit below). The width is
> > obtained by running 'stty'. While this works when building from a
> > console, it doesn't work during rpmbuild/emerge/.. as stdout is
> > usually not a console but a logfile and stdin is usually
> > /dev/null or something. This results in stty reporting errors
> > like this:
> > 
> >   stty: 'standard input': Inappropriate ioctl for device
> > 
> > Redirect stty's stderr to /dev/null to silence it.
> > 
> > Fixes: 712ca3235329b049bf9a4e481ba38a4c64768e8b
> > Signed-off-by: Michal Privoznik <mprivozn@redhat.com>  
> 
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> 
> Although, I also wonder if we'd do just as well to use the shell
> provided $COLUMNS variable without poking at the terminal ourselves.

No, because that's a Bash/KSH thing. At least ash, dash and csh don't
have it.

-- 
Stefano


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] seccomp.sh: Silence stty errors
  2025-02-24  7:38   ` Stefano Brivio
@ 2025-02-24  7:41     ` David Gibson
  0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2025-02-24  7:41 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Michal Privoznik, passt-dev

[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

On Mon, Feb 24, 2025 at 08:38:24AM +0100, Stefano Brivio wrote:
> On Mon, 24 Feb 2025 13:05:40 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Fri, Feb 21, 2025 at 12:53:13PM +0100, Michal Privoznik wrote:
> > > When printing list of allowed syscalls the width of terminal is
> > > obtained for nicer output (see commit below). The width is
> > > obtained by running 'stty'. While this works when building from a
> > > console, it doesn't work during rpmbuild/emerge/.. as stdout is
> > > usually not a console but a logfile and stdin is usually
> > > /dev/null or something. This results in stty reporting errors
> > > like this:
> > > 
> > >   stty: 'standard input': Inappropriate ioctl for device
> > > 
> > > Redirect stty's stderr to /dev/null to silence it.
> > > 
> > > Fixes: 712ca3235329b049bf9a4e481ba38a4c64768e8b
> > > Signed-off-by: Michal Privoznik <mprivozn@redhat.com>  
> > 
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > Although, I also wonder if we'd do just as well to use the shell
> > provided $COLUMNS variable without poking at the terminal ourselves.
> 
> No, because that's a Bash/KSH thing. At least ash, dash and csh don't
> have it.

Having marginally uglier formatting in those shells doesn't strike me
as a disaster.

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] seccomp.sh: Silence stty errors
  2025-02-21 11:53 [PATCH] seccomp.sh: Silence stty errors Michal Privoznik
  2025-02-24  2:05 ` David Gibson
@ 2025-02-24 19:37 ` Stefano Brivio
  1 sibling, 0 replies; 5+ messages in thread
From: Stefano Brivio @ 2025-02-24 19:37 UTC (permalink / raw)
  To: Michal Privoznik; +Cc: passt-dev, David Gibson

On Fri, 21 Feb 2025 12:53:13 +0100
Michal Privoznik <mprivozn@redhat.com> wrote:

> When printing list of allowed syscalls the width of terminal is
> obtained for nicer output (see commit below). The width is
> obtained by running 'stty'. While this works when building from a
> console, it doesn't work during rpmbuild/emerge/.. as stdout is
> usually not a console but a logfile and stdin is usually
> /dev/null or something. This results in stty reporting errors
> like this:
> 
>   stty: 'standard input': Inappropriate ioctl for device
> 
> Redirect stty's stderr to /dev/null to silence it.
> 
> Fixes: 712ca3235329b049bf9a4e481ba38a4c64768e8b
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Applied, thanks!

> ---
> 
> I've noticed the error when running emerge on my local system, but then
> also found it on a recent koji build:
> 
> https://kojipkgs.fedoraproject.org//packages/passt/0%5E20250217.ga1e48a0/2.fc41/data/logs/x86_64/build.log

Funny, I'm not sure what's the magic involved, but for some reason it
doesn't happen on Debian builds:

  https://buildd.debian.org/status/fetch.php?pkg=passt&arch=mips64el&ver=0.0%7Egit20250217.a1e48a0-1&stamp=1739783665&raw=0

-- 
Stefano


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-24 19:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-21 11:53 [PATCH] seccomp.sh: Silence stty errors Michal Privoznik
2025-02-24  2:05 ` David Gibson
2025-02-24  7:38   ` Stefano Brivio
2025-02-24  7:41     ` David Gibson
2025-02-24 19:37 ` Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).