[pacman-dev] RootDir using symlinks -> problem

Xavier shiningxc at gmail.com
Sat Sep 29 17:37:47 EDT 2007

On Sat, Sep 29, 2007 at 04:09:46PM -0500, Dan McGee wrote:
> On 9/29/07, Xavier <shiningxc at gmail.com> wrote:
> > 2007/9/29, Xavier <shiningxc at gmail.com>:
> > >
> > > Running pacman -v with this config gives the following :
> > > Root      : /data/share/devel/pacman/pacman/foo/
> > > DB Path   : /home/xav/pacman/pacman/foo/var/lib/pacman/
> > >
> >
> > That's because the alpm_option_set_root function in libalpm/trans.c
> > calls realpath.
> > So should realpath be called for the other paths as well? At least for db path?
> We should definitely be consistent across the board with these path resolvers.
> Are there any disadvantages to always using realpath?

I don't know, but I also think consistency is the most important.
So either use realpath for all paths, or not use it at all.

The comment in libalpm code just before realpath is used apparently refers to
the manpage of realpath, which says this :

       Avoid  using  this  function.   It is broken by design since (unless using the non-standard resolved_path == NULL feature) it is impossible to determine a suitable size for the output
       buffer, resolved_path.  According to POSIX a buffer of size PATH_MAX suffices, but PATH_MAX need not be a defined constant, and may have to be obtained using pathconf(3).  And  asking
       pathconf(3)  does not really help, since on the one hand POSIX warns that the result of pathconf(3) may be huge and unsuitable for mallocing memory.  And on the other hand pathconf(3)
       may return -1 to signify that PATH_MAX is not bounded.

I don't know how bad is it to use a non standard (glibc specific) feature.
This is maybe already done everywhere in pacman, I really don't have the
slightest clue about this :)

After deciding which way to go, I suppose I could write a patch for it.

More information about the pacman-dev mailing list