summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2012-11-16 18:05:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-11-18 16:42:10 +0000
commit527735d13681a7a9fbf250eff3b1a65ad30d9ab5 (patch)
tree26fae8b60c3aa509c547bf6bcabd8837e9edffb5 /meta
parent5a9b80bbb173408de779d74936a2f7050d6a6c19 (diff)
downloadpoky-527735d13681a7a9fbf250eff3b1a65ad30d9ab5.tar.gz
opkg: added alternatives-ln patch
Use 'ln -n' to avoid dereferencing links to host files. (From OE-Core rev: e5aef500e11cbf7d1cd20b588fcea2c5fd6b5d0e) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/opkg/opkg/alternatives-ln.patch56
-rw-r--r--meta/recipes-devtools/opkg/opkg_svn.bb3
2 files changed, 58 insertions, 1 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/alternatives-ln.patch b/meta/recipes-devtools/opkg/opkg/alternatives-ln.patch
new file mode 100644
index 0000000000..f257eb0e1c
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/alternatives-ln.patch
@@ -0,0 +1,56 @@
1update-alternatives: use 'ln -n'
2
3Using the '-n' option (--no-dereference) is a better way to solve the
4do-not-link-into-directory issue. Using only 'ln -sf' can cause problems
5on SELinux enabled hosts when target is inaccessible; e.g. when preparing
6an offline rootsystem:
7
8 | $ cd <offline root>
9 | $ ln -sf /lib/systemd/systemd sbin/init # alternative #1
10 | $ ln -sf /bin/busybox sbin/init # alternative #2
11 | ln: accessing `sbin/init': Permission denied
12 |
13 | --> strace:
14 | brk(0) = 0x102b000
15 | stat("sbin/init", 0x7fffaa91c900) = -1 EACCES (Permission denied)
16 | ...
17 | exit_group(1) = ?
18
19Now with '-n':
20
21 | $ ln -snf /bin/busybox sbin/init
22 | lstat("sbin/init", {st_mode=S_IFLNK|0777, st_size=20, ...}) = 0
23 | lstat("sbin/init", {st_mode=S_IFLNK|0777, st_size=20, ...}) = 0
24 | stat("/bin/busybox", 0x7fff8c1a3bd0) = -1 ENOENT (No such file or directory)
25 | symlink("/bin/busybox", "sbin/init") = -1 EEXIST (File exists)
26 | unlink("sbin/init") = 0
27 | symlink("/bin/busybox", "sbin/init") = 0
28
29
30The '-n' flag is well supported (coreutils have it at least since
311999, busybox at least since 0.60.3 (2002)) and it obsoletes the
32explicit check whether target is a directory.
33
34Upstream-Status: pending [http://code.google.com/p/opkg/issues/detail?id=95]
35Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
36
37Index: trunk/utils/update-alternatives.in
38===================================================================
39--- trunk.orig/utils/update-alternatives.in
40+++ trunk/utils/update-alternatives.in
41@@ -113,14 +113,7 @@ find_best_alt() {
42 if [ ! -d $link_dir ]; then
43 mkdir -p $link_dir
44 fi
45- if [ -h $link -a -d $link ]; then
46- # If $link exists and the target is a directory,
47- # 'ln -sf $path $link' doesn't replace the link to
48- # that directory, it creates new link inside.
49- echo "update-alternatives: Removing $link".
50- rm -f $link
51- fi
52- ln -sf $path $link
53+ ln -snf $path $link
54 echo "update-alternatives: Linking $link to $path"
55 else
56 echo "update-alternatives: Error: not linking $link to $path since $link exists and is not a link"
diff --git a/meta/recipes-devtools/opkg/opkg_svn.bb b/meta/recipes-devtools/opkg/opkg_svn.bb
index e1049a71de..064cf43af1 100644
--- a/meta/recipes-devtools/opkg/opkg_svn.bb
+++ b/meta/recipes-devtools/opkg/opkg_svn.bb
@@ -12,6 +12,7 @@ SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;protocol=http \
12 file://0009-pkg_depends-fix-version-constraints.patch \ 12 file://0009-pkg_depends-fix-version-constraints.patch \
13 file://0010-pkg_depends-fix-version_constraints_satisfied.patch \ 13 file://0010-pkg_depends-fix-version_constraints_satisfied.patch \
14 file://opkg-no-sync-offline.patch \ 14 file://opkg-no-sync-offline.patch \
15 file://alternatives-ln.patch \
15 file://don-t-add-recommends-pkgs-to-depended-upon-by.patch \ 16 file://don-t-add-recommends-pkgs-to-depended-upon-by.patch \
16 file://don-t-print-provides-if-nothing-is-provided.patch \ 17 file://don-t-print-provides-if-nothing-is-provided.patch \
17" 18"
@@ -21,4 +22,4 @@ S = "${WORKDIR}/trunk"
21SRCREV = "633" 22SRCREV = "633"
22PV = "0.1.8+svnr${SRCPV}" 23PV = "0.1.8+svnr${SRCPV}"
23 24
24PR = "${INC_PR}.8" 25PR = "${INC_PR}.9"