diff options
author | Joakim Tjernlund <joakim.tjernlund@infinera.com> | 2023-11-14 14:28:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-20 15:30:52 +0000 |
commit | a2ea2cb8d92b56bfd4a0d8803592eb507c6bd4b4 (patch) | |
tree | 4e71e2310e3fac2c4e0443f00c9836cc90ee43ee /meta/classes/useradd_base.bbclass | |
parent | 35fa9488cb768bb6d94f69268678e3d5b61dd237 (diff) | |
download | poky-a2ea2cb8d92b56bfd4a0d8803592eb507c6bd4b4.tar.gz |
sed -i destroys symlinks
If /etc/passwd is a symlink, sed -i on same file will replace the
symlink with a new file. Prevent that by adding --follow-symlinks
option to sed
(From OE-Core rev: 6ec004b2e7b4342465af8e5e6cc66041834821a0)
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/useradd_base.bbclass')
-rw-r--r-- | meta/classes/useradd_base.bbclass | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/useradd_base.bbclass b/meta/classes/useradd_base.bbclass index 863cb7b76c..f1a7a9695d 100644 --- a/meta/classes/useradd_base.bbclass +++ b/meta/classes/useradd_base.bbclass | |||
@@ -160,7 +160,7 @@ perform_passwd_expire () { | |||
160 | local username=`echo "$opts" | awk '{ print $NF }'` | 160 | local username=`echo "$opts" | awk '{ print $NF }'` |
161 | local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`" | 161 | local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`" |
162 | if test "x$user_exists" != "x"; then | 162 | if test "x$user_exists" != "x"; then |
163 | eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO sed -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true | 163 | eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO sed -follow-symlinks -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true |
164 | local passwd_lastchanged="`grep "^$username:" $rootdir/etc/shadow | cut -d: -f3`" | 164 | local passwd_lastchanged="`grep "^$username:" $rootdir/etc/shadow | cut -d: -f3`" |
165 | if test "x$passwd_lastchanged" != "x0"; then | 165 | if test "x$passwd_lastchanged" != "x0"; then |
166 | bbfatal "${PN}: passwd --expire operation did not succeed." | 166 | bbfatal "${PN}: passwd --expire operation did not succeed." |