[PATCH 0/3] Clean out /run upon boot

  • Done
  • quality assurance status badge
Details
3 participants
  • Hilton Chain
  • Ludovic Courtès
  • Vagrant Cascadian
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 31 Aug 21:42 +0200
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
cover.1725133215.git.ludo@gnu.org
Hello,

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
L
L
Ludovic Courtès wrote on 31 Aug 21:47 +0200
[PATCH 1/3] services: cleanup: Run under C.UTF-8 locale.
(address . 72920@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
19fa1716cae737ab4b1c952da21167b36d22b4b3.1725133215.git.ludo@gnu.org
* 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(-)

Toggle diff (19 lines)
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
L
L
Ludovic Courtès wrote on 31 Aug 21:47 +0200
[PATCH 2/3] services: cleanup: Create directories with the right mode upfront.
(address . 72920@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
ddcf65c4d60e37f9427f18b56ea7e740e13bb1a9.1725133215.git.ludo@gnu.org
* 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(-)

Toggle diff (19 lines)
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
L
L
Ludovic Courtès wrote on 31 Aug 21:47 +0200
[PATCH 3/3] services: cleanup: Delete /run upon boot.
(address . 72920@debbugs.gnu.org)
32c6680a30075c7885a15dfe5fc3f3a8470244f3.1725133215.git.ludo@gnu.org

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

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

Toggle diff (28 lines)
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
V
V
Vagrant Cascadian wrote on 20 Sep 23:26 +0200
Re: [bug#72920] [PATCH 0/3] Clean out /run upon boot
8734lukoev.fsf@wireframe
On 2024-08-31, Ludovic Courtès wrote:
Toggle quote (5 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCZu3oaAAKCRDcUY/If5cW
qmR4AP0d/G8/mlAelJUR8hv4R4Bbpws/YhbEef9A0J7ret+shAD6ArNIowpg4bCH
6kLn33u7J+854xvPpJtWlj6PR2nCYwE=
=STTZ
-----END PGP SIGNATURE-----

H
H
Hilton Chain wrote on 21 Sep 03:11 +0200
Re: [bug#72920] [PATCH 2/3] services: cleanup: Create directories with the right mode upfront.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 72920@debbugs.gnu.org)
87jzf595ff.wl-hako@ultrarare.space
Hi Ludo,
On Sun, 01 Sep 2024 03:47:23 +0800,
Ludovic Courtès wrote:
Toggle quote (26 lines)
>
> * 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:
Toggle snippet (5 lines)
$ guile -c '(mkdir "/tmp/test" #o1777)' && stat /tmp/test
[...]
Access: (1755/drwxr-xr-t) Uid: ( 1000/ hako) Gid: ( 998/ users)
[...]
Toggle snippet (5 lines)
$ guile -c '(and (mkdir "/tmp/test2") (chmod "/tmp/test2" #o1777))' && stat /tmp/test2
[...]
Access: (1777/drwxrwxrwt) Uid: ( 1000/ hako) Gid: ( 998/ users)
[...]
Thanks
L
L
Ludovic Courtès wrote on 25 Sep 16:26 +0200
Re: [bug#72920] [PATCH 0/3] Clean out /run upon boot
(name . Vagrant Cascadian)(address . vagrant@debian.org)
8734lnu7we.fsf@gnu.org
Vagrant Cascadian <vagrant@debian.org> skribis:

Toggle quote (8 lines)
> 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’.
Closed
L
L
Ludovic Courtès wrote on 25 Sep 18:14 +0200
Re: [bug#72920] [PATCH 2/3] services: cleanup: Create directories with the right mode upfront.
(name . Hilton Chain)(address . hako@ultrarare.space)(address . 72920-done@debbugs.gnu.org)
871q17sobn.fsf@gnu.org
Hi Hilton,

Hilton Chain <hako@ultrarare.space> skribis:


[...]

Toggle quote (16 lines)
>> - (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’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 72920@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 72920
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch