All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
Date: Thu, 22 Oct 2015 23:19:03 +0200	[thread overview]
Message-ID: <562952C7.30708@mind.be> (raw)
In-Reply-To: <1445502151-25735-1-git-send-email-bjorn.forsman@gmail.com>

On 22-10-15 10:22, Bj?rn Forsman wrote:
> Without this, the -f path argument is ignored:
> 
>  $ strace -f -s128 /sbin/ldconfig -r /home/vagrant/buildroot/output/target -f /home/vagrant/buildroot/output/target/etc/ld.so.conf |& grep "ld\.so\.conf"
>  execve("/sbin/ldconfig", ["/sbin/ldconfig", "-r", "/home/vagrant/buildroot/output/target", "-f", "/home/vagrant/buildroot/output/target/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  execve("/sbin/ldconfig.real", ["/sbin/ldconfig.real", "-r", "/home/vagrant/buildroot/output/target", "-f", "/home/vagrant/buildroot/output/target/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  write(2, "Warning: ignoring configuration file that cannot be opened: /home/vagrant/buildroot/output/target/etc/ld.so.conf", 112Warning: ignoring configuration file that cannot be opened: /home/vagrant/buildroot/output/target/etc/ld.so.conf) = 112
> 
> Proof that using root-relative path -f path (/etc/ld.so.conf, without
> $(TARGET_DIR) in front) picks up the correct file:
> 
>  $ strace -f -s128 /sbin/ldconfig -r /home/vagrant/buildroot/output/target -f /etc/ld.so.conf |& grep "ld\.so\.conf"
>  execve("/sbin/ldconfig", ["/sbin/ldconfig", "-r", "/home/vagrant/buildroot/output/target", "-f", "/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  execve("/sbin/ldconfig.real", ["/sbin/ldconfig.real", "-r", "/home/vagrant/buildroot/output/target", "-f", "/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  lstat("/home/vagrant/buildroot/output/target/etc/ld.so.conf", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
>  open("/home/vagrant/buildroot/output/target/etc/ld.so.conf", O_RDONLY) = 3
> 
> Tested on Ubuntu 14.04.
> 
>  $ /sbin/ldconfig --version
>  ldconfig (Ubuntu EGLIBC 2.19-0ubuntu6.6) 2.19
>  ...
> 
> $(TARGET_CROSS)ldconfig behaves differently (at least the ldconfig I
> tested, which was built by Buildroot) and should not have root-relative
> -f path. If it does, it will pick up host /etc/ld.so.conf file.

 This makes me worried that it will do the wrong thing on some other build
hosts. In fact, using /sbin/ldconfig is fundamentally broken since we can't be
sure that it's compatible with the target dynamic linker.


 Regards,
 Arnout

> 
> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index dd8959f..61ce1f9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -607,7 +607,7 @@ endif
>  					-f $(TARGET_DIR)/etc/ld.so.conf; \
>  	else \
>  		/sbin/ldconfig -r $(TARGET_DIR) \
> -			       -f $(TARGET_DIR)/etc/ld.so.conf; \
> +			       -f /etc/ld.so.conf; \
>  	fi
>  	( \
>  		echo "NAME=Buildroot"; \
> 


-- 
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

  parent reply	other threads:[~2015-10-22 21:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22  8:22 [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig Bjørn Forsman
2015-10-22  8:22 ` [Buildroot] [PATCH 2/2] Makefile: add -C flag " Bjørn Forsman
2015-10-22 21:19 ` Arnout Vandecappelle [this message]
2015-10-23  7:12   ` [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path " Bjørn Forsman
2015-10-23  8:26     ` Thomas Petazzoni
2015-10-23 12:06       ` Bjørn Forsman
2015-12-29 20:32 ` Thomas Petazzoni

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=562952C7.30708@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.