GNU bug report logs - #72920
[PATCH 0/3] Clean out /run upon boot

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sat, 31 Aug 2024 19:44:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72920 in the body.
You can then email your comments to 72920 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to vagrant <at> debian.org, 64775 <at> debbugs.gnu.org, 72670 <at> debbugs.gnu.org, guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Sat, 31 Aug 2024 19:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to vagrant <at> debian.org, 64775 <at> debbugs.gnu.org, 72670 <at> debbugs.gnu.org, guix-patches <at> gnu.org. (Sat, 31 Aug 2024 19:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 0/3] Clean out /run upon boot
Date: Sat, 31 Aug 2024 21:42:36 +0200
Hello,

This fixes <https://issues.guix.gnu.org/64775> and
<https://issues.guix.gnu.org/72670>, the latter being an illustration
of the former.

Thoughts?

Thanks,
Ludo’.

Ludovic Courtès (3):
  services: cleanup: Run under C.UTF-8 locale.
  services: cleanup: Create directories with the right mode upfront.
  services: cleanup: Delete /run upon boot.

 gnu/services.scm | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)


base-commit: 61a7930cb03f5eb9e8003bade21d61262c3db8df
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Sat, 31 Aug 2024 19:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 72920 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 72920 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 1/3] services: cleanup: Run under C.UTF-8 locale.
Date: Sat, 31 Aug 2024 21:47:22 +0200
* gnu/services.scm (cleanup-gexp): Use “C.UTF-8” instead of
“en_US.utf8”; leave ‘GUIX_LOCPATH’ unchanged.

Change-Id: I8ba4f5343f168b0fd4d7310916f47ee98003d8ef
---
 gnu/services.scm | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index f0bbbb27a5..ce13c087ce 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -656,11 +656,7 @@ (define (cleanup-gexp _)
 
            ;; Force file names to be decoded as UTF-8.  See
            ;; <https://bugs.gnu.org/26353>.
-           (setenv "GUIX_LOCPATH"
-                   #+(file-append
-                      (libc-utf8-locales-for-target (%current-system))
-                      "/lib/locale"))
-           (setlocale LC_CTYPE "en_US.utf8")
+           (setlocale LC_CTYPE "C.UTF-8")
            (delete-file-recursively "/tmp")
            (delete-file-recursively "/var/run")
 
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Sat, 31 Aug 2024 19:49:03 GMT) Full text and rfc822 format available.

Message #11 received at 72920 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 72920 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 2/3] services: cleanup: Create directories with the right mode
 upfront.
Date: Sat, 31 Aug 2024 21:47:23 +0200
* gnu/services.scm (cleanup-gexp): Pass mode as second argument to
‘mkdir’; remove ‘chmod’ calls.

Change-Id: I8ac2dde0ca5d9bd6b2ef104d77141d8463d8b3fa
---
 gnu/services.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index ce13c087ce..4a8e2b3b15 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -660,10 +660,8 @@ (define (cleanup-gexp _)
            (delete-file-recursively "/tmp")
            (delete-file-recursively "/var/run")
 
-           (mkdir "/tmp")
-           (chmod "/tmp" #o1777)
-           (mkdir "/var/run")
-           (chmod "/var/run" #o755)
+           (mkdir "/tmp" #o1777)
+           (mkdir "/var/run" #o755)
            (delete-file-recursively "/run/udev/watch.old"))))))
 
 (define cleanup-service-type
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Sat, 31 Aug 2024 19:49:03 GMT) Full text and rfc822 format available.

Message #14 received at 72920 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 72920 <at> debbugs.gnu.org
Cc: Vagrant Cascadian <vagrant <at> debian.org>,
 Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 3/3] services: cleanup: Delete /run upon boot.
Date: Sat, 31 Aug 2024 21:47:24 +0200
Fixes <https://issues.guix.gnu.org/64775>.

* gnu/services.scm (cleanup-gexp): Delete /run and recreate it.

Reported-by: Vagrant Cascadian <vagrant <at> debian.org>
Change-Id: Iae39f1aa734712a3755b24b156802ec0282d3f14
---
 gnu/services.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index 4a8e2b3b15..9d278f11ab 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -632,7 +632,7 @@ (define (cleanup-gexp _)
     #~(begin
         (use-modules (guix build utils))
 
-        ;; Clean out /tmp and /var/run.
+        ;; Clean out /tmp, /var/run, and /run.
         ;;
         ;; XXX This needs to happen before service activations, so it
         ;; has to be here, but this also implicitly assumes that /tmp
@@ -659,10 +659,11 @@ (define (cleanup-gexp _)
            (setlocale LC_CTYPE "C.UTF-8")
            (delete-file-recursively "/tmp")
            (delete-file-recursively "/var/run")
+           (delete-file-recursively "/run")
 
            (mkdir "/tmp" #o1777)
            (mkdir "/var/run" #o755)
-           (delete-file-recursively "/run/udev/watch.old"))))))
+           (mkdir "/run" #o755))))))
 
 (define cleanup-service-type
   ;; Service that cleans things up in /tmp and similar.
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Fri, 20 Sep 2024 21:28:02 GMT) Full text and rfc822 format available.

Message #17 received at 72920 <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: Ludovic Courtès <ludo <at> gnu.org>, 72920 <at> debbugs.gnu.org
Cc: 64775 <at> debbugs.gnu.org, 72670 <at> debbugs.gnu.org
Subject: Re: [bug#72920] [PATCH 0/3] Clean out /run upon boot
Date: Fri, 20 Sep 2024 14:26:00 -0700
[Message part 1 (text/plain, inline)]
On 2024-08-31, Ludovic Courtès wrote:
> Ludovic Courtès (3):
>   services: cleanup: Run under C.UTF-8 locale.
>   services: cleanup: Create directories with the right mode upfront.
>   services: cleanup: Delete /run upon boot.

As they say, Looks Good To Me. :)

live well,
  vagrant
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Sat, 21 Sep 2024 01:13:01 GMT) Full text and rfc822 format available.

Message #20 received at 72920 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 72920 <at> debbugs.gnu.org
Subject: Re: [bug#72920] [PATCH 2/3] services: cleanup: Create directories
 with the right mode upfront.
Date: Sat, 21 Sep 2024 09:11:32 +0800
Hi Ludo,

On Sun, 01 Sep 2024 03:47:23 +0800,
Ludovic Courtès wrote:
>
> * gnu/services.scm (cleanup-gexp): Pass mode as second argument to
> ‘mkdir’; remove ‘chmod’ calls.
>
> Change-Id: I8ac2dde0ca5d9bd6b2ef104d77141d8463d8b3fa
> ---
>  gnu/services.scm | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index ce13c087ce..4a8e2b3b15 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -660,10 +660,8 @@ (define (cleanup-gexp _)
>             (delete-file-recursively "/tmp")
>             (delete-file-recursively "/var/run")
>
> -           (mkdir "/tmp")
> -           (chmod "/tmp" #o1777)
> -           (mkdir "/var/run")
> -           (chmod "/var/run" #o755)
> +           (mkdir "/tmp" #o1777)
> +           (mkdir "/var/run" #o755)
>             (delete-file-recursively "/run/udev/watch.old"))))))
>
>  (define cleanup-service-type

It seems that the mode is not applied correctly:

--8<---------------cut here---------------start------------->8---
$ guile -c '(mkdir "/tmp/test" #o1777)' && stat /tmp/test
[...]
Access: (1755/drwxr-xr-t)  Uid: ( 1000/    hako)   Gid: (  998/   users)
[...]
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
$ guile -c '(and (mkdir "/tmp/test2") (chmod "/tmp/test2" #o1777))' && stat /tmp/test2
[...]
Access: (1777/drwxrwxrwt)  Uid: ( 1000/    hako)   Gid: (  998/   users)
[...]
--8<---------------cut here---------------end--------------->8---

Thanks

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 25 Sep 2024 14:48:02 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludo <at> gnu.org>:
bug acknowledged by developer. (Wed, 25 Sep 2024 14:48:03 GMT) Full text and rfc822 format available.

Message #25 received at 72920-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Vagrant Cascadian <vagrant <at> debian.org>
Cc: 64775-done <at> debbugs.gnu.org, 72670-done <at> debbugs.gnu.org,
 72920-done <at> debbugs.gnu.org
Subject: Re: [bug#72920] [PATCH 0/3] Clean out /run upon boot
Date: Wed, 25 Sep 2024 16:26:09 +0200
Vagrant Cascadian <vagrant <at> debian.org> skribis:

> On 2024-08-31, Ludovic Courtès wrote:
>> Ludovic Courtès (3):
>>   services: cleanup: Run under C.UTF-8 locale.
>>   services: cleanup: Create directories with the right mode upfront.
>>   services: cleanup: Delete /run upon boot.
>
> As they say, Looks Good To Me. :)

Thanks, pushed as c250033aa69f35e64949a87fd8482b253dd416b4, except for
the first one because I remembered that C.UTF-8 is unavailable in
cross-compiled programs.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#72920; Package guix-patches. (Wed, 25 Sep 2024 16:15:02 GMT) Full text and rfc822 format available.

Message #28 received at 72920-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: 72920-done <at> debbugs.gnu.org
Subject: Re: [bug#72920] [PATCH 2/3] services: cleanup: Create directories
 with the right mode upfront.
Date: Wed, 25 Sep 2024 18:14:20 +0200
Hi Hilton,

Hilton Chain <hako <at> ultrarare.space> skribis:


[...]

>> -           (mkdir "/tmp")
>> -           (chmod "/tmp" #o1777)
>> -           (mkdir "/var/run")
>> -           (chmod "/var/run" #o755)
>> +           (mkdir "/tmp" #o1777)
>> +           (mkdir "/var/run" #o755)
>>             (delete-file-recursively "/run/udev/watch.old"))))))
>>
>>  (define cleanup-service-type
>
> It seems that the mode is not applied correctly:
>
> $ guile -c '(mkdir "/tmp/test" #o1777)' && stat /tmp/test
> [...]
> Access: (1755/drwxr-xr-t)  Uid: ( 1000/    hako)   Gid: (  998/   users)

Oops, I saw your message too late, apologies.

Commit f92151133da4b98f98e755ce0996e8be59acac72 fixes that and adds a
test so we can catch it next time.

The story is that the 2nd argument to ‘mkdir’ is and’ed with umask,
something that I had forgotten.

Thanks and sorry for the mess.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Oct 2024 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 294 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.