Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation
@ 2018-07-11 19:51 Baruch Siach
  2018-07-11 19:51 ` [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink Baruch Siach
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Baruch Siach @ 2018-07-11 19:51 UTC (permalink / raw)
  To: buildroot

Since commit 256bb383fb7 (coreutils: use single binary in symlink
method) the chroot move command creates a dangling symlink, because the
symlink target is 'coreutils' which is not in the /usr/sbin/ directory.
Instead of moving, remove the coreutils installed symlink, and create a
new one in $(TARGET_DIR)/usr/sbin with the correct target.

Should also fix (busybox):
http://autobuild.buildroot.net/results/6b3/6b39648b466738162516aa50ab328d839ec85448/

Cc: Carlos Santos <casantos@datacom.ind.br>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v2: Drop ../usr from symlink target (Arnout, Carlos)
---
 package/coreutils/coreutils.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
index 3cb96589f228..2fb4a32c794f 100644
--- a/package/coreutils/coreutils.mk
+++ b/package/coreutils/coreutils.mk
@@ -114,7 +114,8 @@ define COREUTILS_CLEANUP
 	# link for archaic shells
 	ln -fs test $(TARGET_DIR)/usr/bin/[
 	# gnu thinks chroot is in bin, debian thinks it's in sbin
-	mv -f $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
+	rm -f $(TARGET_DIR)/usr/bin/chroot
+	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
 endef
 
 COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_CLEANUP
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink
  2018-07-11 19:51 [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Baruch Siach
@ 2018-07-11 19:51 ` Baruch Siach
  2018-07-11 21:48   ` Carlos Santos
  2018-07-11 21:49   ` Arnout Vandecappelle
  2018-07-16 14:41 ` [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Thomas Petazzoni
  2018-07-19 21:38 ` Peter Korsgaard
  2 siblings, 2 replies; 8+ messages in thread
From: Baruch Siach @ 2018-07-11 19:51 UTC (permalink / raw)
  To: buildroot

Link '[' directly to the coreutils binary instead of going through
'test'.

Suggested-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v2: New patch in this series
---
 package/coreutils/coreutils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
index 2fb4a32c794f..7e7251ff7396 100644
--- a/package/coreutils/coreutils.mk
+++ b/package/coreutils/coreutils.mk
@@ -112,7 +112,7 @@ endif
 
 define COREUTILS_CLEANUP
 	# link for archaic shells
-	ln -fs test $(TARGET_DIR)/usr/bin/[
+	ln -fs coreutils $(TARGET_DIR)/usr/bin/[
 	# gnu thinks chroot is in bin, debian thinks it's in sbin
 	rm -f $(TARGET_DIR)/usr/bin/chroot
 	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink
  2018-07-11 19:51 ` [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink Baruch Siach
@ 2018-07-11 21:48   ` Carlos Santos
  2018-07-11 21:49   ` Arnout Vandecappelle
  1 sibling, 0 replies; 8+ messages in thread
From: Carlos Santos @ 2018-07-11 21:48 UTC (permalink / raw)
  To: buildroot

> From: "Baruch Siach" <baruch@tkos.co.il>
> To: "buildroot" <buildroot@busybox.net>
> Cc: "DATACOM" <casantos@datacom.com.br>, "Arnout Vandecappelle" <arnout@mind.be>, "Baruch Siach" <baruch@tkos.co.il>
> Sent: Wednesday, July 11, 2018 4:51:19 PM
> Subject: [PATCH v2 2/2] coreutils: optimize the '[' symlink

> Link '[' directly to the coreutils binary instead of going through
> 'test'.
> 
> Suggested-by: Arnout Vandecappelle <arnout@mind.be>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> v2: New patch in this series
> ---
> package/coreutils/coreutils.mk | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
> index 2fb4a32c794f..7e7251ff7396 100644
> --- a/package/coreutils/coreutils.mk
> +++ b/package/coreutils/coreutils.mk
> @@ -112,7 +112,7 @@ endif
> 
> define COREUTILS_CLEANUP
> 	# link for archaic shells
> -	ln -fs test $(TARGET_DIR)/usr/bin/[
> +	ln -fs coreutils $(TARGET_DIR)/usr/bin/[
> 	# gnu thinks chroot is in bin, debian thinks it's in sbin
> 	rm -f $(TARGET_DIR)/usr/bin/chroot
> 	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
> --
> 2.18.0

Reviewd-by: Carlos Santos <casantos@datacom.com.br>

-- 
Carlos Santos (Casantos) - DATACOM, P&D
?Marched towards the enemy, spear upright, armed with the certainty
that only the ignorant can have.? ? Epitaph of a volunteer

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink
  2018-07-11 19:51 ` [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink Baruch Siach
  2018-07-11 21:48   ` Carlos Santos
@ 2018-07-11 21:49   ` Arnout Vandecappelle
  2018-07-11 22:06     ` Carlos Santos
  2018-07-12 19:02     ` Baruch Siach
  1 sibling, 2 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2018-07-11 21:49 UTC (permalink / raw)
  To: buildroot



On 11-07-18 21:51, Baruch Siach wrote:
> Link '[' directly to the coreutils binary instead of going through
> 'test'.

 One more small question: did you do a runtime test to be sure that this
actually works? (That said, if this doesn't work, then the previous one also
can't have worked.)

 Regards,
 Arnout

> 
> Suggested-by: Arnout Vandecappelle <arnout@mind.be>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> v2: New patch in this series
> ---
>  package/coreutils/coreutils.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
> index 2fb4a32c794f..7e7251ff7396 100644
> --- a/package/coreutils/coreutils.mk
> +++ b/package/coreutils/coreutils.mk
> @@ -112,7 +112,7 @@ endif
>  
>  define COREUTILS_CLEANUP
>  	# link for archaic shells
> -	ln -fs test $(TARGET_DIR)/usr/bin/[
> +	ln -fs coreutils $(TARGET_DIR)/usr/bin/[
>  	# gnu thinks chroot is in bin, debian thinks it's in sbin
>  	rm -f $(TARGET_DIR)/usr/bin/chroot
>  	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
> 

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink
  2018-07-11 21:49   ` Arnout Vandecappelle
@ 2018-07-11 22:06     ` Carlos Santos
  2018-07-12 19:02     ` Baruch Siach
  1 sibling, 0 replies; 8+ messages in thread
From: Carlos Santos @ 2018-07-11 22:06 UTC (permalink / raw)
  To: buildroot

> From: "Arnout Vandecappelle" <arnout@mind.be>
> To: "Baruch Siach" <baruch@tkos.co.il>, "buildroot" <buildroot@busybox.net>
> Cc: "DATACOM" <casantos@datacom.com.br>
> Sent: Wednesday, July 11, 2018 6:49:43 PM
> Subject: Re: [PATCH v2 2/2] coreutils: optimize the '[' symlink

> On 11-07-18 21:51, Baruch Siach wrote:
>> Link '[' directly to the coreutils binary instead of going through
>> 'test'.
> 
> One more small question: did you do a runtime test to be sure that this
> actually works? (That said, if this doesn't work, then the previous one also
> can't have worked.)

Yes, but it must be invoked directly since '[' is a shell built-in
command:

   # type [
   [ is a shell builtin
   # /usr/bin/[ -d / ] && echo ok
   ok

-- 
Carlos Santos (Casantos) - DATACOM, P&D
?Marched towards the enemy, spear upright, armed with the certainty
that only the ignorant can have.? ? Epitaph of a volunteer

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink
  2018-07-11 21:49   ` Arnout Vandecappelle
  2018-07-11 22:06     ` Carlos Santos
@ 2018-07-12 19:02     ` Baruch Siach
  1 sibling, 0 replies; 8+ messages in thread
From: Baruch Siach @ 2018-07-12 19:02 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

Arnout Vandecappelle writes:
> On 11-07-18 21:51, Baruch Siach wrote:
>> Link '[' directly to the coreutils binary instead of going through
>> 'test'.
>
>  One more small question: did you do a runtime test to be sure that this
> actually works? (That said, if this doesn't work, then the previous one also
> can't have worked.)

Tested in chroot now:
# readlink /usr/bin/[
coreutils
# if /usr/bin/[ 0 -eq 0 ]; then echo true; else echo false; fi
true
# if /usr/bin/[ 1 -eq 0 ]; then echo true; else echo false; fi
false

baruch

>> Suggested-by: Arnout Vandecappelle <arnout@mind.be>
>> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> ---
>> v2: New patch in this series
>> ---
>>  package/coreutils/coreutils.mk | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
>> index 2fb4a32c794f..7e7251ff7396 100644
>> --- a/package/coreutils/coreutils.mk
>> +++ b/package/coreutils/coreutils.mk
>> @@ -112,7 +112,7 @@ endif
>>  
>>  define COREUTILS_CLEANUP
>>  	# link for archaic shells
>> -	ln -fs test $(TARGET_DIR)/usr/bin/[
>> +	ln -fs coreutils $(TARGET_DIR)/usr/bin/[
>>  	# gnu thinks chroot is in bin, debian thinks it's in sbin
>>  	rm -f $(TARGET_DIR)/usr/bin/chroot
>>  	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation
  2018-07-11 19:51 [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Baruch Siach
  2018-07-11 19:51 ` [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink Baruch Siach
@ 2018-07-16 14:41 ` Thomas Petazzoni
  2018-07-19 21:38 ` Peter Korsgaard
  2 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2018-07-16 14:41 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 11 Jul 2018 22:51:18 +0300, Baruch Siach wrote:
> Since commit 256bb383fb7 (coreutils: use single binary in symlink
> method) the chroot move command creates a dangling symlink, because the
> symlink target is 'coreutils' which is not in the /usr/sbin/ directory.
> Instead of moving, remove the coreutils installed symlink, and create a
> new one in $(TARGET_DIR)/usr/sbin with the correct target.
> 
> Should also fix (busybox):
> http://autobuild.buildroot.net/results/6b3/6b39648b466738162516aa50ab328d839ec85448/
> 
> Cc: Carlos Santos <casantos@datacom.ind.br>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> v2: Drop ../usr from symlink target (Arnout, Carlos)
> ---
>  package/coreutils/coreutils.mk | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Series applied. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation
  2018-07-11 19:51 [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Baruch Siach
  2018-07-11 19:51 ` [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink Baruch Siach
  2018-07-16 14:41 ` [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Thomas Petazzoni
@ 2018-07-19 21:38 ` Peter Korsgaard
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2018-07-19 21:38 UTC (permalink / raw)
  To: buildroot

>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:

 > Since commit 256bb383fb7 (coreutils: use single binary in symlink
 > method) the chroot move command creates a dangling symlink, because the
 > symlink target is 'coreutils' which is not in the /usr/sbin/ directory.
 > Instead of moving, remove the coreutils installed symlink, and create a
 > new one in $(TARGET_DIR)/usr/sbin with the correct target.

 > Should also fix (busybox):
 > http://autobuild.buildroot.net/results/6b3/6b39648b466738162516aa50ab328d839ec85448/

 > Cc: Carlos Santos <casantos@datacom.ind.br>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
 > ---
 > v2: Drop ../usr from symlink target (Arnout, Carlos)

Committed to 2018.05.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-19 21:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 19:51 [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Baruch Siach
2018-07-11 19:51 ` [Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink Baruch Siach
2018-07-11 21:48   ` Carlos Santos
2018-07-11 21:49   ` Arnout Vandecappelle
2018-07-11 22:06     ` Carlos Santos
2018-07-12 19:02     ` Baruch Siach
2018-07-16 14:41 ` [Buildroot] [PATCH v2 1/2] coreutils: fix chroot installation Thomas Petazzoni
2018-07-19 21:38 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox