Date: Mon, 7 Apr 2003 08:53:31 +1000 (EST) From: Edwin Groothuis <edwin@mavetju.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/50656: /bin/cp - wrong error on copying of multiple files Message-ID: <20030406225331.6EE5C6A712B@k7.mavetju> Resent-Message-ID: <200304062300.h36N0ZJl038768@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 50656 >Category: bin >Synopsis: /bin/cp - wrong error on copying of multiple files >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Apr 06 16:00:33 PDT 2003 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030406225331.6EE5C6A712B>