From owner-freebsd-bugs Wed Jun 23 23: 0: 4 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 7887B14D68 for ; Wed, 23 Jun 1999 23:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id XAA15447; Wed, 23 Jun 1999 23:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 2D48114CA8; Wed, 23 Jun 1999 22:54:27 -0700 (PDT) Message-Id: <19990624055427.2D48114CA8@hub.freebsd.org> Date: Wed, 23 Jun 1999 22:54:27 -0700 (PDT) From: shirai@nintendo.co.jp To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: bin/12375: mv(1) cannot inherit the file flags. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12375 >Category: bin >Synopsis: mv(1) cannot inherit the file flags. >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: Wed Jun 23 23:00:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Takashi SHIRAI >Release: 2.2.7-RELEASE >Organization: Nintendo Co., Ltd. >Environment: FreeBSD tp235 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Thu Apr 8 20:33:21 JST 1999 shirai@tp235:/usr/src/sys/compile/tp235 i386 >Description: mv(1) man page says the following: > 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 But, cp(1) is actually used only if source_file is not the regular file. Then, mv(1) of the regular file cannot inherit its file flags. >How-To-Repeat: $ > /foo $ chflags nodump /foo $ ls -lo /foo -rw-r--r-- 1 shirai user nodump 0 Jun 24 14:06 /foo $ mv /foo /var/tmp $ ls -lo /var/tmp/foo -rw-r--r-- 1 shirai user - 0 Jun 24 14:07 /var/tmp/foo >Fix: The following is a bug fix patch for FreeBSD-current. --- mv.c.org Tue Oct 13 14:52:31 1998 +++ mv.c Thu Jun 24 22:49:36 1999 @@ -283,6 +283,8 @@ } if (fchmod(to_fd, sbp->st_mode)) warn("%s: set mode (was: 0%03o)", to, oldmode); + if (fchflags(to_fd, sbp->st_flags)) + warn("%s: set flags (was: 0%07o)", to, sbp->st_flags); tval[0].tv_sec = sbp->st_atime; tval[1].tv_sec = sbp->st_mtime; (Sorry for transformed TAB.) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message