[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are
From: |
Ludovic Courtès |
Subject: |
bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames |
Date: |
Sun, 23 Apr 2017 01:30:56 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hello,
Did you have a chance to look at this patch?
TIA,
Ludo’.
address@hidden (Ludovic Courtès) skribis:
> Hi Danny,
>
> Danny Milosavljevic <address@hidden> 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)