https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104454

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-05-28

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> This may not be worth fixing, because AIX realpath is broken anyway

It can't handle paths containing "//":

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

char buf[512];

void realpath_or_bust(const char* s)
{
  const char* p = realpath(s, buf);
  if (p)
    puts(p);
  else
    perror(s);
}

int main()
{
  rmdir("testdir/foo");
  rmdir("testdir");
  mkdir("testdir", S_IRWXU);
  mkdir("testdir/foo", S_IRWXU);
  realpath_or_bust("testdir/foo//..");
  realpath_or_bust("testdir/foo//../foo");
}

This prints:

/home/jwakely/tmp/testdir/foo
testdir/foo//../foo: No such file or directory

Reply via email to