all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Mathieu Othacehe <m.othacehe@gmail.com>
Cc: 40955@debbugs.gnu.org
Subject: [bug#40955] [PATCH 2/5] build: install: Ignore chown exceptions.
Date: Sat, 02 May 2020 13:09:43 +0200	[thread overview]
Message-ID: <87wo5ua8zs.fsf@gnu.org> (raw)
In-Reply-To: <20200429084756.25072-2-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Wed, 29 Apr 2020 10:47:53 +0200")

Hey!

Mathieu Othacehe <m.othacehe@gmail.com> skribis:

> Changing ownership may require root permissions. As image can now be generated
> 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 (= EPERM (system-error-errno args))
            (let ((st (lstat file)))
              (or (and (= uid (stat:uid st)) (= gid (stat:gid st)))
                  (apply throw args)))
            (apply throw args)))))

and use that?

Or perhaps that’s 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 … #:default-gid 0 #:default-uid 0)

and have it ignore chown when it matches #:default-uid and
#:default-gid.

Thoughts?

Ludo’.




  reply	other threads:[~2020-05-02 11:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  8:38 [bug#40955] [PATCH 0/5] Add new image API Mathieu Othacehe
2020-04-29  8:47 ` [bug#40955] [PATCH 1/5] build: store-copy: Export file-size procedure Mathieu Othacehe
2020-04-29  8:47   ` [bug#40955] [PATCH 2/5] build: install: Ignore chown exceptions Mathieu Othacehe
2020-05-02 11:09     ` Ludovic Courtès [this message]
2020-05-05 13:42       ` Mathieu Othacehe
2020-04-29  8:47   ` [bug#40955] [PATCH 3/5] build: bootloader: Add install-efi procedure Mathieu Othacehe
2020-05-02 12:16     ` Ludovic Courtès
2020-05-05 13:43       ` Mathieu Othacehe
2020-04-29  8:47   ` [bug#40955] [PATCH 4/5] image: Add a new API Mathieu Othacehe
2020-05-02 12:50     ` Ludovic Courtès
2020-05-05 13:52       ` Mathieu Othacehe
2020-05-02 13:02     ` Tobias Geerinckx-Rice via Guix-patches via
2020-05-05 14:12       ` Mathieu Othacehe
2020-04-29  8:47   ` [bug#40955] [PATCH 5/5] vm: Remove obsolete procedures Mathieu Othacehe
2020-05-02 12:52     ` Ludovic Courtès
2020-05-05 14:02       ` Mathieu Othacehe
2020-05-05 14:16       ` bug#40955: " Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wo5ua8zs.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=40955@debbugs.gnu.org \
    --cc=m.othacehe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.