Subject: bin/14119: library installs use hard links to symlinks
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cgd@netbsd.org>
List: netbsd-bugs
Date: 10/01/2001 21:04:04
>Number: 14119
>Category: bin
>Synopsis: some library installs use hard links to symlinks.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Oct 01 14:05:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Chris G. Demetriou
>Release: NetBSD-current as of 2001-10-01
>Organization:
>Environment:
>Description:
Installation of some NetBSD libraries (libterm, libcrypto
in particular) creates hard links to symlinks.
Hard links to symlinks are unportable. They may not be supported
on all file system types, and some systems' utilities (e.g. tar)
may not handle them correctly. An example of the latter is
that on RH Linux 7.1 the 'ln' prints a warning about them being
unportable, and the 'tar' command seems to botch them either
during tar file creation or extraction (not sure which) leaving
0-length files with mode 000 instead of the second and subsequent
links to the symlink. (Yes, these may/should be considered
bugs in RH Linux, but that doesn't change the fact that hard
links to symlinks are unportable.)
While this doesn't pose a problem for native NetBSD builds
right now (as far as I know; i've not tried many of the file
system types, and i've not tried using NFS with random oses/fses
on the server side) it can cause much havoc for cross-builds.
>How-To-Repeat:
find /usr/lib -type l -links +1
Note that there are several symlinks with link counts > 1,
indicating hard links to symlinks.
>Fix:
I believe the patch below should do the right thing. However,
note that:
* the patch to libcrypto/Makefile is agailst a slightly older
version of the Makefile and probably won't apply cleanly.
* the patch to libcrypt/Makefile has not been tested _in any way_.
(the libterm/Makefile patch has been tested in a cross-build
environment.)
Index: libterm/Makefile
===================================================================
RCS file: /projects/bbp/cvsroot/systemsw/netbsd/src/lib/libterm/Makefile,v
retrieving revision 1.4
diff -c -r1.4 Makefile
*** Makefile 2000/07/24 19:27:57 1.4
--- Makefile 2001/10/01 19:44:24
***************
*** 27,33 ****
.if ${MKPIC} != "no"
.if ${MKPICINSTALL} != "no"
! LINKS+= ${LIBDIR}/libtermcap_pic.a ${LIBDIR}/libtermlib_pic.a
.endif
.if exists(${.CURDIR}/shlib_version)
--- 27,35 ----
.if ${MKPIC} != "no"
.if ${MKPICINSTALL} != "no"
! # Target of this link may be a symlink (if MKPICLIB=yes, because all
! # libraries are PIC). Use a symlink here for portability.
! SYMLINKS+= libtermcap_pic.a ${LIBDIR}/libtermlib_pic.a
.endif
.if exists(${.CURDIR}/shlib_version)
***************
*** 35,43 ****
${LIBDIR}/libtermlib.so.${SHLIB_FULLVERSION}
.if (${OBJECT_FMT} == "ELF")
! LINKS+= ${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR} \
! ${LIBDIR}/libtermlib.so.${SHLIB_MAJOR}
! LINKS+= ${LIBDIR}/lib${LIB}.so ${LIBDIR}/libtermlib.so
.endif
.endif
--- 37,45 ----
${LIBDIR}/libtermlib.so.${SHLIB_FULLVERSION}
.if (${OBJECT_FMT} == "ELF")
! # Targets of these links will be symlinks. Use symlinks here for portability.
! SYMLINKS+= lib${LIB}.so.${SHLIB_MAJOR} ${LIBDIR}/libtermlib.so.${SHLIB_MAJOR}
! SYMLINKS+= lib${LIB}.so ${LIBDIR}/libtermlib.so
.endif
.endif
Index: libcrypto/Makefile
===================================================================
RCS file: /projects/bbp/cvsroot/systemsw/netbsd/src/lib/libcrypto/Makefile,v
retrieving revision 1.3
diff -c -r1.3 Makefile
*** Makefile 2001/01/13 02:04:31 1.3
--- Makefile 2001/10/01 19:37:46
***************
*** 93,99 ****
.if ${MKPIC} != "no"
.if ${MKPICINSTALL} != "no"
! LINKS+= ${LIBDIR}/libcrypto_pic.a ${LIBDIR}/libdes_pic.a
.endif
.if exists(${.CURDIR}/shlib_version)
--- 93,101 ----
.if ${MKPIC} != "no"
.if ${MKPICINSTALL} != "no"
! # Target of this link may be a symlink (if MKPICLIB=yes, because all
! # libraries are PIC). Use a symlink here for portability.
! SYMLINKS+= libcrypto_pic.a ${LIBDIR}/libdes_pic.a
.endif
.if exists(${.CURDIR}/shlib_version)
***************
*** 101,109 ****
${LIBDIR}/libdes.so.${DES_SHLIB_MAJOR}.${DES_SHLIB_MINOR}
.if (${OBJECT_FMT} == "ELF")
! LINKS+= ${LIBDIR}/libcrypto.so.${SHLIB_MAJOR} \
! ${LIBDIR}/libdes.so.${DES_SHLIB_MAJOR}
! LINKS+= ${LIBDIR}/libcrypto.so ${LIBDIR}/libdes.so
.endif
.endif
--- 103,111 ----
${LIBDIR}/libdes.so.${DES_SHLIB_MAJOR}.${DES_SHLIB_MINOR}
.if (${OBJECT_FMT} == "ELF")
! # Targets of these links will be symlinks. Use symlinks here for portability.
! LINKS+= libcrypto.so.${SHLIB_MAJOR} ${LIBDIR}/libdes.so.${DES_SHLIB_MAJOR}
! LINKS+= libcrypto.so ${LIBDIR}/libdes.so
.endif
.endif
>Release-Note:
>Audit-Trail:
>Unformatted: