GNU bug report logs - #26353
GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames

Previous Next

Package: guix;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Mon, 3 Apr 2017 18:57:02 UTC

Severity: important

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 26353 <at> debbugs.gnu.org
Subject: Re: bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like
 "ä" are used in filenames
Date: Sun, 23 Apr 2017 01:30:56 +0200
Hello,

Did you have a chance to look at this patch?

TIA,
Ludo’.

ludo <at> gnu.org (Ludovic Courtès) skribis:

> Hi Danny,
>
> Danny Milosavljevic <dannym <at> scratchpost.org> skribis:
>
>> the GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames.  It will just leave them there.
>>
>> For example I have an immortal file "/tmp/!x!home!dannym!scratchpost.org!www!mirror!science!physics!03._Relativitätstheorie!.webseealso~".
>
> The problem is that the “activation scripts” run in the C locale and
> thus Guile interprets file names in this locale encoding (i.e., ASCII),
> which fails.
>
> I believe the attached patch mostly fixes the problem.  Could you try
> and report back?
>
> I say “mostly” because if /tmp contains a file in an encoding other than
> that of the system locale, we still have a problem.
>
> Once we’ve switched to Guile 2.2, we should probably force use of an
> ISO-8859-1 locale to avoid file name decoding altogether.
>
> Thanks,
> Ludo’.
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index 9f6e323e1..500724eec 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -248,9 +248,9 @@ directory."
>    ;; The service that produces the boot script.
>    (service boot-service-type #t))
>  
> -(define (cleanup-gexp _)
> +(define (cleanup-gexp locale)
>    "Return as a monadic value a gexp to clean up /tmp and similar places upon
> -boot."
> +boot.  Run with LOCALE to ensure file names are properly decoded."
>    (with-monad %store-monad
>      (with-imported-modules '((guix build utils))
>        (return #~(begin
> @@ -272,6 +272,13 @@ boot."
>                                                  #t))))
>                      ;; Ignore I/O errors so the system can boot.
>                      (fail-safe
> +                     ;; Guile decodes file names according to the current
> +                     ;; locale's encoding so attempt to use an appropriate
> +                     ;; locale.  See <https://bugs.gnu.org/26353>.
> +                     ;; TODO: With Guile 2.2, choose an ISO-8859-1 locale
> +                     ;; to disable decoding altogether.
> +                     (setlocale LC_CTYPE #$locale)
> +
>                       (delete-file-recursively "/tmp")
>                       (delete-file-recursively "/var/run")
>                       (mkdir "/tmp")
> @@ -280,7 +287,8 @@ boot."
>                       (chmod "/var/run" #o755))))))))
>  
>  (define cleanup-service-type
> -  ;; Service that cleans things up in /tmp and similar.
> +  ;; Service that cleans things up in /tmp and similar.  Its value is the name
> +  ;; of a locale to install before traversing these directories.
>    (service-type (name 'cleanup)
>                  (extensions
>                   (list (service-extension boot-service-type
> diff --git a/gnu/system.scm b/gnu/system.scm
> index 0f52351cf..5e0d2db7d 100644
> --- a/gnu/system.scm
> +++ b/gnu/system.scm
> @@ -309,7 +309,8 @@ a container or that of a \"bare metal\" system."
>             ;; activation code.
>             %shepherd-root-service
>             %activation-service
> -           (service cleanup-service-type #f)
> +           (service cleanup-service-type
> +                    (operating-system-locale os))
>  
>             (pam-root-service (operating-system-pam-services os))
>             (account-service (append (operating-system-accounts os)




This bug report was last modified 6 years and 334 days ago.

Previous Next


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