]> Savannah Git Hosting - gnulib.git/commitdiff
test-userspec: don't look up numeric user names
authorJim Meyering <meyering@fb.com>
Fri, 18 Jul 2014 21:16:44 +0000 (14:16 -0700)
committerJim Meyering <meyering@fb.com>
Sat, 19 Jul 2014 00:00:12 +0000 (17:00 -0700)
* tests/test-userspec.c: I found a system for which getpwnam("0")
returned a pointer to a non-root user's entry, and that made the
test fail.
(T): Prefix each numeric input with "+", to inhibit lookup.

ChangeLog
tests/test-userspec.c

index 94e5b84025778559d6e71099df4c58b545f0dc93..cd702dd548f6a872e87bb741cc0d754b67c93c8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-07-18  Jim Meyering  <meyering@fb.com>
+
+       test-userspec: don't look up numeric user names
+       * tests/test-userspec.c: I found a system for which getpwnam("0")
+       returned a pointer to a non-root user's entry, and that made the
+       test fail.
+       (T): Prefix each numeric input with "+", to inhibit lookup.
+
 2014-07-15  Eli Zaretskii  <eliz@gnu.org>
 
        localcharset, localename: MS-Windows support for non-default locales
index 437049c473baefa0b40a22b10c9e79196fae0854..528107da67668e3444b204e4b0231b6f3f7e899e 100644 (file)
@@ -45,30 +45,30 @@ struct test
 
 static struct test T[] =
   {
-    { "",                      -1, -1, "",   "",   NULL},
-    { ":",                     -1, -1, "",   "",   NULL},
-    { "0:0",                    0,  0, "",   "",   NULL},
-    { ":1",                    -1,  1, "",   "",   NULL},
-    { "1",                      1, -1, "",   "",   NULL},
-    { ":+0",                   -1,  0, "",   "",   NULL},
-    { "22:42",                 22, 42, "",   "",   NULL},
+    { "",                       -1, -1, "",   "",   NULL},
+    { ":",                      -1, -1, "",   "",   NULL},
+    { "+0:+0",                   0,  0, "",   "",   NULL},
+    { ":+1",                    -1,  1, "",   "",   NULL},
+    { "+1",                      1, -1, "",   "",   NULL},
+    { ":+0",                    -1,  0, "",   "",   NULL},
+    { "+22:+42",                22, 42, "",   "",   NULL},
     /* (uint32_t)-1 should be invalid everywhere */
-    { "4294967295:4294967295",  0,  0, NULL, NULL, "invalid user"},
+    { "+4294967295:+4294967295", 0,  0, NULL, NULL, "invalid user"},
     /* likewise, but with only the group being invalid */
-    { "0:4294967295",           0,  0, NULL, NULL, "invalid group"},
-    { ":4294967295",            0,  0, NULL, NULL, "invalid group"},
+    { "+0:+4294967295",          0,  0, NULL, NULL, "invalid group"},
+    { ":+4294967295",            0,  0, NULL, NULL, "invalid group"},
     /* and only the user being invalid */
-    { "4294967295:0",           0,  0, NULL, NULL, "invalid user"},
+    { "+4294967295:+0",          0,  0, NULL, NULL, "invalid user"},
     /* and using 2^32 */
-    { "4294967296:4294967296",  0,  0, NULL, NULL, "invalid user"},
-    { "0:4294967296",           0,  0, NULL, NULL, "invalid group"},
-    { ":4294967296",            0,  0, NULL, NULL, "invalid group"},
-    { "4294967296:0",           0,  0, NULL, NULL, "invalid user"},
+    { "+4294967296:+4294967296", 0,  0, NULL, NULL, "invalid user"},
+    { "+0:+4294967296",          0,  0, NULL, NULL, "invalid group"},
+    { ":+4294967296",            0,  0, NULL, NULL, "invalid group"},
+    { "+4294967296:+0",          0,  0, NULL, NULL, "invalid user"},
     /* numeric user and no group is invalid */
-    { "4294967295:",            0,  0, NULL, NULL, "invalid spec"},
-    { "4294967296:",            0,  0, NULL, NULL, "invalid spec"},
-    { "1:",                     0,  0, NULL, NULL, "invalid spec"},
-    { "+0:",                    0,  0, NULL, NULL, "invalid spec"},
+    { "+4294967295:",            0,  0, NULL, NULL, "invalid spec"},
+    { "+4294967296:",            0,  0, NULL, NULL, "invalid spec"},
+    { "+1:",                     0,  0, NULL, NULL, "invalid spec"},
+    { "+0:",                     0,  0, NULL, NULL, "invalid spec"},
 
     /* "username:" must expand to UID:GID where GID is username's login group */
     /* Add an entry like the following to the table, if possible.