Skip to contentSkip to conversation

pkg-autotools: explicitly use /usr/{bin, sbin, lib}, with merged usr

PATCH New Carlos Santos 3 participants 6 messages Nov 1, 2017 – Nov 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkg-autotools: explicitly use /usr/{bin, sbin, lib}, with merged usr

Prevent packages from using /bin, /sbin or /lib when those paths are symlinks to their /usr counterparts.

This is useful for util-linux, whose installation attempts to move shared libraries from ${usrlib_execdir} to ${libdir} if both paths are not the same, leading to error messages like this:

  mv: '$(TARGET_DIR)/usr/lib/libfoo.so.1' and '$(TARGET_DIR)/lib/libfoo.so.1' are the same file

Fortunalely that error is not fatal but other packages may do similar things with bad results, so let's avoid possible problems.

---
 package/pkg-autotools.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-autotools.mk +1 -0
index 45de99356f..32e76b54c2 100644
@@ -189,6 +189,7 @@ define $(2)_CONFIGURE_CMDS
 		--build=$$(GNU_HOST_NAME) \
 		--prefix=/usr \
 		--exec-prefix=/usr \
+		$$(if $$(BR2_ROOTFS_MERGED_USR),--bindir=/usr/bin --sbindir=/usr/sbin --libdir=/usr/lib,) \
 		--sysconfdir=/etc \
 		--localstatedir=/var \
 		--program-prefix="" \
Signature · 1 line
2.13.6
#1 lore raw

PATCH 1/1 pkg-autotools: explicitly use /usr/{bin, sbin, lib}, with merged usr

Quoted 11 lines · Carlos Santos

Prevent packages from using /bin, /sbin or /lib when those paths are symlinks to their /usr counterparts.

This is useful for util-linux, whose installation attempts to move shared libraries from ${usrlib_execdir} to ${libdir} if both paths are not the same, leading to error messages like this:

  mv: '$(TARGET_DIR)/usr/lib/libfoo.so.1' and '$(TARGET_DIR)/lib/libfoo.so.1' are the same file

Fortunalely that error is not fatal but other packages may do similar things with bad results, so let's avoid possible problems.

Well, since the default for bindir is <exec_prefix>/bin and exec_prefix is
/usr, for most packages this is not going to be an issue. It's only util-linux that overrides it.

Therefore, I don't think this should be done globally, but specifically for
util-linux.

Regards,
Arnout

Quoted 19 lines
---
 package/pkg-autotools.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-autotools.mk +1 -0
index 45de99356f..32e76b54c2 100644
@@ -189,6 +189,7 @@ define $(2)_CONFIGURE_CMDS
 		--build=$$(GNU_HOST_NAME) \
 		--prefix=/usr \
 		--exec-prefix=/usr \
+		$$(if $$(BR2_ROOTFS_MERGED_USR),--bindir=/usr/bin --sbindir=/usr/sbin --libdir=/usr/lib,) \
 		--sysconfdir=/etc \
 		--localstatedir=/var \
 		--program-prefix="" \
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 pkg-autotools: explicitly use /usr/{bin, sbin, lib}, with merged usr

Hello,

Quoted 9 lines · Arnout Vandecappelle
Quoted 2 lines

Fortunalely that error is not fatal but other packages may do similar things with bad results, so let's avoid possible problems.

Well, since the default for bindir is <exec_prefix>/bin and exec_prefix is
/usr, for most packages this is not going to be an issue. It's only util-linux that overrides it.

Therefore, I don't think this should be done globally, but specifically for
util-linux.

I would also be more comfortable to do this just for util-linux, as it's a bit easier to validate the impact/consequences of such a change if it's limited to a single package.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 util-linux: explicitly use /usr/{bin, sbin, lib}, with merged usr

Prevent the installation from attempting to move shared libraries from ${usrlib_execdir} to ${libdir} if both paths are not the same, leading to error messages like this:

  mv: '$(TARGET_DIR)/usr/lib/libfoo.so.1' and '$(TARGET_DIR)/lib/libfoo.so.1' are the same file

That error is not fatal but let's avoid possible future problems.

---
 package/util-linux/util-linux.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/util-linux/util-linux.mk +7 -0
index 8464288600..31a3fe47ab 100644
@@ -41,6 +41,13 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 UTIL_LINUX_DEPENDENCIES += busybox
 endif
 
+# Prevent the installation from attempting to move shared libraries from
+# ${usrlib_execdir} (/usr/lib) to ${libdir} (/lib), since both paths are
+# the same when merged usr is in use.
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
+UTIL_LINUX_CONF_OPTS += --bindir=/usr/bin --sbindir=/usr/sbin --libdir=/usr/lib
+endif
+
 ifeq ($(BR2_PACKAGE_NCURSES),y)
 UTIL_LINUX_DEPENDENCIES += ncurses
 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
Signature · 1 line
2.13.6
#4 lore raw

PATCH 1/1 util-linux: explicitly use /usr/{bin, sbin, lib}, with merged usr

Prevent the installation from attempting to move shared libraries from ${usrlib_execdir} to ${libdir} if both paths are the same, which leads to error messages like this:

  mv: '$(TARGET_DIR)/usr/lib/libfoo.so.1' and '$(TARGET_DIR)/lib/libfoo.so.1' are the same file

That error is not fatal but let's avoid possible future problems.

---
Changes v1->v2:
Fix commit message to remove spurious "not".

---
 package/util-linux/util-linux.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/util-linux/util-linux.mk +7 -0
index 8464288600..31a3fe47ab 100644
@@ -41,6 +41,13 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 UTIL_LINUX_DEPENDENCIES += busybox
 endif
 
+# Prevent the installation from attempting to move shared libraries from
+# ${usrlib_execdir} (/usr/lib) to ${libdir} (/lib), since both paths are
+# the same when merged usr is in use.
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
+UTIL_LINUX_CONF_OPTS += --bindir=/usr/bin --sbindir=/usr/sbin --libdir=/usr/lib
+endif
+
 ifeq ($(BR2_PACKAGE_NCURSES),y)
 UTIL_LINUX_DEPENDENCIES += ncurses
 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
Signature · 1 line
2.13.6
#5 lore raw

PATCH 1/1 util-linux: explicitly use /usr/{bin, sbin, lib}, with merged usr

Hello,

Quoted 8 lines · Carlos Santos

Prevent the installation from attempting to move shared libraries from ${usrlib_execdir} to ${libdir} if both paths are the same, which leads to error messages like this:

  mv: '$(TARGET_DIR)/usr/lib/libfoo.so.1' and '$(TARGET_DIR)/lib/libfoo.so.1' are the same file

That error is not fatal but let's avoid possible future problems.

Quoted 7 lines

---
Changes v1->v2:
Fix commit message to remove spurious "not".

---
 package/util-linux/util-linux.mk | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com