All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 0/1] Do not use command in profile
@ 2017-04-13 12:30 Peter Kjellerstedt
  2017-04-13 12:30 ` [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist Peter Kjellerstedt
  2017-04-21  7:48 ` [PATCHv2 0/1] Do not use command in profile Johannes Pointner
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Kjellerstedt @ 2017-04-13 12:30 UTC (permalink / raw)
  To: openembedded-core

Since we apparently cannot rely on the command utility to always
exist, it is better to avoid using it in the profile script. Rather
than using command to detect if tty and resize exist (which obviously
will not work if command itself does not exist), just call them
directly while piping any output for stderr to /dev/null. This should
actually be a little bit more efficient in the case that they do
exist, and the same in the case that they do not exist.

I leave to you to decide whether you want to revert commit e41c90b852
that enabled the command utility in busybox or not.

PATCHv2: Correct a typo in the commit message

//Peter

The following changes since commit fe47bff64b17562593c620d2daf748735bb5c3d6:

  linux-yocto: Update genericx86* SRCREVs for linux-yocto 4.10 (2017-04-13 10:54:37 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib pkj/profile_without_command
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/profile_without_command

Peter Kjellerstedt (1):
  base-files: profile: Avoid using "command" to determine if programs
    exist

 meta/recipes-core/base-files/base-files/profile | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

-- 
2.12.0



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

* [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist
  2017-04-13 12:30 [PATCHv2 0/1] Do not use command in profile Peter Kjellerstedt
@ 2017-04-13 12:30 ` Peter Kjellerstedt
  2017-06-19 14:53   ` Peter Kjellerstedt
  2017-04-21  7:48 ` [PATCHv2 0/1] Do not use command in profile Johannes Pointner
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Kjellerstedt @ 2017-04-13 12:30 UTC (permalink / raw)
  To: openembedded-core

Since the existence of "command" in itself is not guaranteed, using it
to determine if other executables exist is moot. Instead just run the
executables and let the shell determine if they exist. By piping stderr
to /dev/null we avoid unnecessary warnings in case they do not exist.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-core/base-files/base-files/profile | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index ceaf15f799..e05c8840db 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -22,14 +22,12 @@ if [ -d /etc/profile.d ]; then
 	unset i
 fi
 
-if command -v resize >/dev/null && command -v tty >/dev/null; then
-	# Make sure we are on a serial console (i.e. the device used starts with
-	# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which
-	# tries do use ssh
-	case $(tty) in
-		/dev/tty[A-z]*) resize >/dev/null;;
-	esac
-fi
+# Make sure we are on a serial console (i.e. the device used starts with
+# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which tries do
+# use ssh
+case $(tty 2>/dev/null) in
+	/dev/tty[A-z]*) resize >/dev/null 2>&1;;
+esac
 
 export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
 
-- 
2.12.0



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

* Re: [PATCHv2 0/1] Do not use command in profile
  2017-04-13 12:30 [PATCHv2 0/1] Do not use command in profile Peter Kjellerstedt
  2017-04-13 12:30 ` [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist Peter Kjellerstedt
@ 2017-04-21  7:48 ` Johannes Pointner
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Pointner @ 2017-04-21  7:48 UTC (permalink / raw)
  To: Peter Kjellerstedt; +Cc: OE-core

Will this patch get merge?
Or do we have to include 'command' from now on? As this commit
"busybox: In defconfig enable ASH_CMDCMD for built-in 'command'"
suggests?

Thanks,
Hannes

2017-04-13 14:30 GMT+02:00 Peter Kjellerstedt <peter.kjellerstedt@axis.com>:
> Since we apparently cannot rely on the command utility to always
> exist, it is better to avoid using it in the profile script. Rather
> than using command to detect if tty and resize exist (which obviously
> will not work if command itself does not exist), just call them
> directly while piping any output for stderr to /dev/null. This should
> actually be a little bit more efficient in the case that they do
> exist, and the same in the case that they do not exist.
>
> I leave to you to decide whether you want to revert commit e41c90b852
> that enabled the command utility in busybox or not.
>
> PATCHv2: Correct a typo in the commit message
>
> //Peter
>
> The following changes since commit fe47bff64b17562593c620d2daf748735bb5c3d6:
>
>   linux-yocto: Update genericx86* SRCREVs for linux-yocto 4.10 (2017-04-13 10:54:37 +0100)
>
> are available in the git repository at:
>
>   git://git.yoctoproject.org/poky-contrib pkj/profile_without_command
>   http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/profile_without_command
>
> Peter Kjellerstedt (1):
>   base-files: profile: Avoid using "command" to determine if programs
>     exist
>
>  meta/recipes-core/base-files/base-files/profile | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> --
> 2.12.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist
  2017-04-13 12:30 ` [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist Peter Kjellerstedt
@ 2017-06-19 14:53   ` Peter Kjellerstedt
  2017-09-15 14:06     ` Peter Kjellerstedt
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Kjellerstedt @ 2017-06-19 14:53 UTC (permalink / raw)
  To: Peter Kjellerstedt, openembedded-core

*ping*

//Peter

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> Peter Kjellerstedt
> Sent: den 13 april 2017 14:30
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCHv2 1/1] base-files: profile: Avoid using
> "command" to determine if programs exist
> 
> Since the existence of "command" in itself is not guaranteed, using it
> to determine if other executables exist is moot. Instead just run the
> executables and let the shell determine if they exist. By piping stderr
> to /dev/null we avoid unnecessary warnings in case they do not exist.
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  meta/recipes-core/base-files/base-files/profile | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/meta/recipes-core/base-files/base-files/profile
> b/meta/recipes-core/base-files/base-files/profile
> index ceaf15f799..e05c8840db 100644
> --- a/meta/recipes-core/base-files/base-files/profile
> +++ b/meta/recipes-core/base-files/base-files/profile
> @@ -22,14 +22,12 @@ if [ -d /etc/profile.d ]; then
>  	unset i
>  fi
> 
> -if command -v resize >/dev/null && command -v tty >/dev/null; then
> -	# Make sure we are on a serial console (i.e. the device used
> starts with
> -	# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse
> launcher which
> -	# tries do use ssh
> -	case $(tty) in
> -		/dev/tty[A-z]*) resize >/dev/null;;
> -	esac
> -fi
> +# Make sure we are on a serial console (i.e. the device used starts
> with
> +# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which
> tries do
> +# use ssh
> +case $(tty 2>/dev/null) in
> +	/dev/tty[A-z]*) resize >/dev/null 2>&1;;
> +esac
> 
>  export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
> 
> --
> 2.12.0
> 
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist
  2017-06-19 14:53   ` Peter Kjellerstedt
@ 2017-09-15 14:06     ` Peter Kjellerstedt
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Kjellerstedt @ 2017-09-15 14:06 UTC (permalink / raw)
  To: openembedded-core

*ping*

//Peter

> -----Original Message-----
> From: Peter Kjellerstedt
> Sent: den 19 juni 2017 16:53
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: RE: [OE-core] [PATCHv2 1/1] base-files: profile: Avoid using
> "command" to determine if programs exist
> 
> *ping*
> 
> //Peter
> 
> > -----Original Message-----
> > From: openembedded-core-bounces@lists.openembedded.org
> > [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> > Peter Kjellerstedt
> > Sent: den 13 april 2017 14:30
> > To: openembedded-core@lists.openembedded.org
> > Subject: [OE-core] [PATCHv2 1/1] base-files: profile: Avoid using
> > "command" to determine if programs exist
> >
> > Since the existence of "command" in itself is not guaranteed, using it
> > to determine if other executables exist is moot. Instead just run the
> > executables and let the shell determine if they exist. By piping stderr
> > to /dev/null we avoid unnecessary warnings in case they do not exist.
> >
> > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > ---
> >  meta/recipes-core/base-files/base-files/profile | 14 ++++++--------
> >  1 file changed, 6 insertions(+), 8 deletions(-)
> >
> > diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
> > index ceaf15f799..e05c8840db 100644
> > --- a/meta/recipes-core/base-files/base-files/profile
> > +++ b/meta/recipes-core/base-files/base-files/profile
> > @@ -22,14 +22,12 @@ if [ -d /etc/profile.d ]; then
> >  	unset i
> >  fi
> >
> > -if command -v resize >/dev/null && command -v tty >/dev/null; then
> > -	# Make sure we are on a serial console (i.e. the device used starts with
> > -	# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which
> > -	# tries do use ssh
> > -	case $(tty) in
> > -		/dev/tty[A-z]*) resize >/dev/null;;
> > -	esac
> > -fi
> > +# Make sure we are on a serial console (i.e. the device used starts with
> > +# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which tries do
> > +# use ssh
> > +case $(tty 2>/dev/null) in
> > +	/dev/tty[A-z]*) resize >/dev/null 2>&1;;
> > +esac
> >
> >  export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
> >
> > --
> > 2.12.0
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

end of thread, other threads:[~2017-09-15 14:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 12:30 [PATCHv2 0/1] Do not use command in profile Peter Kjellerstedt
2017-04-13 12:30 ` [PATCHv2 1/1] base-files: profile: Avoid using "command" to determine if programs exist Peter Kjellerstedt
2017-06-19 14:53   ` Peter Kjellerstedt
2017-09-15 14:06     ` Peter Kjellerstedt
2017-04-21  7:48 ` [PATCHv2 0/1] Do not use command in profile Johannes Pointner

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.