Date: Wed, 23 Jun 1999 22:54:27 -0700 (PDT) From: shirai@nintendo.co.jp To: freebsd-gnats-submit@freebsd.org Subject: bin/12375: mv(1) cannot inherit the file flags. Message-ID: <19990624055427.2D48114CA8@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990624055427.2D48114CA8>