From owner-svn-src-head@FreeBSD.ORG Fri Jun 27 22:23:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC20B747; Fri, 27 Jun 2014 22:23:27 +0000 (UTC) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 71A1A23EE; Fri, 27 Jun 2014 22:23:27 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 0304C358C5F; Sat, 28 Jun 2014 00:23:23 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id CD77528497; Sat, 28 Jun 2014 00:23:23 +0200 (CEST) Date: Sat, 28 Jun 2014 00:23:23 +0200 From: Jilles Tjoelker To: Xin LI Subject: Re: svn commit: r267977 - head/bin/mv Message-ID: <20140627222323.GA43131@stack.nl> References: <201406271957.s5RJvs6j074326@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201406271957.s5RJvs6j074326@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jun 2014 22:23:27 -0000 On Fri, Jun 27, 2014 at 07:57:54PM +0000, Xin LI wrote: > Author: delphij > Date: Fri Jun 27 19:57:54 2014 > New Revision: 267977 > URL: http://svnweb.freebsd.org/changeset/base/267977 > Log: > Always set UF_ARCHIVE on target (because they are by definition new files > and should be archived) and ignore error when we can't set it (e.g. NFS). > Reviewed by: ken > MFC after: 2 weeks > Modified: > head/bin/mv/mv.c > Modified: head/bin/mv/mv.c > ============================================================================== > --- head/bin/mv/mv.c Fri Jun 27 19:50:30 2014 (r267976) > +++ head/bin/mv/mv.c Fri Jun 27 19:57:54 2014 (r267977) > @@ -337,8 +337,8 @@ err: if (unlink(to)) > * on a file that we copied, i.e., that we didn't create.) > */ > errno = 0; > - if (fchflags(to_fd, sbp->st_flags)) > - if (errno != EOPNOTSUPP || sbp->st_flags != 0) > + if (fchflags(to_fd, sbp->st_flags | UF_ARCHIVE)) > + if (errno != EOPNOTSUPP || ((sbp->st_flags & ~UF_ARCHIVE) != 0)) > warn("%s: set flags (was: 0%07o)", to, sbp->st_flags); > > tval[0].tv_sec = sbp->st_atime; The part ignoring failures to set UF_ARCHIVE is OK. However, it seems inconsistent to set UF_ARCHIVE on a cross-filesystem mv of a single file, but not on a cross-filesystem mv of a directory tree or a file newly created via shell output redirection. If UF_ARCHIVE is supposed to be set automatically, I think this should be done in the kernel, like msdosfs already does. However, I'm not sure this is actually a useful feature: backup programs are smarter than an archive attribute these days. -- Jilles Tjoelker