[arch-projects] [initscripts][PATCH 2/2] arch-tmpfiles: don't try to resolve numeric UIDs/GIDs

Dave Reisner d at falconindy.com
Sun Mar 11 13:17:55 EDT 2012


The whole point of using numeric IDs is to avoid resolution in the
passwd/group databases. If we encounter an ID which is simply numeric,
leave it alone.

Looks like I broke this in a4558c4c trying to be a bit too clever.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 arch-tmpfiles |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch-tmpfiles b/arch-tmpfiles
index 4b12841..8d927de 100755
--- a/arch-tmpfiles
+++ b/arch-tmpfiles
@@ -25,13 +25,19 @@ checkparams() {
 	fi
 
 	# uid must be numeric or a valid user name
-	if [[ $uid ]] && ! getent passwd "$uid" >/dev/null; then
-		return 1
+	# don't try to resolve numeric IDs in case they don't exist
+	if [[ $uid ]]; then
+		if [[ $uid != +([0-9]) ]] && ! getent passwd "$uid" >/dev/null; then
+			return 1
+		fi
 	fi
 
 	# gid must be numeric or a valid group name
-	if [[ $gid ]] && ! getent group "$gid" >/dev/null; then
-		return 1
+	# don't try to resolve numeric IDs in case they don't exist
+	if [[ $gid ]]; then
+		if [[ $gid != +([0-9]) ]] && ! getent group "$gid" >/dev/null; then
+			return 1
+		fi
 	fi
 
 	return 0
-- 
1.7.9.3



More information about the arch-projects mailing list