From: "Ludovic Courtès" <ludo@gnu.org>
To: Josselin Poiret <dev@jpoiret.xyz>
Cc: 51442@debbugs.gnu.org
Subject: bug#51442: Non-default umask when using guix system leads to wrong file permissions
Date: Fri, 29 Oct 2021 21:10:52 +0200 [thread overview]
Message-ID: <87k0hvy7cz.fsf@gnu.org> (raw)
In-Reply-To: <87wnlya3tn.fsf@jpoiret.xyz> (Josselin Poiret's message of "Wed, 27 Oct 2021 15:24:20 +0000")
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Hi,
Josselin Poiret <dev@jpoiret.xyz> skribis:
> As reported on IRC by wonko
> (https://logs.guix.gnu.org/guix/2021-10-27.log#115445),
wonko mentions files in /etc (those are created by the activation
snippets).
> when running ‘guix system’ under a different umask, some files are
> created with the wrong permissions. This can happen because ‘sudo’
> does by default keeps the umask it is running on (by ORing it with the
> default one, often 022).
>
> I'm not sure what would be the best way to go about this, I suggest
> checking if umask == #o022, and if not, print a warning and set it to
> #o022, and only in ‘guix system’.
Perhaps the best fix would be to set the umask explicitly before
activation snippets run, like so (untested):
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 669 bytes --]
diff --git a/gnu/services.scm b/gnu/services.scm
index 1655218f2d..b79436d3f3 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -617,6 +617,10 @@ (define actions
(use-modules (gnu build activation)
(guix build utils))
+ ;; Set the correct umask so files are created with the
+ ;; expected permissions.
+ (umask #o022)
+
;; Make sure the user accounting database exists. If it
;; does not exist, 'setutxent' does not create it and
;; thus there is no accounting at all.
[-- Attachment #3: Type: text/plain, Size: 30 bytes --]
WDYT?
Thanks,
Ludo’.
next prev parent reply other threads:[~2021-10-29 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 15:24 bug#51442: Non-default umask when using guix system leads to wrong file permissions Josselin Poiret via Bug reports for GNU Guix
2021-10-29 19:10 ` Ludovic Courtès [this message]
2021-10-30 20:48 ` Josselin Poiret via Bug reports for GNU Guix
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k0hvy7cz.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=51442@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).