diff options
author | Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | 2024-03-18 14:58:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-03-20 18:20:38 +0000 |
commit | 7d530aa4170fe1ce66051c493d17c058d8c48572 (patch) | |
tree | c544388f6ec125509598920e897aaceec11204f7 /meta/recipes-extended/shadow/files | |
parent | 7588fe77a19173c7d2ffccafd11435d5c0cc688b (diff) | |
download | poky-7d530aa4170fe1ce66051c493d17c058d8c48572.tar.gz |
shadow: fix copydir operation with 'pseudo'
Calling 'useradd' through pseudo on (at least) Ubuntu 20 creates
filesystem objects (.bashrc, .profile) with invalid attributes. It
manifests as
| tar: ./home/.../.bashrc: Unknown file type; file ignored
or
| Copying files into the device: __populate_fs: ignoring entry ".bashrc"
| .bashrc: File not found by ext2_lookup while looking up ".bashrc"
when building the image.
This happens due to a bug in shadow which is caused by clobbering
fstatat() results.
(From OE-Core rev: 991f880e5cb3d30a1197711d44af2fdb1719ce82)
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/shadow/files')
-rw-r--r-- | meta/recipes-extended/shadow/files/0001-lib-copydir-copy_entry-use-temporary-stat-buffer.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-extended/shadow/files/0001-lib-copydir-copy_entry-use-temporary-stat-buffer.patch b/meta/recipes-extended/shadow/files/0001-lib-copydir-copy_entry-use-temporary-stat-buffer.patch new file mode 100644 index 0000000000..d278a4cda3 --- /dev/null +++ b/meta/recipes-extended/shadow/files/0001-lib-copydir-copy_entry-use-temporary-stat-buffer.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From af4b8cb780587aa736692a3baa76b60474f19c5d Mon Sep 17 00:00:00 2001 | ||
2 | From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | ||
3 | Date: Mon, 18 Mar 2024 12:14:21 +0100 | ||
4 | Subject: [PATCH] lib/copydir:copy_entry(): use temporary stat buffer | ||
5 | |||
6 | There are no guarantees that fstatat() does not clobber the stat | ||
7 | buffer on errors. | ||
8 | |||
9 | Use a temporary buffer so that the following code sees correct | ||
10 | attributes of the source entry. | ||
11 | |||
12 | Upstream-Status: Submitted [https://github.com/shadow-maint/shadow/pull/974] | ||
13 | |||
14 | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | ||
15 | --- | ||
16 | lib/copydir.c | 3 ++- | ||
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
18 | |||
19 | Index: shadow-4.14.2/lib/copydir.c | ||
20 | =================================================================== | ||
21 | --- shadow-4.14.2.orig/lib/copydir.c | ||
22 | +++ shadow-4.14.2/lib/copydir.c | ||
23 | @@ -415,6 +415,7 @@ static int copy_entry (const struct path | ||
24 | { | ||
25 | int err = 0; | ||
26 | struct stat sb; | ||
27 | + struct stat tmp_sb; | ||
28 | struct link_name *lp; | ||
29 | struct timespec mt[2]; | ||
30 | |||
31 | @@ -436,7 +437,7 @@ static int copy_entry (const struct path | ||
32 | * If the destination already exists do nothing. | ||
33 | * This is after the copy_dir above to still iterate into subdirectories. | ||
34 | */ | ||
35 | - if (fstatat(dst->dirfd, dst->name, &sb, AT_SYMLINK_NOFOLLOW) != -1) { | ||
36 | + if (fstatat(dst->dirfd, dst->name, &tmp_sb, AT_SYMLINK_NOFOLLOW) != -1) { | ||
37 | return 0; | ||
38 | } | ||
39 | |||