mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] barebox: careful handling of wildcard
Date: Thu, 26 Mar 2015 09:46:53 +0100	[thread overview]
Message-ID: <20150326084653.GD3000@pengutronix.de> (raw)
In-Reply-To: <1425244923-29216-1-git-send-email-alex.aring@gmail.com>

On Sun, Mar 01, 2015 at 10:22:03PM +0100, Alexander Aring wrote:
> Some barebox images are not placed into barebox image directory, this
> will end in a failure of ls with the wildcard expression. Something
> like:
> 
> ls: cannot access ..foobar.../barebox-2015.02.0/images/barebox-*.img:
> No such file or directory
> 
> This patch will improve the handling with wildcard if no image is
> found by using find.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> Please review carefully! I tested in my case with dropping targetinstall
> and add some "dummy" file into barebox image directory. Both cases works
> on my side (no file and some dummy "barebox-*.img" file).
> 
> Also I can't no guarantee that the sequence of ls and find are the same
> and it looks like that the sequence is important because the:
> "if [ ! -e $(IMAGEDIR)/barebox-image ]; then \" part.
> 
> A general question would be is this always safe? What happens if somebody
> do an "alias ls='ls $SORTOPTIONS'" somewhere where $USED_SHELL source some
> general file? I suppose ptxdist has some mechanism to handle with something
> like that.

Thanks, applied with a minor change: added 'sort' to keep the old order.
(It's already in ptxdist-2015.03.0).

Michael

> 
>  rules/barebox.make | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/rules/barebox.make b/rules/barebox.make
> index 5c596a5..46d8e95 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -138,7 +138,9 @@ ifdef PTXCONF_BAREBOX_BAREBOXENV
>  	@$(call install_finish, barebox)
>  endif
>  	@rm -f $(IMAGEDIR)/barebox-image
> -	@for image in `ls $(BAREBOX_DIR)/images/barebox-*.img`; do \
> +	@find $(BAREBOX_DIR)/images/ -name "barebox-*.img" \
> +		| \
> +		while read image; do \
>  		install -D -m644 $$image $(IMAGEDIR)/`basename $$image`; \
>  		if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
>  			ln -sf `basename $$image` $(IMAGEDIR)/barebox-image; \
> -- 
> 2.3.0
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

      reply	other threads:[~2015-03-26  8:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01 21:22 Alexander Aring
2015-03-26  8:46 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150326084653.GD3000@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox