NetBSD Problem Report #977

From gnats  Tue Apr 18 18:48:28 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id SAA05727 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Tue, 18 Apr 1995 18:48:27 -0700
Message-Id: <199504190149.BAA07766@glacier.MIT.EDU>
Date: Wed, 19 Apr 1995 01:49:49 GMT
From: ghudson@MIT.EDU
Reply-To: ghudson@MIT.EDU
To: gnats-bugs@NetBSD.ORG
Subject: "make install" runs ranlib on read-only files
X-Send-Pr-Version: 3.2

>Number:         977
>Category:       misc
>Synopsis:       bsd.lib.mk runs ranlib on read-only files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 18 18:50:03 +0000 1995
>Closed-Date:    Wed Apr 19 06:26:08 +0000 1995
>Last-Modified:  
>Originator:     Greg Hudson
>Release:        April 18, 1995
>Organization:
	MIT SIPB
>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} \
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Tue Apr 18 23:26:08 PDT 1995 
State-Changed-Why:  
fixed.  i took the given patch.  as noted in the commit message, there are potential 
problems that would need to be solved by any 'good' and clean fix: 

(1) installing to a different file name, then chowning that 
and using 'mv' brings up a couple of bugs that  
can't reasonably be tested for (and shouldn't have to be), 
(2) you don't particularly want people trying to use the libraries 
until they've been successfully installed, anyway. 

so if this patch isn't the most beautiful, it certainly gets the job done well 
enough. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.