Date: Sun, 7 Jul 1996 21:02:14 GMT From: James Raynard <james@jraynard.demon.co.uk> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1375: Extraneous warning from mv(1) Message-ID: <199607072102.VAA14441@jraynard.demon.co.uk> Resent-Message-ID: <199607072140.OAA16191@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 1375 >Category: bin >Synopsis: Extraneous warning from mv(1) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jul 7 14:40:02 PDT 1996 >Last-Modified: >Originator: James Raynard >Organization: James Raynard, Edinburgh, Scotland >Release: FreeBSD 2.1-STABLE i386 >Environment: FreeBSD-2.1.0-RELEASE >Description: Observed by Zach Heilig <zach@blizzard.gaffaneys.com>. When moving a file owned by the user, and by a group the user is *not* a member of, across filesystems, an extraneous warning is generated. Such files are typically created when a user writes to a directory with the sticky bit set, eg /tmp. According to mv(1), moving a file across filesystems is equivalent to calling cp -pRP, surrounded by calls to rm(1). According to cp(1), when the -p option is used, no error message should be displayed if the user and group ID of the file cannot be preserved. mv(1) behaves as expected if the file and its destination directory are on the same filesystem, or if a directory is moved across a filesystem instead of a file. >How-To-Repeat: For a user not in wheel, on a system where /tmp and /home are on different devices, $ touch /tmp/foo $ mv /tmp/foo ~ will give a warning about not being able to set owner/group on ~/foo. This does not occur if /tmp and ~ are on the same filesystem, or if foo is a directory. >Fix: Apply the following patch to 2.1.0-RELEASE in /usr/src/bin/mv --- mv.c.orig Sun Jul 7 20:39:38 1996 +++ mv.c Sun Jul 7 20:41:30 1996 @@ -231,8 +231,8 @@ } (void)close(from_fd); - if (fchown(to_fd, sbp->st_uid, sbp->st_gid)) - warn("%s: set owner/group", to); + (void)fchown(to_fd, sbp->st_uid, sbp->st_gid) + if (fchmod(to_fd, sbp->st_mode)) warn("%s: set mode", to); >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607072102.VAA14441>