Subject: misc/977: "make install" runs ranlib on read-only files
To: None <gnats-admin@NetBSD.ORG>
From: None <ghudson@MIT.EDU>
List: netbsd-bugs
Date: 04/18/1995 18:50:05
>Number:         977
>Category:       misc
>Synopsis:       bsd.lib.mk runs ranlib on read-only files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 18 18:50:03 1995
>Originator:     Greg Hudson
>Organization:
	MIT SIPB
>Release:        April 18, 1995
>Environment:
System: NetBSD glacier 1.0A NetBSD 1.0A (GLACIER) #4: Thu Apr 13 16:52:38 EDT 1995 root@glacier:/usr/src/sys/arch/i386/compile/GLACIER i386


>Description:
	bsd.lib.mk installs libraries with a mode that is generally not
	writable by the files owner, and then runs ranlib on the files.
	This results in an error in a filesystem which obeys permissions;
	the only reason it works in UFS is that you're usually root.
>How-To-Repeat:
	Run "make install" in a library directory when you're not root,
	installing to a destination directory where you have permissions.

	(Or, "make install" with a destination target in NFS or AFS where
	your root permissions don't mean as much as they do in UFS.)
>Fix:
	I don't like this fix very much, and I hope someone can come up
	with a cleaner one.

*** /usr/src/share/mk/bsd.lib.mk	Thu Mar  9 04:14:36 1995
--- /usr/share/mk/bsd.lib.mk	Tue Apr 18 21:44:37 1995
***************
*** 143,162 ****
  
  realinstall:
  #	ranlib lib${LIB}.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
  	    ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
  .if !defined(NOPROFILE)
  #	ranlib lib${LIB}_p.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
  	    lib${LIB}_p.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
  .endif
  .if !defined(NOPIC)
  #	ranlib lib${LIB}_pic.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
  	    lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
  .endif
  .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
  	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
--- 143,165 ----
  
  realinstall:
  #	ranlib lib${LIB}.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
  	    ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
+ 	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
  .if !defined(NOPROFILE)
  #	ranlib lib${LIB}_p.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
  	    lib${LIB}_p.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
+ 	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
  .endif
  .if !defined(NOPIC)
  #	ranlib lib${LIB}_pic.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
  	    lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
+ 	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
  .endif
  .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
  	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
>Audit-Trail:
>Unformatted: