From owner-freebsd-bugs Sun Jul 7 14:40:09 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA16227 for bugs-outgoing; Sun, 7 Jul 1996 14:40:09 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA16191; Sun, 7 Jul 1996 14:40:05 -0700 (PDT) Resent-Date: Sun, 7 Jul 1996 14:40:05 -0700 (PDT) Resent-Message-Id: <199607072140.OAA16191@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, james@jraynard.demon.co.uk Received: from relay-2.mail.demon.net (disperse.demon.co.uk [158.152.1.77]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id OAA15860 for ; Sun, 7 Jul 1996 14:31:12 -0700 (PDT) Received: from post.demon.co.uk ([158.152.1.72]) by relay-2.mail.demon.net id ab17519; 7 Jul 96 22:31 +0100 Received: from jraynard.demon.co.uk ([158.152.42.77]) by relay-3.mail.demon.net id aa22505; 7 Jul 96 22:21 +0100 Received: (from james@localhost) by jraynard.demon.co.uk (8.6.12/8.6.12) id VAA14441; Sun, 7 Jul 1996 21:02:14 GMT Message-Id: <199607072102.VAA14441@jraynard.demon.co.uk> Date: Sun, 7 Jul 1996 21:02:14 GMT From: James Raynard Reply-To: james@jraynard.demon.co.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/1375: Extraneous warning from mv(1) Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >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 . 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: