Skip to contentSkip to conversation

classes: Fix sed command line for passwd-expire

PATCH New [email protected] 1 participant 2 messages Nov 21, 2023

lore
Share & tools
lore
#0 lore raw

cover classes: Fix sed command line for passwd-expire

From: Adam Johnston <[email protected]>

Fixes a regression in passwd-expire, caused by a typo/syntax error when the follow-symlinks option was added to useradd_base.bbclass

Adam Johnston (1):
classes: Fix sed command line for passwd-expire

 meta/classes/useradd_base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#1 lore raw

PATCH 1/1 classes: Fix sed command line for passwd-expire

From: Adam Johnston <[email protected]>

A previous commit tried to add the --follow-symlinks option to the perform_passwd_expire function in useradd_base.bbclass, however it used a single -.

This is interpreted as --file=ollow-symlinks which results in...

sed: couldn't open file ollow-symlinks: No such file or directory

and...

ERROR: <image name>: passwd --expire operation did not succeed.

Fix by adding the missing -

(From OE-Core rev: 4d6c63a56c50536806b21cbe72416d8f1b84f589)

---
 meta/classes/useradd_base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/useradd_base.bbclass +1 -1
index f1a7a9695d..5e1c699118 100644
@@ -160,7 +160,7 @@ perform_passwd_expire () {
 	local username=`echo "$opts" | awk '{ print $NF }'`
 	local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
 	if test "x$user_exists" != "x"; then
-		eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO sed -follow-symlinks -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true
+		eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO sed --follow-symlinks -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true
 		local passwd_lastchanged="`grep "^$username:" $rootdir/etc/shadow | cut -d: -f3`"
 		if test "x$passwd_lastchanged" != "x0"; then
 			bbfatal "${PN}: passwd --expire operation did not succeed."