From owner-freebsd-bugs@freebsd.org Sat Apr 1 16:50:52 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 958E1D2910E for ; Sat, 1 Apr 2017 16:50:52 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yb0-x231.google.com (mail-yb0-x231.google.com [IPv6:2607:f8b0:4002:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 604558F0 for ; Sat, 1 Apr 2017 16:50:52 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yb0-x231.google.com with SMTP id m133so22047198ybb.1 for ; Sat, 01 Apr 2017 09:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hcf8Fda+J3GfXERmdhCpQCAtLPK4J5G5wNGtjK6jiTs=; b=dRec5klBz9h9apAnXg2MXWE5gmeNGKI+SmBfj/QO0LJ7+pvvlUgi7FY68b7XuN/35D mQYXBPFEa5kGMqOnhtNjhPT7e53SOqWZ8U0scEED5JNxEkVa6myhHYk1NPkci5Tf1+6m pBNkkPZX6Lljs6vfEkbbXlY62oGgYYdEc7Hjw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hcf8Fda+J3GfXERmdhCpQCAtLPK4J5G5wNGtjK6jiTs=; b=BAbBD+zDWnOJCltqlzpoIwSQDXXKrQ9nCDGtjAvEnmY+Ujlus1zmmp0HzqhZTE8dgO C0cO4EFYE9KU0D9ZAiGymqJhgFQq7n8ua8SfDPfjbdeNNLOt8yBETmrTCCPLl4dF1F2x wKFL4sTiAcQrqM+aB3n86PpVAdocGZtzN3hDaqjI35cNqoq0c9r6u4xHDjdac++Y3rIL 7x/yl353HymHNZlcPe6oSEVEAvEiP5x2gp+SXpRe8AAKPUzv5qbuct8HXKY3RP5xcCWK RvbNvHKTVt+EyWl1tCRxMVfeWZowji8Tglfnj9KqFdjKkxbZ1YHzOUblAsP25yzdWmZe eBWw== X-Gm-Message-State: AFeK/H1ngpKxOXHabUqSVEVS2ncvmnatPlx8+eQJNqkBr2hp8/rlzakRMytu351qiu7Zt54To5dK0Fnw8sde0Q== X-Received: by 10.37.164.68 with SMTP id f62mr6108194ybi.78.1491065451219; Sat, 01 Apr 2017 09:50:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.246.4 with HTTP; Sat, 1 Apr 2017 09:50:20 -0700 (PDT) In-Reply-To: <8FDBAA2C-93B8-49FA-B3CD-5B709A93A5C4@perftech.com> References: <8FDBAA2C-93B8-49FA-B3CD-5B709A93A5C4@perftech.com> From: Eitan Adler Date: Sat, 1 Apr 2017 09:50:20 -0700 Message-ID: Subject: Re: Fix cp not to give chflags error on NFS To: Lewis Donzis , FreeBSD Standards Cc: freebsd-bugs@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Apr 2017 16:50:52 -0000 +freebsd-standards for folks that know more than I do On 1 April 2017 at 08:54, Lewis Donzis 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