From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: <yann.morin@orange.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] support/scripts/check-host-libs: add new check on host binaries/libs
Date: Tue, 20 Sep 2022 11:19:19 +0200 [thread overview]
Message-ID: <20220920111919.784ffa7e@windsurf> (raw)
In-Reply-To: <30931_1663665105_632983D1_30931_112_8_20220920091143.GD3551@tl-lnx-nyma7486>
Howdy,
On Tue, 20 Sep 2022 11:11:43 +0200
<yann.morin@orange.com> wrote:
> Sorry, I was not explicit enough. Yes, the filtering only, i.e. only
> running 'file' on all those 16k+ files takes more than a minute:
>
> $ date +%s; find host/*bin host/lib* -type f |while read f; do
> mime=$(file -b --mime-type ${f})
> if test "${mime}" != "application/x-sharedlib" -a
> "${mime}" != "application/x-executable" ; then
> continue
> fi
> printf '%s\n' "${f}"
> done |wc -l; date +%s
>
> 1663659605
> 339
> 1663659681
>
> I.e. 76 seconds just to identify the files to actually look at.
ACK.
> Or we can see at optimising it. Overall, I am not a fan of "if it's too
> slow, don't do it", but I prefer "if it's too slow, make it faster".
Sure :-)
> So, we can start by spawning less processes, then use sed to filter out
> the result:
>
> find ${HOST_DIR}/*bin ${HOST_DIR}/lib* -type f -print 0 \
> |xargs -0 -r file --mime-type \
> |sed -r -e '/^(.+): application/(x-executable|x-sharedlib)$/!d; s//\1/' \
> |while read f; do
> readelf blabla...
> done
If it's really running "file" on a zillion files that is slow, I'm not
sure how this can really improve the performance: it still runs "file"
on zillion files.
Also, I initially had some constructs with a ... | while read f, but
the variables in the sub-shell where not visible outside, so the
"bailout" variable didn't work.
An alternative would be to try to do this in Python and use
parallelization.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-09-20 9:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 6:45 [Buildroot] [PATCH] support/scripts/check-host-libs: add new check on host binaries/libs Thomas Petazzoni
2022-09-20 7:46 ` yann.morin
2022-09-20 8:35 ` Thomas Petazzoni
2022-09-20 9:11 ` yann.morin
2022-09-20 9:19 ` Thomas Petazzoni via buildroot [this message]
2022-09-20 9:40 ` yann.morin
2022-09-20 9:54 ` Thomas Petazzoni
2022-09-20 19:48 ` Arnout Vandecappelle
2022-09-21 7:26 ` yann.morin
2022-09-21 8:23 ` David Laight
2022-09-21 8:41 ` yann.morin
2022-09-21 9:05 ` Thomas Petazzoni via buildroot
2022-09-21 9:09 ` yann.morin
2022-09-21 9:24 ` David Laight
2023-04-16 20:10 ` Yann E. MORIN
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=20220920111919.784ffa7e@windsurf \
--to=buildroot@buildroot.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin@orange.com \
/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