Article View: comp.sys.next.bugs
Article #4Bug in the realpath(3) function
From: Timothy J. Wood
Date: Sun, 27 Dec 1992 10:17
Date: Sun, 27 Dec 1992 10:17
39 lines
1306 bytes
1306 bytes
I believe that the following code exhibits a bug in the NeXT
implementation of the realpath(3) function. I am running NS3.0.
#import <sys/param.h>
#import <stdio.h>
/*
* usage: realpath [filelist]
*/
int main (int argc, char *argv[])
{
char *file_name;
char resolved_name[MAXPATHLEN];
int i = 1;
while (i < argc) {
if (!realpath(argv[i], resolved_name))
perror(argv[i]);
else
puts(resolved_name);
i++;
}
}
The problem involves the clipping of the prefix of some paths, for
example:
% cd /
% realpath tmp
rivate/tmp
% realpath /tmp
/private/tmp
%
Notice that in the first case the leading "/p" was stripped from the
output. This happens in various other cases as well.
Technical Details
Message-ID:
<1992Dec27.101753.16648@u.washington.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!news.u.washington.edu!stein.u.washington.edu!bungiShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!news.u.washington.edu!stein.u.washington.edu!bungi From: bungi@stein.u.washington.edu (Timothy J. Wood) Newsgroups: comp.sys.next.bugs Subject: Bug in the realpath(3) function Message-ID: <1992Dec27.101753.16648@u.washington.edu> Date: 27 Dec 92 10:17:53 GMT Article-I.D.: u.1992Dec27.101753.16648 Sender: news@u.washington.edu (USENET News System) Organization: University of Washington Lines: 39