From charnier@xp11.frmug.org  Sat Nov 16 14:52:48 1996
Received: from frmug.org (frmug-gw.frmug.org [193.56.58.252])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA25718
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 16 Nov 1996 14:52:42 -0800 (PST)
Received: (from uucp@localhost) by frmug.org (8.8.2/8.8.2/frmug-1.2) with UUCP id XAA02277 for FreeBSD-gnats-submit@freebsd.org; Sat, 16 Nov 1996 23:52:38 +0100 (MET)
Received: (from charnier@localhost) by xp11.frmug.org (8.8.2/8.7.3/xp11-uucp-1.1) id NAA01501; Sat, 16 Nov 1996 13:16:14 +0100 (MET)
Message-Id: <199611161216.NAA01501@xp11.frmug.org>
Date: Sat, 16 Nov 1996 13:16:14 +0100 (MET)
From: "Ph. Charnier" <charnier@xp11.frmug.org>
Reply-To: charnier@xp11.frmug.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: make world fails after cp -pR of /usr/bin
X-Send-Pr-Version: 3.2

>Number:         2040
>Category:       bin
>Synopsis:       make world fails after cp -pR of /usr/bin
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 16 15:00:05 PST 1996
>Closed-Date:    Tue Feb 25 21:30:02 PST 1997
>Last-Modified:  Tue Feb 25 21:30:48 PST 1997
>Originator:     Ph. Charnier
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	

>Description:

	cp -pR breaks hard links, (chpass, chfn, chsh, ypchpass, ypchfn and
ypchsh become 6 differents programs). Make install will fail later because it
assumes that only chpass has immutable flag.
I got: rm: /usr/bin/yppasswd: Operation not permitted.

>How-To-Repeat:

	notice that the defect list of your hard disk is quickly growing
and after a lot of bad144 actions, decide to put /usr on another disk. Run a
dump to save your datas, but too late! Run cp -pR ... :-)

>Fix:

	the enclosed patches can recover from such a situation

Index: Makefile
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/usr.bin/chpass/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- Makefile	1996/08/12 14:45:21	1.9
+++ Makefile	1996/11/16 11:50:54
@@ -52,8 +52,10 @@
 	${RPCGEN} -c -o ${.TARGET} ${RPCSRC_PRIV}
 
 beforeinstall:
-	[ ! -e ${DESTDIR}${BINDIR}/chpass ] || \
-		chflags noschg ${DESTDIR}${BINDIR}/chpass
+.for i in chpass chfn chsh ypchpass ypchfn ypchsh
+	[ ! -e ${DESTDIR}${BINDIR}/$i ] || \
+		chflags noschg ${DESTDIR}${BINDIR}/$i
+.endfor
 
 afterinstall:
 	chflags schg ${DESTDIR}${BINDIR}/chpass


Index: Makefile
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/usr.bin/passwd/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- Makefile	1996/11/03 03:11:54	1.20
+++ Makefile	1996/11/16 11:56:04
@@ -65,8 +65,10 @@
 .endif
 
 beforeinstall:
-	[ ! -e ${DESTDIR}${BINDIR}/passwd ] || \
-		chflags noschg ${DESTDIR}${BINDIR}/passwd
+.for i in passwd yppasswd
+	[ ! -e ${DESTDIR}${BINDIR}/$i ] || \
+		chflags noschg ${DESTDIR}${BINDIR}/$i
+.endfor
 
 afterinstall:
 	chflags schg ${DESTDIR}${BINDIR}/passwd


>Release-Note:
>Audit-Trail:

From: Wolfram Schneider <wosch@cs.tu-berlin.de>
To: charnier@xp11.frmug.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: bin/2040: make world fails after cp -pR of /usr/bin
Date: Sun, 17 Nov 1996 14:30:32 +0100

 >	cp -pR breaks hard links, (chpass, chfn, chsh, ypchpass, ypchfn and
 >ypchsh become 6 differents programs). 
 
 Use tar or cpio for coping, e.g.: 
 	$ tar cf - /usr/bin | (cd /backup; tar xf -)
 
 (the patch seems ok).
 
 Wolfram
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Tue Feb 25 21:30:02 PST 1997 
State-Changed-Why:  
Suggested fixes applied. 
>Unformatted:
