[Buildroot] [PATCH] support/scripts/check-host-libs: add new check on host binaries/libs

yann.morin at orange.com yann.morin at orange.com
Wed Sep 21 08:41:49 UTC 2022


David, All,

On 2022-09-21 08:23 +0000, David Laight spake thusly:
> From: Arnout Vandecappelle
> > Sent: 20 September 2022 20:49
> ...
> > date +%s
> > find host/*bin host/lib* -type f |while read f; do
> >          if printf '\x7f\x45\x4c\x46' | cmp -s -n 4 - ${f}; then
> >              printf '%s\n' "${f}"
> >          fi
> > done | wc -l
> > date +%s
> > 
> > 1663702312
> > 111
> > 1663702338
> 
> Think a bit further and you can remove the exec of cmp, eg:
> 
> $ time find /usr/lib -type f | (ELF="$(printf '\x7f\x45\x4c\x46')"; while read f; do read l <"$f" && [ "${l#$ELF}" != "$l" ] && echo $f; done )| wc -l

Nice trick. That took ~3s on my host/ dir.

And then, I think we can do simpler and more obvious (we know we have
bash, so we can use the bashisms 'read -N'):

    read -N 4 magic <"${f}"
    if [ "${magic}" = "${ELF}" ]; then printf "%s\n" "${f}"; fi

Now it's about ~1s, and that yields the same list as cmp yields.

Regards,
Yann E. MORIN.

-- 
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
|                 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
| yann.morin (at) orange.com           |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.




More information about the buildroot mailing list