Skip to contentSkip to conversation

coreutils: fix chroot installation

PATCH Superseded Baruch Siach 3 participants 3 messages Jul 10, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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/

Cc Carlos Santos <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/coreutils/coreutils.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/coreutils/coreutils.mk +2 -1
index 3cb96589f228..33389b6ca730 100644
@@ -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 ../../usr/bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
 endef
 
 COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_CLEANUP
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 coreutils: fix chroot installation

Hi Baruch,

Two questions...

Quoted 21 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/

Cc Carlos Santos <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/coreutils/coreutils.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/coreutils/coreutils.mk +0 -0
index 3cb96589f228..33389b6ca730 100644

package/coreutils/coreutils.mk define COREUTILS_CLEANUP · line 115

Quoted 2 lines
package/coreutils/coreutils.mk +0 -0
@@ -114,7 +114,8 @@ define COREUTILS_CLEANUP
 	# link for archaic shells
 	ln -fs test $(TARGET_DIR)/usr/bin/[

Does this actually work? If it does, wouldn't it be better to link it directly
to coreutils as well? (Separate patch, obviously.)

package/coreutils/coreutils.mk define COREUTILS_CLEANUP · line 118

Quoted 4 lines
package/coreutils/coreutils.mk +2 -1
 	# 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 ../../usr/bin/coreutils $(TARGET_DIR)/usr/sbin/chroot

Why the additional ../usr?

Regards,
Arnout

Quoted 4 lines
package/coreutils/coreutils.mk +0 -0
 endef
 
 COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_CLEANUP
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
#2 lore raw

PATCH 1/1 coreutils: fix chroot installation

In reply to Baruch Siach
Quoted 28 lines

From: "Baruch Siach" <[email protected]>
To: "buildroot" <[email protected]>
Cc: "Baruch Siach" <[email protected]>, "Carlos Santos" <[email protected]>, "Thomas Petazzoni" <[email protected]>
Sent: Tuesday, July 10, 2018 4:56:31 PM
Subject: [PATCH] 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/

Cc Carlos Santos <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
package/coreutils/coreutils.mk | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
package/coreutils/coreutils.mk +0 -0
index 3cb96589f228..33389b6ca730 100644

package/coreutils/coreutils.mk define COREUTILS_CLEANUP · line 118

Quoted 6 lines
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 ../../usr/bin/coreutils $(TARGET_DIR)/usr/sbin/chroot

Since it is a relative symlink it could be just

    ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot

But that's not a critical problem.

Quoted 5 lines

endef

COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_CLEANUP --
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