Subject: Re: fixes for case insensitive ${DESTDIR}
To: Darrin B.Jewell <>
From: Rui Paulo <>
List: tech-toolchain
Date: 09/09/2006 21:01:48
On Sep 9, 2006, at 7:39 PM, Darrin B.Jewell wrote:

> The patch included below contains several fixes which allow building
> into a case insensitive ${DESTDIR}.  Most, but not all of them, are
> not user visible or even developer visible, and a few are also just
> general cleanup.  I would like feedback, especially on user visible
> x11 installed file renames, before I commit, thanks.
> The primary issues involved were:
>   - postinstall removed obsolete files with name conflicts
>   - checkflist reported conflicts as missing files
>   - name conflicts which were hard linked together did not end up in
>     METALOG, this was mostly a few man pages and /usr/bin/[Mm]ail
>   - src/tools/binstall -r -lh can get posix semantics for rename(2)
>     and does not remove its temporary file when reinstalling
>     an existing hard link.
>   - minor clash with file name in objdir for src/x11/tools/xkbcomp
>   - the X11 xdmx example program conflicted with the Xdmx server
>   - the X11 stipple and Stipple bitmaps conflicted
> Which were addressed in the following ways:
>   - I added a routine to postinstall to compare paths on filesystems
>     that are case insensitive but preserve case.  This was done by
>     using 'ls -fa dirname | grep -q -x -F filename'.  Now postinstall
>     will only remove obsolete files that match the exact case in the
>     filesystem.
>   - I changed checkflist to do an extra case insensitive check for
>     a file in the filesystem before reporting it missing
>   - I reworked the way hard links are created in and  
>     so that case conflicts are always installed even if it appears to
>     already be there.  This inserts the proper entry in METALOG.
>     I switched to using make constructs instead of shell  
> constructs, which
>     is a general improvement, but also provided a little more control
>     over the individual link build dependencies.  This also uncovered
>     some minor glitches in other system makefiles:
>       - libform had several files listed to hard link to themselves
>       - libkrb5 had a file hard linked when it also existed as its  
> own man page.
>       - libl needed to include at the end of the makefile
>       - bin/test doesn't need to explicitly shell quote the target [.1
>     One side effect of this is that the resulting installed filename
>     on case insensitive filesystems has the case of the last installed
>     link.  I had a working tweak to fix this by installing from a hard
>     link of the original and then moving that hard link back into
>     the original filename but this seemed unnecessary.
>   - I changed src/usr.bin/xinstall/xinstall.c to unconditionally  
> attempt
>     to unlink() the temporary file after rename(), so that it  
> doesn't matter
>     whether rename has posix or bsd semantics.
>   - I created a special .c file for xkbcomp which included one of the
>     name conflicting source files so that the .o file names in objdir
>     no longer conflict
>   - I renamed the xdmx example program to just "dmx" from a hint in  
> its
>     Imakefile.  This could also be renamed something like dmxinfo or
>     something else unobtrusive.  This is a user visible change that
>     required obsoleting the old name in the set lists.
>   - I renamed /usr/X11R6/include/X11/bitmaps/Stipple to Stippler based
>     on a hint in the Imakefile.  This is a user visible change that
>     required obsoleting the old name in the set lists.
> These changes were tested by building the i386 target on osx and  
> netbsd
> into HFS+ and FFS respectively.  They were also tested with make -j 4.
> With these changes, a complete release build works on case insensitive
> filesystems.  The only remaining issue is that the resulting set tar
> files do not hard link everything correctly since tar gets confused by
> the fact that two files in METALOG that differ only in case do not
> separately bump the link count in the filesystem.  I am considering
> adding an option to tar to consider all files as link candidates,
> but that is not included in this patch.
> Please review, comment and possibly test.  I would like to commit
> these changes, or at least the non user visible ones if there
> is objection to the X11 renames.
> Thank you,
> Darrin

Great work! The patch looks good to me, but I can't comment on the  
X11 renames.

	-- Rui Paulo