All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support/scripts/check-bin-arch: ignore symbolic links
Date: Sun, 3 Sep 2017 16:25:48 +0200	[thread overview]
Message-ID: <20170903142548.GC2786@scaer> (raw)
In-Reply-To: <20170903140941.12455-1-thomas.petazzoni@free-electrons.com>

Thomas, All,

On 2017-09-03 16:09 +0200, Thomas Petazzoni spake thusly:
> Since commit da32b49f0091ee9dfb613e0f00973bf6893bfa84
> ("instrumentation: extend packages-file-list.txt with symlinks and
> directories"), the packages-file-list.txt also contains symbolic
> links. Therefore, check-bin-arch is now also checking symbolic links.
> 
> However, symbolic links in $(TARGET_DIR) can have absolute path as
> targets, such as:
> 
> $ ls -l output/target/sbin/ifdown
> lrwxrwxrwx 1 thomas thomas 10 Sep  3 15:55 output/target/sbin/ifdown -> /sbin/ifup
> 
> Therefore, we are now potentially checking a host binary, which
> obviously makes check-bin-arch fail.
> 
> This commit changes check-bin-arch to ignore symbolic links. Indeed,
> we have two cases:
> 
>  - The symbolic link really points to something that will in the
>    rootfs (such as /sbin/ifup above). In this case, /sbin/ifup will be
>    checked separately by check-bin-arch.
> 
>  - The symbolic link doesn't point to something that will be in the
>    rootfs, and that is not a problem from the perspective of
>    check-bin-arch, which checks the architecture of target binaries.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/16d384a0183d477646ac7692feb65f00dde7d068/
>   (vim)
> 
>   http://autobuild.buildroot.net/results/50429c0f63a8befff9e20899327b9a8d754d99be/
>   (ifupdown)
> 
>   http://autobuild.buildroot.net/results/1db65973e782bfa61abcbccd3501bfd235f77288/
>   (gawk)
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  support/scripts/check-bin-arch | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/support/scripts/check-bin-arch b/support/scripts/check-bin-arch
> index b822cdd60d..700ee3f65e 100755
> --- a/support/scripts/check-bin-arch
> +++ b/support/scripts/check-bin-arch
> @@ -36,6 +36,12 @@ while read f; do
>  		continue
>  	fi
>  
> +	# Skip symlinks. Some symlinks may have absolute paths as
> +	# target, pointing to host binaries while we're building.
> +	if [[ -L "${f}" ]]; then

I don't like that we use the bashism [[...]] when the POSIX [...] works
perfectly well. And we also use 'test' below, which is not very
consistent...

But oh, well...

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> +		continue
> +	fi
> +
>  	# Get architecture using readelf. We pipe through 'head -1' so
>  	# that when the file is a static library (.a), we only take
>  	# into account the architecture of the first object file.
> -- 
> 2.13.5
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2017-09-03 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 14:09 [Buildroot] [PATCH] support/scripts/check-bin-arch: ignore symbolic links Thomas Petazzoni
2017-09-03 14:25 ` Yann E. MORIN [this message]
2017-09-04 14:04   ` Thomas Petazzoni
2017-09-04 14:03 ` Thomas Petazzoni
2017-10-16 21:45 ` 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=20170903142548.GC2786@scaer \
    --to=yann.morin.1998@free.fr \
    --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.