[oe-commits] [openembedded-core] 48/51: opkg-utils: Fix update-alternatives link relocation

git at git.openembedded.org git at git.openembedded.org
Tue Nov 13 15:19:46 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit f0912e23629758fe4303284e7db8f4089bb7b4cb
Author: Niko Mauno <niko.mauno at iki.fi>
AuthorDate: Mon Nov 12 19:30:08 2018 +0200

    opkg-utils: Fix update-alternatives link relocation
    
    Recently Debian-style support for link relocation was added to
    'update-alternatives' script, but it fails under circumstances where
    host rootfs root directory differs from target rootfs root directory
    and two alternative packages provide a symbolic link with source
    located in different directories.
    
    An example of the case is busybox provided /bin/rev (symlinking to
    /bin/busybox.nosuid) and util-linux provided /usr/bin/rev (symlinking
    to /usr/bin/rev.util-linux) in which case following failure occurs
    during image recipe's do_rootfs() task:
    
      ERROR: core-image-minimal-1.0-r0 do_rootfs: Postinstall scriptlets of ['util-linux'] have failed. If the intention is to defer them to first boot,
      then please place them into pkg_postinst_ontarget_${PN} ().
      Deferring to first boot via 'exit 1' is no longer supported.
      Details of the failure are in .../tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_rootfs.
      ERROR: core-image-minimal-1.0-r0 do_rootfs: Function failed: do_rootfs
    
    Looking in log.do_rootfs file, following relevant lines can be observed:
    
      update-alternatives: renaming rev link from /bin/rev to /usr/bin/rev
      mv: cannot stat '/bin/rev': No such file or directory
    
    Mitigate issue by applying patch which adds target root filesystem root
    directory path prefix to failing 'mv' calls relevant variable references
    
    Signed-off-by: Niko Mauno <niko.mauno at iki.fi>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 ...-alternatives-Fix-link-relocation-support.patch | 40 ++++++++++++++++++++++
 .../opkg-utils/opkg-utils_0.3.6.bb                 |  1 +
 2 files changed, 41 insertions(+)

diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-Fix-link-relocation-support.patch b/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-Fix-link-relocation-support.patch
new file mode 100644
index 0000000..9dc488b
--- /dev/null
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-Fix-link-relocation-support.patch
@@ -0,0 +1,40 @@
+From 18562ccae6996431d37767653b061d4e9e1b9424 Mon Sep 17 00:00:00 2001
+From: Niko Mauno <niko.mauno at iki.fi>
+Date: Sun, 11 Nov 2018 15:50:22 +0200
+Subject: [opkg-utils PATCH] update-alternatives: Fix link relocation support
+
+Commit fcb26339000021eb9bb711aa264247aebcfdd4ae which added Debian-style
+support for link relocation tries to relocate symbolic link on host OS,
+resulting in following-like error when two alternative packages have
+symbolic link source located in different directories (/bin/rev ->
+/bin/busybox.nosuid and /usr/bin/rev -> /usr/bin/rev.util-linux):
+
+  update-alternatives: renaming rev link from /bin/rev to /usr/bin/rev
+  mv: cannot stat '/bin/rev': No such file or directory
+
+Fix the issue by prefixing 'olink' and 'link' variable references with
+path to targeted root filesystem's root directory.
+
+Upstream-Status: Submitted [opkg-utils]
+
+Signed-off-by: Niko Mauno <niko.mauno at iki.fi>
+---
+ update-alternatives | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/update-alternatives b/update-alternatives
+index 89a440b..d4fa7eb 100644
+--- a/update-alternatives
++++ b/update-alternatives
+@@ -58,7 +58,7 @@ register_alt() {
+ 			local link_str=`echo $link | protect_slashes`
+ 			sed -e "1s/.*/$link_str/" $ad/$name > $ad/$name.new
+ 			mv $ad/$name.new $ad/$name
+-			mv $olink $link
++			mv $OPKG_OFFLINE_ROOT$olink $OPKG_OFFLINE_ROOT$link
+ 		fi
+ 	else
+ 		echo "$link" > "$ad/$name"
+-- 
+2.19.1
+
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_0.3.6.bb b/meta/recipes-devtools/opkg-utils/opkg-utils_0.3.6.bb
index cb3775d..4c41774 100644
--- a/meta/recipes-devtools/opkg-utils/opkg-utils_0.3.6.bb
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils_0.3.6.bb
@@ -13,6 +13,7 @@ SRC_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/${BPN}/snapshot/${BPN}-${PV
            file://0002-opkg-build-Use-local-time-for-build_date-since-opkg-.patch \
            file://threaded-xz.patch \
            file://pigz.patch \
+           file://0001-update-alternatives-Fix-link-relocation-support.patch \
 "
 SRC_URI_append_class-native = " file://tar_ignore_error.patch"
 UPSTREAM_CHECK_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/opkg-utils/refs/"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list