From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Oleg Pykhalov <go.wigust@gmail.com>
Cc: 71352-done@debbugs.gnu.org
Subject: bug#71352: branch master updated: services: nix: Mount Nix store read only.
Date: Sun, 23 Jun 2024 22:47:33 -0400 [thread overview]
Message-ID: <87h6dj6oqi.fsf@gmail.com> (raw)
In-Reply-To: <87tti625fu.fsf@gmail.com> (Maxim Cournoyer's message of "Wed, 05 Jun 2024 22:03:33 -0400")
Hi Oleg,
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
> Hi Oleg,
>
> [...]
>
>>> Are these chown still useful in the activation snippet?
>>>
>>> (define (nix-activation _)
>>> ;; Return the activation gexp.
>>> #~(begin
>>> (use-modules (guix build utils)
>>> (srfi srfi-26))
>>> (for-each (cut mkdir-p <>) '("/nix/store" "/nix/var/log"
>>> "/nix/var/nix/gcroots/per-user"
>>> "/nix/var/nix/profiles/per-user"))
>>> (chown "/nix/store"
>>> (passwd:uid (getpw "root")) (group:gid (getpw "nixbld01")))
>>> (chmod "/nix/store" #o775)
>>> (for-each (cut chmod <> #o777) '("/nix/var/nix/profiles"
>>> "/nix/var/nix/profiles/per-user"))))
>>>
>>> If they are useful only on the first time, perhaps we could catch the
>>> exceptions for when it runs on an already read-only mounted /nix/store?
>>
>> Indeed, it is a good idea.
>>
>> A hotfix for the issue was discussed and implemented. It has already
>> been pushed to the master branch. The fix involves a simple
>> 'file-exists?' check. You can find more details in the discussion at
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71320
>>
>> What do you think is preferable in this scenario – catching exceptions
>> or sticking with '(unless (file-exists? ...))'? Your thoughts on the
>> best approach here?
>
> Exceptions are usually better than 'check then do' as they avoid the
> TOCTTOU (time-of-check to time-of-use) class of bugs/vulnerabilities.
I'm closing this for now; I'm satisfied that working order has been
restored :-).
--
Thanks,
Maxim
prev parent reply other threads:[~2024-06-24 2:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <171695309234.24183.12881718488458327568@vcs2.savannah.gnu.org>
2024-06-04 2:34 ` bug#71352: branch master updated: services: nix: Mount Nix store read only Maxim Cournoyer
2024-06-04 8:34 ` Oleg Pykhalov
2024-06-06 2:03 ` Maxim Cournoyer
2024-06-24 2:47 ` Maxim Cournoyer [this message]
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=87h6dj6oqi.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=71352-done@debbugs.gnu.org \
--cc=go.wigust@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 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).