diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2011-02-03 20:40:40 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 16:52:41 +0000 |
commit | 522d16a70fb2f1ad922a4cac8d63f1dddc61ba8d (patch) | |
tree | 6507437450798a9759bbac328b298b00a9e41477 /meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch | |
parent | 427472e980cd6254a5e4ef37209b327e15af259b (diff) | |
download | poky-522d16a70fb2f1ad922a4cac8d63f1dddc61ba8d.tar.gz |
coreutils: Add various bug fixes
Add a number of bug fixes, mostly imported from Fedora and Wind River
Linux.
cp-i-u: fix unnecessary prompting
fix-install: Fix installing to a dangling symlink
i18n: li18nux/lsb compliance
ls-x: Fix incorrect output
overflow: Fix potential overflow in who command
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch')
-rw-r--r-- | meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch new file mode 100644 index 0000000000..1b989f5311 --- /dev/null +++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | The install command doesn't over write the dangling symlink, for | ||
2 | example: | ||
3 | |||
4 | $ install fileA /tmp/fileA | ||
5 | |||
6 | If /tmp/fileA is a dangling symlink, there would be an error: | ||
7 | |||
8 | install: cannot create regular file '/tmp/fileA': File exists | ||
9 | |||
10 | This is because of the following code in copy.c: | ||
11 | |||
12 | if (!new_dst) | ||
13 | { | ||
14 | if (XSTAT (x, dst_name, &dst_sb) != 0) | ||
15 | { | ||
16 | if (errno != ENOENT) | ||
17 | { | ||
18 | error (0, errno, _("cannot stat %s"), quote (dst_name)); | ||
19 | return false; | ||
20 | } | ||
21 | else | ||
22 | { | ||
23 | new_dst = true; | ||
24 | } | ||
25 | } | ||
26 | |||
27 | XSTAT() use stat() for dst_name(the dangling symlink /tmp/fileA) when | ||
28 | install.c invokes it, and stat will set errno to ENOENT, and then | ||
29 | new_dst will be set to true which means that /tmp/fileA doesn't exist, | ||
30 | then we will create /tmp/fileA without remove it first, so the error | ||
31 | comes. | ||
32 | |||
33 | This is fixed in a way which adds the member cmd_install in | ||
34 | struct cp_options to make sure my change only affected to the install | ||
35 | command and use lstat to fix the problem. | ||
36 | |||
37 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
38 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
39 | |||
40 | --- | ||
41 | src/copy.c | 10 +++++++++- | ||
42 | src/copy.h | 3 +++ | ||
43 | src/install.c | 1 + | ||
44 | 3 files changed, 13 insertions(+), 1 deletions(-) | ||
45 | |||
46 | diff --git a/src/copy.c b/src/copy.c | ||
47 | --- a/src/copy.c | ||
48 | +++ b/src/copy.c | ||
49 | @@ -1029,6 +1029,7 @@ copy_internal (char const *src_name, char const *dst_name, | ||
50 | bool delayed_ok; | ||
51 | bool copied_as_regular = false; | ||
52 | bool preserve_metadata; | ||
53 | + int dst_stat_result; | ||
54 | |||
55 | if (x->move_mode && rename_succeeded) | ||
56 | *rename_succeeded = false; | ||
57 | @@ -1069,7 +1070,14 @@ copy_internal (char const *src_name, char const *dst_name, | ||
58 | |||
59 | if (!new_dst) | ||
60 | { | ||
61 | - if (XSTAT (x, dst_name, &dst_sb) != 0) | ||
62 | + if ( x->cmd_install && ( x->backup_type == no_backups)) | ||
63 | + dst_stat_result = lstat (dst_name, &dst_sb); | ||
64 | + else | ||
65 | + { | ||
66 | + dst_stat_result = XSTAT (x, dst_name, &dst_sb); | ||
67 | + } | ||
68 | + | ||
69 | + if (dst_stat_result != 0) | ||
70 | { | ||
71 | if (errno != ENOENT) | ||
72 | { | ||
73 | diff --git a/src/copy.h b/src/copy.h | ||
74 | --- a/src/copy.h | ||
75 | +++ b/src/copy.h | ||
76 | @@ -114,6 +114,9 @@ struct cp_options | ||
77 | If that fails, then resort to copying. */ | ||
78 | bool move_mode; | ||
79 | |||
80 | + /* For the install command */ | ||
81 | + bool cmd_install; | ||
82 | + | ||
83 | /* Whether this process has appropriate privileges to chown a file | ||
84 | whose owner is not the effective user ID. */ | ||
85 | bool chown_privileges; | ||
86 | diff --git a/src/install.c b/src/install.c | ||
87 | --- a/src/install.c | ||
88 | +++ b/src/install.c | ||
89 | @@ -149,6 +149,7 @@ cp_option_init (struct cp_options *x) | ||
90 | x->hard_link = false; | ||
91 | x->interactive = I_UNSPECIFIED; | ||
92 | x->move_mode = false; | ||
93 | + x->cmd_install = true; | ||
94 | x->chown_privileges = chown_privileges (); | ||
95 | x->one_file_system = false; | ||
96 | x->preserve_ownership = false; | ||
97 | -- | ||
98 | 1.7.0.1 | ||
99 | |||