Subject: Re: pax problem+fix
To: None <>
From: Ben Harris <>
List: tech-userlevel
Date: 06/21/2003 20:17:38
In article <> you write:
>As pax does not treat '.' specially, it checks if
>$(DESTDIR)$(TARGET_DIR)/tutorial/. exists, which is the case, and
>then tries to remove it.
>On BSD, rmdir("directory/.") gives an Invalid Argument error.
>(I've actually only tried this on FreeBSD as my NetBSD machine
>is currently broken :( )
>On Linux, when the ext2 filesysteme is used (but not with xfs),
>the rmdir command succeeds and causes pax to enter an infinite
>loop where it repeatedly creates and removes the target directory:

This is a bug in Linux.  Attempting to remove "." is guaranteed to fail by
POSIX.  If you upgrade to Linux 2.4, I believe the problem will go away.

>The attached patch (against the version of the pkgsrc-bootstrap-kit, but
>imho it should apply to the /src/bin/pax version as well) fixes the problem
>by checking against 'dir/.' in unlnk_exist() (file_subs.c).

My, rather simpler patch, is at
<>.  I haven't
committed it on the grounds that it seems wrong to have to work around other
OSes' bugs in our source.

Ben Harris                                                   <>
Portmaster, NetBSD/acorn26           <URL:>