[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] canonicalize.c and realpath
From: |
Dmitry V. Levin |
Subject: |
Re: [bug-gnulib] canonicalize.c and realpath |
Date: |
Tue, 5 Apr 2005 01:58:00 +0400 |
Hi,
On Mon, Apr 04, 2005 at 10:15:32AM -0700, Paul Eggert wrote:
> address@hidden (Eric Blake) writes:
>
> > Should we also add a realpath module to provide realpath on systems
> > that don't have it?
>
> That sounds reasonable. canonicalize could then use it.
>
> Any gnulib realpath should support a 2nd argument being NULL, and
> should malloc the path in that case, even on systems where the native
> realpath doesn't support this common extension to POSIX. This will
> simplify usage.
Glibc documentation also says that a call to realpath(3) where 2nd
parameter is NULL behaves exactly like canonicalize_file_name().
So any gnulib realpath implementaton should reproduce this behaviour.
> Also, gnulib realpath shouldn't have the property that SunOS 5.5.1
> realpath does -- this implementation uses chdir() and can fail to
> return to the current directory if an error occurs. That's a real
> no-no.
>
> Ideally, gnulib realpath should also do the right thing even if the
> system realpath would fail and return ENAMETOOLONG due to the result
> being too long. This may be a bit harder to arrange reliably, though.
BTW, current gnulib's canonicalize_* implementations use lstat(2) which
may return ENAMETOOLONG on some systems.
--
ldv
pgpCDgVkkcOpr.pgp
Description: PGP signature