Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: Aleksandar Milivojevic <alex@srce.hr>
Subject: realpath function seems to be broken
Date: 1997/01/26	[thread overview]
Message-ID: <glvi8k1lxg.fsf@bjesomar.srce.hr> (raw)


realpath function in Digital UNIX 4.0a seem to be broken. Sometimes it
fails to resolve symbolic links. For example, the following program:

===== 8< Begin: a.c 8< =====
#include <stdio.h>
#include <stdlib.h>

main(int argc, char **argv)
{
   char a[50];
   
   if (realpath(argv[1], a))
      printf("Resolved `%s' to `%s'.\n", argv[1], a);
   else {
      perror("realpath");
      printf("Failed to resolve `%s' (returned `%s').\n", argv[1], a);
   }
}
===== 8< End: a.c 8< =====

when comiled with "cc a.c" gives:

== 8< == 8< == 8< == 8< ==
bjesomar$ ls -ld /bin /var/spool /usr/spool
lrwxrwxrwx   1 root     system         7 Aug 27 19:22 /bin -> usr/bin
lrwxrwxrwx   1 root     system        12 Aug 27 19:26 /usr/spool -> ../var/spool
drwxr-xr-x   8 root     system      8192 Nov 24 16:54 /var/spool
bjesomar$ ./a.out /bin
Resolved `/bin' to `/usr/bin'.
bjesomar$ ./a.out /usr/spool
realpath: No such file or directory
Failed to resolve `/usr/spool' (returned `var').
bjesomar$ ./a.out /var/spool
Resolved `/var/spool' to `/var/spool'.
== 8< == 8< == 8< == 8< ==

If anybody noticed that (s)he can't read e-mail with Gnus in XEmacs,
well, the buggy OSF realpath is to be blamed...

-- 
Aleksandar Milivojeviďż˝                        http://jagor.srce.hr/~alex/
                           e-mail: alex@srce.hr
================================ooooO=Ooooo==============================
        "I believe OS/2 is destined to be the most important
         operating system, and possibly program, of all time."
                   -- Bill Gates, OS/2 Programmer's Guide foreward, 1987



                 reply	other threads:[~1997-01-26  5:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox