summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxin B. John <maxin.john@intel.com>2016-04-21 12:24:07 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-22 16:28:57 +0100
commit2755304a7dedf0bf07346c7c8a247b040313071a (patch)
treeaf9b95c9f963bd5d199f11390d273381f2030eb7
parent7da7587da1e920fcc67404ea34e915c93352eed6 (diff)
downloadpoky-2755304a7dedf0bf07346c7c8a247b040313071a.tar.gz
busybox: update flock behavior to match upstream
In "util-linux" implementation of flock, -c 'PROG ARGS' means run "sh -c 'PROG ARGS'". At present, busybox implementation doesn't follow it. That causes errors like the one listed below: smart install /media/cronie-1.5.0-r0.core2_64.rpm Updating cache... <snip> Output from cronie-1.5.0-r0@core2_64: Running groupadd commands... NOTE: cronie: Performing groupadd with [ --system crontab] ERROR: cronie: groupadd command did not succeed. error: %pre(cronie-1.5.0-r0.core2_64) scriptlet failed, exit status 1 error: install: %pre scriptlet failed (2), skipping cronie-1.5.0-r0.core2_64 This is because we use flock command in preinstall scripts in packages which create new groups/users. [YOCTO #9496] (From OE-Core rev: 84686b51043c5a6b0ae184d00f547ccbd7832f39) Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch73
-rw-r--r--meta/recipes-core/busybox/busybox_1.24.1.bb1
2 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch b/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
new file mode 100644
index 0000000000..8bcbd73de9
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
@@ -0,0 +1,73 @@
1From 198f18addf1d814c2fefcb492f3b9fbd221669bb Mon Sep 17 00:00:00 2001
2From: "Maxin B. John" <maxin.john@intel.com>
3Date: Wed, 20 Apr 2016 18:24:45 +0300
4Subject: [PATCH] flock: update the behaviour of -c parameter to match upstream
5
6In upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'"
7
8function old new delta
9flock_main 286 377 +91
10.rodata 155849 155890 +41
11
12Upstream-Status: Submitted
13[ http://lists.busybox.net/pipermail/busybox/2016-April/084142.html ]
14
15Signed-off-by: Maxin B. John <maxin.john@intel.com>
16---
17 util-linux/flock.c | 20 ++++++++++++++------
18 1 file changed, 14 insertions(+), 6 deletions(-)
19
20diff --git a/util-linux/flock.c b/util-linux/flock.c
21index 05a747f..c85a25d 100644
22--- a/util-linux/flock.c
23+++ b/util-linux/flock.c
24@@ -20,6 +20,7 @@ int flock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
25 int flock_main(int argc UNUSED_PARAM, char **argv)
26 {
27 int mode, opt, fd;
28+ char *cmd_args[4];
29 enum {
30 OPT_s = (1 << 0),
31 OPT_x = (1 << 1),
32@@ -57,7 +58,6 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
33 /* If it is "flock FILE -c PROG", then -c isn't caught by getopt32:
34 * we use "+" in order to support "flock -opt FILE PROG -with-opts",
35 * we need to remove -c by hand.
36- * TODO: in upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'"
37 */
38 if (argv[0]
39 && argv[0][0] == '-'
40@@ -65,7 +65,10 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
41 || (ENABLE_LONG_OPTS && strcmp(argv[0] + 1, "-command") == 0)
42 )
43 ) {
44- argv++;
45+ if (argc != optind + 3)
46+ bb_error_msg_and_die("-c requires exactly one command argument");
47+ else
48+ argv++;
49 }
50
51 if (OPT_s == LOCK_SH && OPT_x == LOCK_EX && OPT_n == LOCK_NB && OPT_u == LOCK_UN) {
52@@ -89,9 +92,14 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
53 return EXIT_FAILURE;
54 bb_perror_nomsg_and_die();
55 }
56-
57- if (argv[0])
58- return spawn_and_wait(argv);
59-
60+ if (argv[0]) {
61+ cmd_args[0] = getenv("SHELL");
62+ if (!cmd_args[0])
63+ cmd_args[0] = (char*)DEFAULT_SHELL;
64+ cmd_args[1] = (char*)"-c";
65+ cmd_args[2] = argv[0];
66+ cmd_args[3] = NULL;
67+ return spawn_and_wait(cmd_args);
68+ }
69 return EXIT_SUCCESS;
70 }
71--
722.4.0
73
diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb
index bdaa5a5640..f699f993b5 100644
--- a/meta/recipes-core/busybox/busybox_1.24.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.24.1.bb
@@ -32,6 +32,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
32 file://busybox-1.24.1-unzip.patch \ 32 file://busybox-1.24.1-unzip.patch \
33 file://busybox-1.24.1-unzip-regression.patch \ 33 file://busybox-1.24.1-unzip-regression.patch \
34 file://busybox-1.24.1-truncate-open-mode.patch \ 34 file://busybox-1.24.1-truncate-open-mode.patch \
35 file://0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch \
35 file://mount-via-label.cfg \ 36 file://mount-via-label.cfg \
36 file://sha1sum.cfg \ 37 file://sha1sum.cfg \
37 file://sha256sum.cfg \ 38 file://sha256sum.cfg \