Subject: bin/23874: Install(1) should always copy and ignore -c
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bjan+netbsd@bjan.net>
List: netbsd-bugs
Date: 12/24/2003 12:13:05
>Number:         23874
>Category:       bin
>Synopsis:       install(1) should always copy and ignore -c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 24 19:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Bruce J.A. Nourish
>Release:        NetBSD 1.6ZG
>Organization:
	
>Environment:
	
	
System: NetBSD telstar.bjan.net 1.6ZG NetBSD 1.6ZG (GENERIC) #3: Sun Dec 14 21:12:51 MST 2003 root@telstar.bjan.net:/usr/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
Install(1) deletes the source file unless -c is specified. This sets us
against FreeBSD, OpenBSD, every version of Linux, and all SysV derived
systems. 

I raised this on tech-userlevel: the consensus seemed to be that
our behaviour was not very useful, and should be fixed to make us
compatible.
>How-To-Repeat:
$ touch testfile
$ install testfile otherfile
$ ls testfile
>Fix:
Index: xinstall.c
===================================================================
RCS file: /cvsroot/src/usr.bin/xinstall/xinstall.c,v
retrieving revision 1.82
diff -b -u -r1.82 xinstall.c
--- xinstall.c	2003/12/16 20:51:57	1.82
+++ xinstall.c	2003/12/24 18:58:50
@@ -672,9 +672,6 @@
 		to_name = oto_name;
 	}
 
-	if (!docopy && !devnull && unlink(from_name))
-		err(1, "%s: unlink", from_name);
-
 	/*
 	 * If provided a set of flags, set them, otherwise, preserve the
 	 * flags, except for the dump flag.

Index: install.1
===================================================================
RCS file: /cvsroot/src/usr.bin/xinstall/install.1,v
retrieving revision 1.38
diff -b -u -r1.38 install.1
--- install.1	2003/08/07 11:17:50	1.38
+++ install.1	2003/12/24 19:07:01
@@ -144,9 +144,8 @@
 .Ek
 .Ar directory ...\&
 .Sh DESCRIPTION
-The file(s) are moved (copied if the
-.Fl c
-option is specified, or linked if the
+The file(s) are copied 
+(or linked if the
 .Fl l
 option is specified) to the target file or directory.
 If the destination is a directory, then the
@@ -204,10 +203,8 @@
 The counter used starts from 0, and the first available name resulting
 from the expansion is used.
 .It Fl c
-Copy the file.
-This flag turns off the default behavior of
-.Nm
-where it deletes the original file after creating the target.
+Copy the file. This is the default behavior: the flag is maintained
+for backwards compatibility only.
 .It Fl d
 Create directories.
 Missing parent directories are created as required.
>Release-Note:
>Audit-Trail:
>Unformatted: