Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2001 08:03:25 -0700 (PDT)
From:      Jeremy Chadwick <jdc@best.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/30819: /bin/mv results in warnings when /bin/cp -p does not.
Message-ID:  <200109251503.f8PF3Pr42822@freefall.freebsd.org>

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

>Number:         30819
>Category:       bin
>Synopsis:       /bin/mv results in warnings when /bin/cp -p does not.
>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:   Tue Sep 25 08:10:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy Chadwick
>Release:        4.4-STABLE
>Organization:
>Environment:
Not applicable.
>Description:
From mv(1):

  As the rename(2) call does not work across file systems, mv uses cp(1)
  and rm(1) to accomplish the move.  The effect is equivalent to:

  rm -f destination_path && \
  cp -pRP source_file destination && \
  rm -rf source_file

From cp(1):

-p    Cause cp to preserve in the copy as many of the modification time,
      access time, file flags, file mode, user ID, and group ID as
      allowed by permissions.

      If the user ID and group ID cannot be preserved, no error message
      is displayed and the exit value is not altered.

It seems to me the "warning" spit out by mv(1) is worthless, as cp(1) does not do this.

Could this warning in mv(1) be removed?  It seems very contradictory to what's in the cp(1) manpage.
>How-To-Repeat:
$ id
uid=502(jdc) gid=100(users) groups=100(users)
$ ls -ld /tmp
drwxrwxrwt   4 root     wheel         512 Sep 25 07:56 /tmp
$ touch /tmp/foo
$ ls -ld /tmp/foo
-rw-------   1 jdc      wheel           0 Sep 25 07:54 /tmp/foo
$ cp -pRP /tmp/foo ./foo
$ ls -ld ./foo
-rw-------   1 jdc      users           0 Sep 25 07:54 ./foo
$ rm ./foo
$ mv /tmp/foo ./foo
mv: ./foo: set owner/group (was: 502/0): Operation not permitted
>Fix:

>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?200109251503.f8PF3Pr42822>