Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Apr 2017 09:50:20 -0700
From:      Eitan Adler <lists@eitanadler.com>
To:        Lewis Donzis <lew@perftech.com>, FreeBSD Standards <freebsd-standards@freebsd.org>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: Fix cp not to give chflags error on NFS
Message-ID:  <CAF6rxgkG_SuuVH2HNc6Wd9v7XCQPfAxhfUZk1KQWB_pXyj-KeA@mail.gmail.com>
In-Reply-To: <8FDBAA2C-93B8-49FA-B3CD-5B709A93A5C4@perftech.com>
References:  <8FDBAA2C-93B8-49FA-B3CD-5B709A93A5C4@perftech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
+freebsd-standards for folks that know more than I do

On 1 April 2017 at 08:54, Lewis Donzis <lew@perftech.com> wrote:
> It's fairly annoying that cp has no way to suppress the chflags error whe=
n the destination file is on an NFS mount.  A bigger problem than the error=
 message is that it returns exit status 1, which causes things like make to=
 fail when there really was no error.
>
> What do you think about the following change to /usr/src/bin/cp/utils.c:
>
> 398c398
> <               if (fdval ?
> ---
>>               if ((fdval ?
> 401c401
> <                   chflags(to.p_path, fs->st_flags))) {
> ---
>>                   chflags(to.p_path, fs->st_flags))) && errno !=3D ENOTS=
UP) {
>
> which simply ignores the error if the destination filesystem doesn't supp=
ort chflags?

I believe POSIX requires this error:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html

=3D=3D=3D
The file permission bits and the S_ISUID and S_ISGID bits. Other,
implementation-defined, bits may be duplicated as well. If this
duplication fails for any reason, cp shall write a diagnostic message
to standard error.
=3D=3D=3D

We can possibly define "implementation defined bits" to not include
other flags if the flags are unsupported on the destination filesystem
but this seems weird to me.


--=20
Eitan Adler



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgkG_SuuVH2HNc6Wd9v7XCQPfAxhfUZk1KQWB_pXyj-KeA>