From edwin@mavetju.org  Sun Apr  6 15:53:37 2003
Return-Path: <edwin@mavetju.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 57A7037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Apr 2003 15:53:37 -0700 (PDT)
Received: from topaz.ad1810.com (topaz.ad1810.com [212.204.230.141])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C8D6A43F93
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Apr 2003 15:53:36 -0700 (PDT)
	(envelope-from edwin@mavetju.org)
Received: from k7.mavetju (topaz.ad1810.com [212.204.230.141])
	by topaz.ad1810.com (Postfix) with ESMTP id 07DE92B99D
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  7 Apr 2003 00:53:34 +0200 (CEST)
Received: by k7.mavetju (Postfix, from userid 1001)
	id 6EE5C6A712B; Mon,  7 Apr 2003 08:53:31 +1000 (EST)
Message-Id: <20030406225331.6EE5C6A712B@k7.mavetju>
Date: Mon,  7 Apr 2003 08:53:31 +1000 (EST)
From: Edwin Groothuis <edwin@mavetju.org>
Reply-To: Edwin Groothuis <edwin@mavetju.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /bin/cp - wrong error on copying of multiple files
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         50656
>Category:       bin
>Synopsis:       cp(1) - wrong error on copying of multiple files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 06 16:00:33 PDT 2003
>Closed-Date:    Fri Nov 02 22:11:38 UTC 2012
>Last-Modified:  Fri Nov 02 22:11:38 UTC 2012
>Originator:     Edwin Groothuis
>Release:        FreeBSD 4.7-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Mon Mar 3 09:15:38 EST 2003 edwin@k7.mavetju:/usr/src/sys/compile/k7 i386
FreeBSD ref5.freebsd.org 5.0-CURRENT FreeBSD 5.0-CURRENT #65: Sun Mar 30 09:00:38 PST 2003     root@ref5.freebsd.org:/usr/src/sys/i386/compile/REF5  i386

>Description:

If I copy multiple files to a directory which doesn't exist, it
gives me the usage screen instead of a message saying "cp: a: No
such directory".

>How-To-Repeat:

create directory a, don't create files b and c:

    [~] edwin@k7>/bin/cp c b a
    cp: b: No such file or directory
    cp: c: No such file or directory

    [~] edwin@k7>/bin/cp a b c
    usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
	   cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory

>Fix:

In cp.c, around line 213 (for the 4.7 sources) something like:
        if (r == -1 || !S_ISDIR(to_stat.st_mode)) {
                /*
                 * Case (1).  Target is not a directory.
                 */
                if (argc > 1) {
-                       usage();
+			warnx(1,"Target is not a directory");
                        exit(1);
                }
                /*

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->trhodes 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Jun 2 04:42:40 UTC 2007 
Responsible-Changed-Why:  
Tom, as the last person who touched /bin/cp, could you please have a look 
at this PR? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50656 
Responsible-Changed-From-To: trhodes->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Dec 15 05:54:33 UTC 2007 
Responsible-Changed-Why:  
Chase it with grog@ 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50656 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/50656: commit references a PR
Date: Tue, 25 Dec 2007 00:40:37 +0000 (UTC)

 edwin       2007-12-25 00:40:32 UTC
 
   FreeBSD src repository
 
   Modified files:
     bin/cp               cp.c 
   Log:
   When copying multiple files to a directory, make sure that a proper
   warning is given when the directory doesn't exist.
   
   PR:             bin/50656
   Submitted by:   Edwin Groothuis <edwin@mavetju.org>
   Approved by:    grog@
   Not reviewed by: grog@
   
   Revision  Changes    Path
   1.58      +1 -1      src/bin/cp/cp.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Tue Jan 29 13:59:13 UTC 2008 
State-Changed-Why:  
Patched in -HEAD 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50656 
Responsible-Changed-From-To: edwin->freebsd-bugs 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Feb 14 10:27:36 UTC 2008 
Responsible-Changed-Why:  

Give back into the pool until later. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50656 

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/50656: cp(1) - wrong error on copying of multiple files
Date: Tue, 24 Aug 2010 02:37:44 +0000

 hi,
 
 it would be nice if somebody could MFC r174890 (just one line) to branches
 7 and 6 and then close this PR.
 
 thanks in advance.
 alex
 
 -- 
 a13x
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Fri Nov 2 22:11:37 UTC 2012 
State-Changed-Why:  
MFCed some time ago 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50656 
>Unformatted:
