From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] purge-locales: Handle empty locale directories better
Date: Sun, 6 Mar 2016 20:37:37 +0100 [thread overview]
Message-ID: <56DC8701.4000008@mind.be> (raw)
In-Reply-To: <1457056294.25961.111.camel@rtred1test09.kymeta.local>
On 03/04/16 02:50, Trent Piepho wrote:
> If a locale directory is empty, shell code like "for langdir in
> $$dir/*;" will loop once with langdir set to "path/to/dir/*", rather
> than not looping at all, which would obviously be the desired
> behavior.
>
> Then "grep -qx $${langdir##*/}" ungoes two shell expansions (how?)
> that transform the expression from "${langdir##*/}" to "*" to "list
> of all files in buildroot root dir". Which is most certainly not what
> this command was supposed to do.
>
> If one of those files happens to be an 8GB flash image, grep consumes
> all available memory and crashes trying to search it.
Good catch!
>
> Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
> ---
> Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index f2822a2..0df5a35 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -581,7 +581,8 @@ define PURGE_LOCALES
> do \
> for langdir in $$dir/*; \
> do \
> - grep -qx $${langdir##*/} $(LOCALE_WHITELIST) || rm -rf $$langdir; \
> + [ -e "$${langdir}" ] || continue; \
I would prefer a more explicit if, the continue is a bit more difficult to grok.
Regards,
Arnout
> + grep -qx "$${langdir##*/}" $(LOCALE_WHITELIST) || rm -rf $$langdir; \
> done; \
> done
> if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
next prev parent reply other threads:[~2016-03-06 19:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-04 1:50 [Buildroot] [PATCH] purge-locales: Handle empty locale directories better Trent Piepho
2016-03-06 19:37 ` Arnout Vandecappelle [this message]
2016-03-08 21:02 ` [Buildroot] [PATCH v2] " Trent Piepho
2016-04-28 21:48 ` Peter Korsgaard
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=56DC8701.4000008@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/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 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.