On Wednesday 07 May 2008 21:06, Denys Vlasenko wrote:
> Tests 14 and 15 say in source:
> 
>   /* 10 */
>   {"./doesExist/../doesExist",          "./doesExist"},
>   {"foobar",                            0, "./foobar", ENOENT},
>   {".",                                 "."},
>   {"./foobar",                          0, "./foobar", ENOENT},
> #ifdef __UCLIBC__
>   /* we differ from glibc here, but POSIX allows it as it says that if we did
>    * not successfuly complete, the value of resolved_path is undefined */
>   {"SYMLINK_LOOP",                      0, "", ELOOP},
>   /* 15 */
>   {"./SYMLINK_LOOP",                    0, "", ELOOP},
> #else
> 
> I can make it work so that test passes. However, as this comment says,
> POSIX says nothing about return buffer's contents, so alternative
> fix would be to not check its contents, only return value and errno.
> 
> Do you want me to make readlink return ""

which can be done this way:

                /* Protect against infinite loops. */
                if (readlinks++ > MAX_READLINKS) {
                        __set_errno(ELOOP);
+                       got_path[0] = '\0';
                        return NULL;
                }



> or to stop testing buffer's contents?

this way:

--- test-canon-old.c    Wed May  7 21:22:49 2008
+++ test-canon.c        Wed May  7 21:25:14 2008
@@ -72,17 +72,9 @@
   {"foobar",                           0, "./foobar", ENOENT},
   {".",                                        "."},
   {"./foobar",                         0, "./foobar", ENOENT},
-#ifdef __UCLIBC__
-  /* we differ from glibc here, but POSIX allows it as it says that if we did
-   * not successfuly complete, the value of resolved_path is undefined */
-  {"SYMLINK_LOOP",                     0, "", ELOOP},
+  {"SYMLINK_LOOP",                     0, 0, ELOOP},
   /* 15 */
-  {"./SYMLINK_LOOP",                   0, "", ELOOP},
-#else
-  {"SYMLINK_LOOP",                     0, "./SYMLINK_LOOP", ELOOP},
-  /* 15 */
-  {"./SYMLINK_LOOP",                   0, "./SYMLINK_LOOP", ELOOP},
-#endif
+  {"./SYMLINK_LOOP",                   0, 0, ELOOP},
   {"SYMLINK_1",                                "."},
   {"SYMLINK_1/foobar",                 0, "./foobar", ENOENT},
   {"SYMLINK_2",                                "/etc"},
@@ -191,7 +183,8 @@
          continue;
        }
 
-      if (!check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
+      if ((tests[i].out || tests[i].resolved)
+       && !check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
        {
          printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n",
                  argv[0], i, tests[i].out ? tests[i].out : tests[i].resolved,


> Your pick. 

--
vda
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to