Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jun 2002 14:12:23 +0930 (CST)
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/39217: cp returns non-zero when copying a symlink to it's linkee.
Message-ID:  <200206130442.g5D4gNtp003682@chowder.gsoft.com.au>

next in thread | raw e-mail | index | archive | help

>Number:         39217
>Category:       bin
>Synopsis:       cp returns non-zero when copying a symlink to it's linkee.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 12 22:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Daniel O'Connor
>Release:        FreeBSD 4.6-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD chowder.gsoft.com.au 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #12: Fri May 10 15:54:54 CST 2002 darius@chowder.gsoft.com.au:/usr/obj/usr/src/sys/CHOWDER i386

>Description:
When cp is requested to copy a file to a link of that file (hard or soft) it
returns non-zero. This does seem a little contrary in my opinion.

>How-To-Repeat:
touch foo
ln -s foo bar
cp foo bar
echo $?

>Fix:

--- cp.c.orig   Thu Jun 13 14:11:27 2002
+++ cp.c        Thu Jun 13 14:11:37 2002
@@ -368,7 +368,7 @@
                            to_stat.st_ino == curr->fts_statp->st_ino) {
                                warnx("%s and %s are identical (not copied).",
                                    to.p_path, curr->fts_path);
-                               badcp = rval = 1;
+                               badcp = 1;
                                if (S_ISDIR(curr->fts_statp->st_mode))
                                        (void)fts_set(ftsp, curr, FTS_SKIP);
                                continue;

Seems to work, but I haven't tested it too much.

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206130442.g5D4gNtp003682>