coreutils: fix chroot installation
PATCH v2 1/2 coreutils: fix chroot installation
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/
---
v2: Drop ../usr from symlink target (Arnout, Carlos)
--- package/coreutils/coreutils.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
package/coreutils/coreutils.mk +2 -1
@@ -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
Signature · 1 line
2.18.0
PATCH v2 2/2 coreutils: optimize the '[' symlink
Link '[' directly to the coreutils binary instead of going through 'test'.
---
v2: New patch in this series
--- package/coreutils/coreutils.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/coreutils/coreutils.mk +1 -1
@@ -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
Signature · 1 line
2.18.0
PATCH v2 2/2 coreutils: optimize the '[' symlink
Quoted 27 lines
From: "Baruch Siach" <[email protected]>
To: "buildroot" <[email protected]>
Cc: "DATACOM" <[email protected]>, "Arnout Vandecappelle" <[email protected]>, "Baruch Siach" <[email protected]>
Sent: Wednesday, July 11, 2018 4:51:19 PM
Subject: [PATCH v2 2/2] coreutils: optimize the '[' symlinkLink '[' directly to the coreutils binary instead of going through 'test'.
Suggested-by Arnout Vandecappelle <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v2: New patch in this series
---package/coreutils/coreutils.mk| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)package/coreutils/coreutils.mk +0
-0@@ -112,7 +112,7 @@ endifdefine
COREUTILS_CLEANUP# link for archaic shellspackage/coreutils/coreutils.mk +1
-1- ln -fs test $(TARGET_DIR)/usr/bin/[ + ln -fs coreutils $(TARGET_DIR)/usr/bin/[
Quoted 5 lines
# 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
Signature · 3 lines
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
PATCH v2 2/2 coreutils: optimize the '[' symlink
In reply to Baruch SiachQuoted 2 lines · Baruch Siach
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
Quoted 23 lines
Suggested-by Arnout Vandecappelle <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v2: New patch in this series--- package/coreutils/coreutils.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/coreutils/coreutils.mk +1
-1@@ -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
Signature · 6 lines
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
PATCH v2 2/2 coreutils: optimize the '[' symlink
Quoted 6 lines
From: "Arnout Vandecappelle" <[email protected]>
To: "Baruch Siach" <[email protected]>, "buildroot" <[email protected]>
Cc: "DATACOM" <[email protected]>
Sent: Wednesday, July 11, 2018 6:49:43 PM
Subject: Re: [PATCH v2 2/2] coreutils: optimize the '[' symlink
Quoted 7 lines
Quoted 2 lines · Baruch Siach
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
Signature · 3 lines
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
PATCH v2 2/2 coreutils: optimize the '[' symlink
In reply to Arnout VandecappelleHi Arnout,
Quoted 7 lines · Arnout Vandecappelle
Quoted 2 lines · Baruch Siach
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
Quoted 21 lines
Quoted 21 lines
Suggested-by Arnout Vandecappelle <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v2: New patch in this series--- package/coreutils/coreutils.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/coreutils/coreutils.mk +1
-1@@ -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
Signature · 3 lines
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 -PATCH v2 1/2 coreutils: fix chroot installation
In reply to Baruch SiachHello,
Quoted 9 lines · Baruch Siach
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/
Quoted 8 lines
Cc Carlos Santos <[email protected]>Cc Thomas Petazzoni <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v2: Drop ../usr from symlink target (Arnout, Carlos)--- package/coreutils/coreutils.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Series applied. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/2 coreutils: fix chroot installation
In reply to Baruch SiachQuoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Baruch" == Baruch Siach <[email protected]> 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.
Quoted 8 lines
Should also fix (busybox):
http://autobuild.buildroot.net/results/6b3/6b39648b466738162516aa50ab328d839ec85448/Cc Carlos Santos <[email protected]>Cc Thomas Petazzoni <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v2: Drop ../usr from symlink target (Arnout, Carlos)
Committed to 2018.05.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard