public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation
@ 2006-10-26  5:38 lemke_juergen at yahoo dot de
  2006-10-26  7:13 ` [Bug libc/3426] " jakub at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lemke_juergen at yahoo dot de @ 2006-10-26  5:38 UTC (permalink / raw)
  To: glibc-bugs

In GNU libc 2.3.5, the header file /usr/lib/stdlib.h reads:

#ifdef  __USE_GNU                                                               
/* Return a malloc'd string containing the canonical absolute name of the       
   named file.  The last file name component need not exist, and may be a       
   symlink to a nonexistent file.  */                                           
extern char *canonicalize_file_name (__const char *__name)                      
     __THROW __nonnull ((1));                                                   
#endif                            


However, canonicalize_file_name() returns NULL when passed a path where the last
component does not exist.

// file: can-test.c

#define _GNU_SOURCE                                                             
#include <stdlib.h>                                                             
#include <stdio.h>                                                              

int main(void)                                                                  
{                                                                               
   char *p = canonicalize_file_name("no-such-file");                            
                                                                                
   if (!p)                                                                      
     perror(NULL);                                                              
                                                                                
   return 0;                                                                    
}

The same applies to realpath() and its description. As of version 2.3.5, either
the documentation or the implementation is wrong.

Best

Juergen Lemke

-- 
           Summary: canonicalize_file_name's behavior differs from
                    documentation
           Product: glibc
           Version: 2.3.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: lemke_juergen at yahoo dot de
                CC: glibc-bugs at sources dot redhat dot com,lemke_juergen
                    at yahoo dot de


http://sourceware.org/bugzilla/show_bug.cgi?id=3426

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/3426] canonicalize_file_name's behavior differs from documentation
  2006-10-26  5:38 [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation lemke_juergen at yahoo dot de
@ 2006-10-26  7:13 ` jakub at redhat dot com
  2006-10-26 20:13 ` lemke_juergen at yahoo dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at redhat dot com @ 2006-10-26  7:13 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2006-10-26 07:13 -------
__nonnull ((1)) means that the first argument must not be NULL, not that
the function can't return NULL.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=3426

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/3426] canonicalize_file_name's behavior differs from documentation
  2006-10-26  5:38 [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation lemke_juergen at yahoo dot de
  2006-10-26  7:13 ` [Bug libc/3426] " jakub at redhat dot com
@ 2006-10-26 20:13 ` lemke_juergen at yahoo dot de
  2006-10-26 21:16 ` ldv at altlinux dot org
  2006-10-27 18:47 ` drepper at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: lemke_juergen at yahoo dot de @ 2006-10-26 20:13 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From lemke_juergen at yahoo dot de  2006-10-26 20:13 -------
Hello,

jakub at redhat dot com wrote:

> __nonnull ((1)) means that the first argument must
> not be NULL, not that
> the function can't return NULL.

That is not what I was referring to. Just above the declaration of
canonicalize_file_name() you can read:

"The last file name component need not exist [...]"

However, as of GNU libc 2.3.5, this function always fails (returning NULL) when
passed a path to a inexistent file.

Best,

Juergen

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


http://sourceware.org/bugzilla/show_bug.cgi?id=3426

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/3426] canonicalize_file_name's behavior differs from documentation
  2006-10-26  5:38 [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation lemke_juergen at yahoo dot de
  2006-10-26  7:13 ` [Bug libc/3426] " jakub at redhat dot com
  2006-10-26 20:13 ` lemke_juergen at yahoo dot de
@ 2006-10-26 21:16 ` ldv at altlinux dot org
  2006-10-27 18:47 ` drepper at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ldv at altlinux dot org @ 2006-10-26 21:16 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ldv at altlinux dot org  2006-10-26 21:16 -------
As of glibc HEAD, stdlib/stdlib.h really contains wrong comments about
canonicalize_file_name() and realpath().  The comment in stdlib/canonicalize.c
is correct, though.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3426

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/3426] canonicalize_file_name's behavior differs from documentation
  2006-10-26  5:38 [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation lemke_juergen at yahoo dot de
                   ` (2 preceding siblings ...)
  2006-10-26 21:16 ` ldv at altlinux dot org
@ 2006-10-27 18:47 ` drepper at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2006-10-27 18:47 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-10-27 18:47 -------
I adjusted the comment.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=3426

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-27 18:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-26  5:38 [Bug libc/3426] New: canonicalize_file_name's behavior differs from documentation lemke_juergen at yahoo dot de
2006-10-26  7:13 ` [Bug libc/3426] " jakub at redhat dot com
2006-10-26 20:13 ` lemke_juergen at yahoo dot de
2006-10-26 21:16 ` ldv at altlinux dot org
2006-10-27 18:47 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).