[openwrt/openwrt] base-files: fix merge of passwd/shadow/group lines with trailing colons

LEDE Commits lede-commits at lists.infradead.org
Thu Aug 29 12:07:24 PDT 2024


neocturne pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/9bbaa6f2c0419739fb85d48d0f527cb1622946ee

commit 9bbaa6f2c0419739fb85d48d0f527cb1622946ee
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Thu Aug 29 20:24:02 2024 +0200

    base-files: fix merge of passwd/shadow/group lines with trailing colons
    
    Empty trailing fields get lost when the lines are split and merged again
    at colons, resulting in unparsable entries. Only use the split fields for
    matching against the other file, but emit the original line unchanged
    to fix the issue.
    
    Fixes: de7ca7dafadf ("base-files: merge /etc/passwd et al at sysupgrade config restore")
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 package/base-files/files/lib/preinit/80_mount_root | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root
index fa6abcde57..940c56c925 100644
--- a/package/base-files/files/lib/preinit/80_mount_root
+++ b/package/base-files/files/lib/preinit/80_mount_root
@@ -9,7 +9,7 @@ missing_lines() {
 	IFS=":"
 	while read line; do
 		set -- $line
-		grep -q "^$1:" "$file2" || echo "$*"
+		grep -q "^$1:" "$file2" || echo "$line"
 	done < "$file1"
 	IFS="$oIFS"
 }




More information about the lede-commits mailing list