Subject: fixes for case insensitive ${DESTDIR}
To: None <tech-toolchain@netbsd.org>
From: Darrin B.Jewell <dbj@netbsd.org>
List: tech-toolchain
Date: 09/09/2006 11:39:43
--=-=-=


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 bsd.man.mk and bsd.link.mk
    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 bsd.lib.mk 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


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=netbsd.casefixes6.diff
Content-Description: Changes to build with case insensitive ${DESTDIR}

Index: src/bin/test/Makefile
===================================================================
RCS file: /cvsroot/src/bin/test/Makefile,v
retrieving revision 1.9
diff -u -u -r1.9 Makefile
--- src/bin/test/Makefile	4 Aug 2006 19:07:55 -0000	1.9
+++ src/bin/test/Makefile	8 Sep 2006 23:15:34 -0000
@@ -5,6 +5,6 @@
 SRCS=   test.c
 LINKS=	${BINDIR}/test ${BINDIR}/[
 CFLAGS+=-g
-MLINKS=	test.1 '[.1'
+MLINKS=	test.1 [.1
 
 .include <bsd.prog.mk>
Index: src/distrib/sets/checkflist
===================================================================
RCS file: /cvsroot/src/distrib/sets/checkflist,v
retrieving revision 1.32
diff -u -u -r1.32 checkflist
--- src/distrib/sets/checkflist	28 Jan 2006 19:01:23 -0000	1.32
+++ src/distrib/sets/checkflist	8 Sep 2006 23:15:34 -0000
@@ -112,6 +112,14 @@
     ${COMM} -23 "${SDIR}/files" "${SDIR}/mlist" > "${SDIR}/missing"
     ${COMM} -13 "${SDIR}/files" "${SDIR}/mlist" > "${SDIR}/extra"
 
+    # Handle case insensitive filesystems
+    mv -f "${SDIR}/extra" "${SDIR}/extra.all"
+    while read f; do
+	[ -f "${DESTDIR}/${f}" ] || \
+	    [ -d "${DESTDIR}/${f}" ] || \
+	    [ -L "${DESTDIR}/${f}" ] || echo "$f"
+    done < "${SDIR}/extra.all" > "${SDIR}/extra"
+
     if [ -s "${SDIR}/extra" ]; then
 	count="$(${AWK} 'END {print NR}' "${SDIR}/extra")"
 	echo ""
@@ -145,6 +153,14 @@
 ${COMM} -23 "${SDIR}/flist" "${SDIR}/files" > "${SDIR}/missing"
 ${COMM} -13 "${SDIR}/flist" "${SDIR}/files" > "${SDIR}/extra"
 
+# Handle case insensitive filesystems
+mv -f "${SDIR}/missing" "${SDIR}/missing.all"
+while read f; do
+    [ -f "${DESTDIR}/${f}" ] || \
+	[ -d "${DESTDIR}/${f}" ] || \
+	[ -L "${DESTDIR}/${f}" ] || echo "$f"
+done < "${SDIR}/missing.all" > "${SDIR}/missing"
+
 if [ -s "${SDIR}/extra" ]; then
 	count="$(${AWK} 'END {print NR}' "${SDIR}/extra")"
 	echo ""
Index: src/distrib/sets/lists/xbase/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/xbase/mi,v
retrieving revision 1.50
diff -u -u -r1.50 mi
--- src/distrib/sets/lists/xbase/mi	28 Mar 2005 13:48:04 -0000	1.50
+++ src/distrib/sets/lists/xbase/mi	8 Sep 2006 23:15:35 -0000
@@ -138,7 +138,8 @@
 ./usr/X11R6/include/X11/bitmaps/Right
 ./usr/X11R6/include/X11/bitmaps/RotateLeft
 ./usr/X11R6/include/X11/bitmaps/RotateRight
-./usr/X11R6/include/X11/bitmaps/Stipple
+./usr/X11R6/include/X11/bitmaps/Stipple         xbase-obsolete  obsolete
+./usr/X11R6/include/X11/bitmaps/Stippler
 ./usr/X11R6/include/X11/bitmaps/Term
 ./usr/X11R6/include/X11/bitmaps/Up
 ./usr/X11R6/include/X11/bitmaps/black
Index: src/distrib/sets/lists/xcomp/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/xcomp/mi,v
retrieving revision 1.28
diff -u -u -r1.28 mi
--- src/distrib/sets/lists/xcomp/mi	23 Jul 2006 11:41:26 -0000	1.28
+++ src/distrib/sets/lists/xcomp/mi	8 Sep 2006 23:15:39 -0000
@@ -3816,6 +3816,7 @@
 ./usr/libdata/debug/usr/X11R6/bin/bmtoa.debug		-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/cxpm.debug		-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/dga.debug		-unknown-	debug
+./usr/libdata/debug/usr/X11R6/bin/dmx.debug		-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/dmxaddinput.debug	-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/dmxaddscreen.debug	-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/dmxreconfig.debug	-unknown-	debug
@@ -3879,7 +3880,7 @@
 ./usr/libdata/debug/usr/X11R6/bin/xcutsel.debug		-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/xditview.debug	-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/xdm.debug		-unknown-	debug
-./usr/libdata/debug/usr/X11R6/bin/xdmx.debug		-unknown-	debug
+./usr/libdata/debug/usr/X11R6/bin/xdmx.debug		xcomp-obsolete	obsolete
 ./usr/libdata/debug/usr/X11R6/bin/xdmxconfig.debug	-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/xdpyinfo.debug	-unknown-	debug
 ./usr/libdata/debug/usr/X11R6/bin/xedit.debug		-unknown-	debug
Index: src/distrib/sets/lists/xserver/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/xserver/mi,v
retrieving revision 1.16
diff -u -u -r1.16 mi
--- src/distrib/sets/lists/xserver/mi	22 Mar 2005 13:45:46 -0000	1.16
+++ src/distrib/sets/lists/xserver/mi	8 Sep 2006 23:15:39 -0000
@@ -3,6 +3,7 @@
 ./usr/X11R6/bin/Xdmx
 ./usr/X11R6/bin/Xnest
 ./usr/X11R6/bin/Xprt
+./usr/X11R6/bin/dmx
 ./usr/X11R6/bin/dmxaddinput
 ./usr/X11R6/bin/dmxaddscreen
 ./usr/X11R6/bin/dmxreconfig
@@ -15,7 +16,7 @@
 ./usr/X11R6/bin/res
 ./usr/X11R6/bin/vdltodmx
 ./usr/X11R6/bin/xbell
-./usr/X11R6/bin/xdmx
+./usr/X11R6/bin/xdmx		                xserver-obsolete	obsolete
 ./usr/X11R6/bin/xdmxconfig
 ./usr/X11R6/bin/xinput
 ./usr/X11R6/bin/xled
Index: src/lib/libform/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libform/Makefile,v
retrieving revision 1.7
diff -u -u -r1.7 Makefile
--- src/lib/libform/Makefile	24 Nov 2004 11:57:09 -0000	1.7
+++ src/lib/libform/Makefile	8 Sep 2006 23:15:39 -0000
@@ -36,12 +36,11 @@
 		form_field_buffer.3 field_status.3 form_hook.3 field_term.3 \
 		form_field_validation.3 field_type.3 \
 		form_field_userptr.3 field_userptr.3 \
-		form_driver.3 form_driver.3 form_field.3 form_fields.3 \
+		form_field.3 form_fields.3 \
 		form_hook.3 form_init.3 form_page.3 form_max_page.3 \
-		form_opts.3 form_opts.3 form_opts.3 form_opts_off.3 \
-		form_opts.3 form_opts_on.3 form_page.3 form_page.3 \
+		form_opts.3 form_opts_off.3 \
+		form_opts.3 form_opts_on.3 \
 		form_win.3 form_sub.3 form_hook.3 form_term.3 \
-		form_userptr.3 form_userptr.3 form_win.3 form_win.3 \
 		form_field_new.3 free_field.3 \
 		form_fieldtype.3 free_fieldtype.3 \
 		form_new.3 free_form.3 form_field_new.3 link_field.3 \
Index: src/lib/libkrb5/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libkrb5/Makefile,v
retrieving revision 1.36
diff -u -u -r1.36 Makefile
--- src/lib/libkrb5/Makefile	12 May 2006 18:00:06 -0000	1.36
+++ src/lib/libkrb5/Makefile	8 Sep 2006 23:15:40 -0000
@@ -188,7 +188,6 @@
 	krb5_address.3			krb5_copy_address.3		\
 	krb5_address.3			krb5_copy_addresses.3		\
 	krb5_address.3			krb5_free_address.3		\
-	krb5_address.3			krb5_free_addresses.3		\
 	krb5_address.3			krb5_h_addr2addr.3		\
 	krb5_address.3			krb5_h_addr2sockaddr.3		\
 	krb5_address.3			krb5_make_addrport.3		\
Index: src/lib/libl/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libl/Makefile,v
retrieving revision 1.12
diff -u -u -r1.12 Makefile
--- src/lib/libl/Makefile	7 May 2005 00:23:01 -0000	1.12
+++ src/lib/libl/Makefile	8 Sep 2006 23:15:40 -0000
@@ -13,8 +13,8 @@
 
 .PATH:		${NETBSDSRCDIR}/usr.bin/lex
 
-.include <bsd.lib.mk>
-
 .if ${MKPROFILE} != "no"
 LINKS+=		${LIBDIR}/libl_p.a ${LIBDIR}/libfl_p.a
 .endif
+
+.include <bsd.lib.mk>
Index: src/share/mk/bsd.links.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.links.mk,v
retrieving revision 1.31
diff -u -u -r1.31 bsd.links.mk
--- src/share/mk/bsd.links.mk	16 Mar 2006 18:43:34 -0000	1.31
+++ src/share/mk/bsd.links.mk	8 Sep 2006 23:15:40 -0000
@@ -9,6 +9,11 @@
 LINKS?=
 SYMLINKS?=
 
+__linkinstall: .USE
+	${_MKSHMSG_INSTALL} ${.TARGET}; \
+	${_MKSHECHO} "${INSTALL_LINK} ${.ALLSRC} ${.TARGET}" && \
+	${INSTALL_LINK} ${.ALLSRC} ${.TARGET}
+
 ##### Install rules
 .PHONY:		linksinstall
 linksinstall::	realinstall
@@ -26,22 +31,22 @@
 		${INSTALL_SYMLINK} $$l $$t; \
 	 done; )
 .endif
-.if !empty(LINKS)
-	@(set ${LINKS}; \
-	 while test $$# -ge 2; do \
-		l=${DESTDIR}$$1; shift; \
-		t=${DESTDIR}$$1; shift; \
-		if  ldevino=`${TOOL_STAT} -qf '%d %i' $$l` && \
-		    tdevino=`${TOOL_STAT} -qf '%d %i' $$t` && \
-		    [ "$$ldevino" = "$$tdevino" ]; then \
-			continue ; \
-		fi ; \
-		${_MKSHMSG_INSTALL} $$t; \
-		${_MKSHECHO} ${INSTALL_LINK} $$l $$t; \
-		${INSTALL_LINK} $$l $$t; \
-	done ; )
+
+.for _src _dst in ${LINKS}
+_l:=${DESTDIR}${_src}
+_t:=${DESTDIR}${_dst}
+
+# Handle case conflicts carefully, when _dst occurs
+# more than once after case flattening
+.if ${MKUPDATE} == "no" || ${LINKS:tl:M${_dst:tl:Q}:[\#]} > 1
+${_t}!		${_l} __linkinstall
+.else
+${_t}:		${_l} __linkinstall
 .endif
 
+linksinstall::	${_t}
+.PRECIOUS:	${_t}
+.endfor
 
 configinstall:		configlinksinstall
 .PHONY:			configlinksinstall
@@ -60,20 +65,21 @@
 		${INSTALL_SYMLINK} $$l $$t; \
 	 done; )
 .endif
-.if defined(CONFIGLINKS) && !empty(CONFIGLINKS)
-	@(set ${CONFIGLINKS}; \
-	 while test $$# -ge 2; do \
-		l=${DESTDIR}$$1; shift; \
-		t=${DESTDIR}$$1; shift; \
-		if  ldevino=`${TOOL_STAT} -qf '%d %i' $$l` && \
-		    tdevino=`${TOOL_STAT} -qf '%d %i' $$t` && \
-		    [ "$$ldevino" = "$$tdevino" ]; then \
-			continue ; \
-		fi ; \
-		${_MKSHMSG_INSTALL} $$t; \
-		${_MKSHECHO} ${INSTALL_LINK} $$l $$t; \
-		${INSTALL_LINK} $$l $$t; \
-	done ; )
+
+.for _src _dst in ${CONFIGLINKS}
+_l:=${DESTDIR}${_src}
+_t:=${DESTDIR}${_dst}
+
+# Handle case conflicts carefully, when _dst occurs
+# more than once after case flattening
+.if ${MKUPDATE} == "no" || ${CONFIGLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
+${_t}!		${_l} __linkinstall
+.else
+${_t}:		${_l} __linkinstall
 .endif
 
+configlinksinstall::	${_t}
+.PRECIOUS:	${_t}
+.endfor
+
 .include <bsd.sys.mk>
Index: src/share/mk/bsd.man.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.man.mk,v
retrieving revision 1.95
diff -u -u -r1.95 bsd.man.mk
--- src/share/mk/bsd.man.mk	16 Mar 2006 18:43:34 -0000	1.95
+++ src/share/mk/bsd.man.mk	8 Sep 2006 23:15:40 -0000
@@ -4,7 +4,7 @@
 .include <bsd.init.mk>
 
 ##### Basic targets
-.PHONY:		catinstall maninstall catpages manpages
+.PHONY:		catinstall maninstall catpages manpages catlinks manlinks
 realinstall:	${MANINSTALL}
 
 ##### Default values
@@ -50,10 +50,16 @@
 	     ${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
 		${.ALLSRC} ${.TARGET})
 
+# XXX consider including bsd.links.mk and using __linkinstall instead
+__linkinstallpage: .USE
+	${_MKSHMSG_INSTALL} ${.TARGET}; \
+	${_MKSHECHO} "${INSTALL_LINK} ${.ALLSRC} ${.TARGET}" && \
+	${INSTALL_LINK} ${.ALLSRC} ${.TARGET}
+
 ##### Build and install rules (source form pages)
 
 .if ${MKMAN} != "no"
-maninstall:	manlinks
+maninstall:	manpages manlinks
 manpages::	# ensure target exists
 MANPAGES=	${MAN:C/.$/&${MANSUFFIX}/}
 
@@ -85,29 +91,29 @@
 .PRECIOUS:	${_F}					# keep if install fails
 .endfor
 
-manlinks: .PHONY manpages				# symlink install
-.if !empty(MLINKS)
-	@set ${MLINKS}; \
-	while test $$# -ge 2; do \
-		name=$$1; shift; \
-		dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
-		l=$${dir}${MANSUBDIR}/$${name}${MANSUFFIX}; \
-		name=$$1; shift; \
-		dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
-		t=$${dir}${MANSUBDIR}/$${name}${MANSUFFIX}; \
-		if test $$l -nt $$t -o ! -f $$t; then \
-			${_MKSHMSG_INSTALL} $$t; \
-			${_MKSHECHO} ${INSTALL_LINK} $$l $$t; \
-			${INSTALL_LINK} $$l $$t; \
-		fi; \
-	done
+manlinks::						# link install
+
+.for _src _dst in ${MLINKS}
+_l:=${DESTDIR}${MANDIR}/man${_src:T:E}${MANSUBDIR}/${_src}${MANSUFFIX}
+_t:=${DESTDIR}${MANDIR}/man${_dst:T:E}${MANSUBDIR}/${_dst}${MANSUFFIX}
+
+# Handle case conflicts carefully, when _dst occurs
+# more than once after case flattening
+.if ${MKUPDATE} == "no" || ${MLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
+${_t}!		${_l} __linkinstallpage
+.else
+${_t}:		${_l} __linkinstallpage
 .endif
+
+manlinks::	${_t}
+.PRECIOUS:	${_t}
+.endfor
 .endif # ${MKMAN} != "no"
 
 ##### Build and install rules (plaintext pages)
 
 .if (${MKCATPAGES} != "no") && (${MKMAN} != "no")
-catinstall:	catlinks
+catinstall:	catpages catlinks
 catpages::	# ensure target exists
 CATPAGES=	${MAN:C/\.([1-9])$/.cat\1${MANSUFFIX}/}
 
@@ -146,23 +152,23 @@
 .PRECIOUS:	${_F}					# keep if install fails
 .endfor
 
-catlinks: .PHONY catpages				# symlink install
-.if !empty(MLINKS)
-	@set ${MLINKS}; \
-	while test $$# -ge 2; do \
-		name=$$1; shift; \
-		dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
-		l=$${dir}${MANSUBDIR}/$${name%.*}.0${MANSUFFIX}; \
-		name=$$1; shift; \
-		dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
-		t=$${dir}${MANSUBDIR}/$${name%.*}.0${MANSUFFIX}; \
-		if test $$l -nt $$t -o ! -f $$t; then \
-			${_MKSHMSG_INSTALL} $$t; \
-			${_MKSHECHO} ${INSTALL_LINK} $$l $$t; \
-			${INSTALL_LINK} $$l $$t; \
-		fi; \
-	done
+catlinks::						# link install
+
+.for _src _dst in ${MLINKS}
+_l:=${DESTDIR}${MANDIR}/cat${_src:T:E}${MANSUBDIR}/${_src:R}.0${MANSUFFIX}
+_t:=${DESTDIR}${MANDIR}/cat${_dst:T:E}${MANSUBDIR}/${_dst:R}.0${MANSUFFIX}
+
+# Handle case conflicts carefully, when _dst occurs
+# more than once after case flattening
+.if ${MKUPDATE} == "no" || ${MLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
+${_t}!		${_l} __linkinstallpage
+.else
+${_t}:		${_l} __linkinstallpage
 .endif
+
+catlinks::	${_t}
+.PRECIOUS:	${_t}
+.endfor
 .endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no")
 
 ##### Build and install rules (HTML pages)
Index: src/usr.sbin/postinstall/postinstall
===================================================================
RCS file: /cvsroot/src/usr.sbin/postinstall/postinstall,v
retrieving revision 1.24
diff -u -u -r1.24 postinstall
--- src/usr.sbin/postinstall/postinstall	18 Aug 2006 12:01:53 -0000	1.24
+++ src/usr.sbin/postinstall/postinstall	8 Sep 2006 23:15:41 -0000
@@ -365,6 +365,27 @@
 	return $?
 }
 
+# file_exists_exact path
+#	Returns true if file exists matching exact case for path
+#	Each path is relative to ${DEST_DIR}, and should
+#	be an absolute path or start with `./'.
+#
+file_exists_exact()
+{
+	[ -n "1" ] || err 2 "USAGE: file_exists_exact path"
+	_path=${1#.}
+	[ -e "${DEST_DIR}${_path}" ] || return 1
+	while [ "${_path}" != "/" ] ; do
+		_dirname=$(dirname "${_path}" 2>/dev/null)
+		_basename=$(basename "${_path}" 2>/dev/null)
+		ls -fa "${DEST_DIR}${_dirname}" 2> /dev/null \
+			| grep -q -x -F "${_basename}" \
+			|| return 1
+		_path=${_dirname}
+	done
+	return 0
+}
+
 # obsolete_paths op
 #	Obsolete the list of paths provided on stdin.
 #	Each path is relative to ${DEST_DIR}, and should
@@ -377,6 +398,9 @@
 
 	failed=0
 	while read ofile; do
+                if ! file_exists_exact "${ofile}"; then
+                    continue
+                fi
 		ofile=${DEST_DIR}${ofile#.}
 		cmd="rm"
 		ftype="file"
@@ -385,8 +409,6 @@
 		elif [ -d "${ofile}" ]; then
 			ftype="directory"
 			cmd="rmdir"
-		elif [ ! -e "${ofile}" ]; then
-			continue
 		fi
 		if [ "${op}" = "check" ]; then
 			msg "Remove obsolete ${ftype} ${ofile}"
Index: src/x11/Xserver/hw/dmx/bin/xdmx/Makefile
===================================================================
RCS file: /cvsroot/src/x11/Xserver/hw/dmx/bin/xdmx/Makefile,v
retrieving revision 1.1
diff -u -u -r1.1 Makefile
--- src/x11/Xserver/hw/dmx/bin/xdmx/Makefile	22 Mar 2005 04:18:49 -0000	1.1
+++ src/x11/Xserver/hw/dmx/bin/xdmx/Makefile	8 Sep 2006 23:15:41 -0000
@@ -12,5 +12,7 @@
 CPPFLAGS+=	-I${X11SRCDIR.xc}/include/extensions
 CPPFLAGS+=	${X11FLAGS.SERVER}
 
+PROGNAME=dmx
+
 .include <bsd.x11.mk>
 .include <bsd.prog.mk>
Index: src/x11/bin/bitmap/Makefile
===================================================================
RCS file: /cvsroot/src/x11/bin/bitmap/Makefile,v
retrieving revision 1.4
diff -u -u -r1.4 Makefile
--- src/x11/bin/bitmap/Makefile	20 Sep 2003 06:20:46 -0000	1.4
+++ src/x11/bin/bitmap/Makefile	8 Sep 2006 23:15:41 -0000
@@ -11,6 +11,8 @@
 	RotateRight Stipple Term Up
 FILESDIR=${X11INCDIR}/X11/bitmaps
 
+FILESNAME_Stipple=Stippler
+
 APPDEFS=Bitmap.ad Bitmap-color.ad
 
 BUILDSYMLINKS=	Bitmap-co.ad Bitmap-color.ad
Index: src/x11/tools/xkbcomp/Makefile
===================================================================
RCS file: /cvsroot/src/x11/tools/xkbcomp/Makefile,v
retrieving revision 1.4
diff -u -u -r1.4 Makefile
--- src/x11/tools/xkbcomp/Makefile	30 Sep 2003 06:41:31 -0000	1.4
+++ src/x11/tools/xkbcomp/Makefile	8 Sep 2006 23:15:41 -0000
@@ -15,9 +15,11 @@
 SRCS+=		xkbcomp-stubs.c xkbcomp-KeyBind.c
 
 .PATH:		${X11SRCDIR.xc}/lib/xkbfile
-SRCS+=		xkbatom.c xkberrs.c xkbmisc.c xkbout.c xkmread.c xkbtext.c \
+SRCS+=		xkbatom.c xkberrs.c xkbout.c xkmread.c xkbtext.c \
 		cout.c xkmout.c
 
+SRCS+=		xkbfile-xkbmisc.c
+
 .PATH:		${X11SRCDIR.xc}/lib/X11
 SRCS+=		KeysymStr.c StrKeysym.c Quarks.c Xrm.c 
 SRCS+=		XKB.c XKBAlloc.c XKBGAlloc.c XKBMAlloc.c XKBMisc.c \
Index: src/x11/tools/xkbcomp/xkbfile-xkbmisc.c
===================================================================
RCS file: src/x11/tools/xkbcomp/xkbfile-xkbmisc.c
diff -N src/x11/tools/xkbcomp/xkbfile-xkbmisc.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/x11/tools/xkbcomp/xkbfile-xkbmisc.c	8 Sep 2006 23:15:41 -0000
@@ -0,0 +1,9 @@
+/*	$NetBSD$	*/
+
+/* This file exists to differentiate between
+ * lib/xkbfile/xkbmisc.c and lib/X11/XKBMisc.c
+ * which causes objdir conflicts on case-insensitive filesystems
+ */
+
+#include <../../lib/xkbfile/xkbmisc.c>
+
Index: src/usr.bin/xinstall/xinstall.c
===================================================================
RCS file: /cvsroot/src/usr.bin/xinstall/xinstall.c,v
retrieving revision 1.95
diff -u -u -r1.95 xinstall.c
--- src/usr.bin/xinstall/xinstall.c	11 May 2006 06:09:44 -0000	1.95
+++ src/usr.bin/xinstall/xinstall.c	8 Sep 2006 23:15:41 -0000
@@ -405,9 +405,11 @@
 		ret = link(from_name, tmpl);
 		if (ret == 0) {
 			ret = rename(tmpl, to_name);
-			if (ret < 0)
-				/* remove temporary link before exiting */
-				(void)unlink(tmpl);
+			/* If rename has posix semantics, then the temporary
+			 * file may still exist when from_name and to_name point
+			 * to the smae file, so unlink it unconditionally.
+			 */
+			(void)unlink(tmpl);
 		}
 		return (ret);
 	} else

--=-=-=--