Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments
@ 2018-02-21 21:02 Gaël PORTAY
  2018-02-21 22:43 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gaël PORTAY @ 2018-02-21 21:02 UTC (permalink / raw)
  To: buildroot

Use "$@" instead of $* to preserve argument.

Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
---
 fs/cpio/init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cpio/init b/fs/cpio/init
index a275482177..dbe09ac68e 100755
--- a/fs/cpio/init
+++ b/fs/cpio/init
@@ -4,4 +4,4 @@
 exec 0</dev/console
 exec 1>/dev/console
 exec 2>/dev/console
-exec /sbin/init $*
+exec /sbin/init "$@"
-- 
2.16.1

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

* [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments
  2018-02-21 21:02 [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments Gaël PORTAY
@ 2018-02-21 22:43 ` Thomas Petazzoni
  2018-02-21 23:21   ` Adrian Perez de Castro
  2018-02-22 14:38   ` Gaël PORTAY
  2018-02-21 23:17 ` Adrian Perez de Castro
  2018-02-26 19:51 ` Peter Korsgaard
  2 siblings, 2 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2018-02-21 22:43 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 21 Feb 2018 16:02:16 -0500, Ga?l PORTAY wrote:
> Use "$@" instead of $* to preserve argument.

Thanks for your patch, but why ? The commit log needs to explain the
use-case/motivations/reasons.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

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

* [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments
  2018-02-21 21:02 [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments Gaël PORTAY
  2018-02-21 22:43 ` Thomas Petazzoni
@ 2018-02-21 23:17 ` Adrian Perez de Castro
  2018-02-26 19:51 ` Peter Korsgaard
  2 siblings, 0 replies; 6+ messages in thread
From: Adrian Perez de Castro @ 2018-02-21 23:17 UTC (permalink / raw)
  To: buildroot

On Wed, 21 Feb 2018 16:02:16 -0500, Ga?l PORTAY <gael.portay@savoirfairelinux.com> wrote:
> Use "$@" instead of $* to preserve argument.
> 
> Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>

Reviewed-by: Adrian Perez de Castro <aperez@igalia.com>

> ---
>  fs/cpio/init | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/cpio/init b/fs/cpio/init
> index a275482177..dbe09ac68e 100755
> --- a/fs/cpio/init
> +++ b/fs/cpio/init
> @@ -4,4 +4,4 @@
>  exec 0</dev/console
>  exec 1>/dev/console
>  exec 2>/dev/console
> -exec /sbin/init $*
> +exec /sbin/init "$@"
> -- 
> 2.16.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180221/538c786a/attachment.asc>

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

* [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments
  2018-02-21 22:43 ` Thomas Petazzoni
@ 2018-02-21 23:21   ` Adrian Perez de Castro
  2018-02-22 14:38   ` Gaël PORTAY
  1 sibling, 0 replies; 6+ messages in thread
From: Adrian Perez de Castro @ 2018-02-21 23:21 UTC (permalink / raw)
  To: buildroot

On Wed, 21 Feb 2018 23:43:32 +0100, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> Hello,
> 
> On Wed, 21 Feb 2018 16:02:16 -0500, Ga?l PORTAY wrote:
> > Use "$@" instead of $* to preserve argument.
> 
> Thanks for your patch, but why ? The commit log needs to explain the
> use-case/motivations/reasons.

Using $* here will split each of the arguments at the spaces (well, at any of
the characters fro $IFS): that means that passing 'has space' as argument,
using $* will result in two arguments 'has' and 'space' being passed down.
Using "$@" prevents $IFS-splitting and passes argument unchanged as-is.

In most cases whenever there is a $* in a shell script, pretty much it means
that passing the parameters with spaces (file names, paths, etc.) will break
things.

Cheers,


--
 Adri?n ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180221/3604ce5f/attachment.asc>

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

* [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments
  2018-02-21 22:43 ` Thomas Petazzoni
  2018-02-21 23:21   ` Adrian Perez de Castro
@ 2018-02-22 14:38   ` Gaël PORTAY
  1 sibling, 0 replies; 6+ messages in thread
From: Gaël PORTAY @ 2018-02-22 14:38 UTC (permalink / raw)
  To: buildroot

Thomas,

On Wed, Feb 21, 2018 at 11:43:32PM +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 21 Feb 2018 16:02:16 -0500, Ga?l PORTAY wrote:
> > Use "$@" instead of $* to preserve argument.
> 
> Thanks for your patch, but why ? The commit log needs to explain the
> use-case/motivations/reasons.

Sorry for this lack of information.

I will send a v2 with an appropriate commit message.

> 
> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> http://bootlin.com

Regards,
Gael

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

* [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments
  2018-02-21 21:02 [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments Gaël PORTAY
  2018-02-21 22:43 ` Thomas Petazzoni
  2018-02-21 23:17 ` Adrian Perez de Castro
@ 2018-02-26 19:51 ` Peter Korsgaard
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2018-02-26 19:51 UTC (permalink / raw)
  To: buildroot

>>>>> "Ga?l" == Ga?l PORTAY <gael.portay@savoirfairelinux.com> writes:

 > Use "$@" instead of $* to preserve argument.
 > Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>

Committed after extending the commit message, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2018-02-26 19:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-21 21:02 [Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments Gaël PORTAY
2018-02-21 22:43 ` Thomas Petazzoni
2018-02-21 23:21   ` Adrian Perez de Castro
2018-02-22 14:38   ` Gaël PORTAY
2018-02-21 23:17 ` Adrian Perez de Castro
2018-02-26 19:51 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox