svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs

Kenneth D. Merry ken at FreeBSD.ORG
Fri Jun 27 20:18:34 UTC 2014


On Fri, Jun 27, 2014 at 12:48:29 -0700, Xin LI wrote:
> Hi,
> 
> Craig have hit an interesting issue today, where he tried to 'mv' a file
> from ZFS dataset to a NFS mount, 'mv' bails out because chflags failed.
> 
> I think it's probably sensible to have mv ignoring UF_ARCHIVE, and set the
> flag on the target unconditionally?  i.e.:
> 
> Index: mv.c
> ===================================================================
> --- mv.c (revision 267940)
> +++ mv.c (working copy)
> @@ -337,8 +337,8 @@
>   * 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;

Yes, that sounds like a good way to do it.

Ken
-- 
Kenneth Merry
ken at FreeBSD.ORG


More information about the svn-src-all mailing list