From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4PYkLERVrV7rHgAA0tVLHw (envelope-from ) for ; Sat, 02 May 2020 11:11:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id cIV1O05VrV6JXAAAbx9fmQ (envelope-from ) for ; Sat, 02 May 2020 11:11:10 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 326CC9435D1 for ; Sat, 2 May 2020 11:11:09 +0000 (UTC) Received: from localhost ([::1]:56276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUq32-0001DI-UT for larch@yhetil.org; Sat, 02 May 2020 07:11:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUq21-00080W-HA for guix-patches@gnu.org; Sat, 02 May 2020 07:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUq21-0000zg-02 for guix-patches@gnu.org; Sat, 02 May 2020 07:10:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUq1y-0000yk-2D for guix-patches@gnu.org; Sat, 02 May 2020 07:10:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jUq1x-0005Xf-Oa for guix-patches@gnu.org; Sat, 02 May 2020 07:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40955] [PATCH 2/5] build: install: Ignore chown exceptions. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 May 2020 11:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40955 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 40955@debbugs.gnu.org Received: via spool by 40955-submit@debbugs.gnu.org id=B40955.158841779421287 (code B ref 40955); Sat, 02 May 2020 11:10:01 +0000 Received: (at 40955) by debbugs.gnu.org; 2 May 2020 11:09:54 +0000 Received: from localhost ([127.0.0.1]:51378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUq1q-0005XH-89 for submit@debbugs.gnu.org; Sat, 02 May 2020 07:09:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUq1o-0005X3-Qg for 40955@debbugs.gnu.org; Sat, 02 May 2020 07:09:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55014) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUq1j-0000hH-JT; Sat, 02 May 2020 07:09:47 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45082 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jUq1h-0000QH-6z; Sat, 02 May 2020 07:09:47 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200429084756.25072-1-m.othacehe@gmail.com> <20200429084756.25072-2-m.othacehe@gmail.com> Date: Sat, 02 May 2020 13:09:43 +0200 In-Reply-To: <20200429084756.25072-2-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Wed, 29 Apr 2020 10:47:53 +0200") Message-ID: <87wo5ua8zs.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Scan-Result: default: False [-1.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.49492272584779]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.15), country: US(-0.00), ip: 2001:470:142::17(-0.49)]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_IN_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; FROM_NEQ_ENVFROM(0.00)[ludo@gnu.org,guix-patches-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[gnu.org]; HAS_LIST_UNSUB(-0.01)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_SEVEN(0.00)[10]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: dWS41TCBGOFH Hey! Mathieu Othacehe skribis: > Changing ownership may require root permissions. As image can now be gene= rated > without root permissions (no VM involved), ignore those exceptions. > > * gnu/build/install.scm (evaluate-populate-directive): Ignore chown > exceptions. > --- > gnu/build/install.scm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gnu/build/install.scm b/gnu/build/install.scm > index c0d4d44091..0b0d01cf86 100644 > --- a/gnu/build/install.scm > +++ b/gnu/build/install.scm > @@ -63,7 +63,9 @@ directory TARGET." > (('directory name uid gid) > (let ((dir (string-append target name))) > (mkdir-p dir) > - (chown dir uid gid))) > + ;; This will fail if this is not run from a VM, ignore those > + ;; errors. > + (false-if-exception (chown dir uid gid)))) We still want the directives to be honored though. How about having a procedure like: (define (ensure-ownership file uid gid) (catch 'system-error (lambda () (chown file uid gid)) (lambda args (if (=3D EPERM (system-error-errno args)) (let ((st (lstat file))) (or (and (=3D uid (stat:uid st)) (=3D gid (stat:gid st))) (apply throw args))) (apply throw args))))) and use that? Or perhaps that=E2=80=99s still not helpful but we instead need a guarantee elsewhere that the UID/GID is going to be honored, perhaps by calling: (evaluate-populate-directive =E2=80=A6 #:default-gid 0 #:default-uid 0) and have it ignore chown when it matches #:default-uid and #:default-gid. Thoughts? Ludo=E2=80=99.