From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 26353@debbugs.gnu.org
Subject: bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames
Date: Wed, 12 Apr 2017 15:04:01 +0200 [thread overview]
Message-ID: <87poghdbge.fsf@gnu.org> (raw)
In-Reply-To: <20170403202146.2a9317ce@scratchpost.org> (Danny Milosavljevic's message of "Mon, 3 Apr 2017 20:56:32 +0200")
[-- Attachment #1: Type: text/plain, Size: 879 bytes --]
Hi Danny,
Danny Milosavljevic <dannym@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’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2301 bytes --]
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)
next prev parent reply other threads:[~2017-04-12 13:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 18:56 bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames Danny Milosavljevic
2017-04-12 13:04 ` Ludovic Courtès [this message]
2017-04-22 23:30 ` Ludovic Courtès
2017-04-23 0:14 ` Danny Milosavljevic
2017-05-01 14:51 ` bug#26353: TeX Live Ludovic Courtès
2017-05-01 15:11 ` Marius Bakke
2017-05-01 21:24 ` Ludovic Courtès
2017-06-01 11:17 ` ng0
2017-05-02 6:31 ` Ricardo Wurmus
2017-06-02 8:32 ` Ricardo Wurmus
2017-06-02 15:06 ` Ludovic Courtès
2017-06-03 19:14 ` Ricardo Wurmus
2017-04-23 2:03 ` bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames Danny Milosavljevic
2017-05-01 20:59 ` Ludovic Courtès
2017-06-01 10:57 ` bug#26353: VFS name encoding Danny Milosavljevic
2017-06-01 11:28 ` Ludovic Courtès
2017-12-14 22:28 ` bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "ä" are used in filenames Danny Milosavljevic
2017-12-15 10:27 ` Ludovic Courtès
2018-06-09 9:30 ` Danny Milosavljevic
2018-06-20 8:07 ` Ludovic Courtès
2018-06-19 20:17 ` Nils Gillmann
2018-06-19 20:47 ` Ludovic Courtès
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87poghdbge.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=26353@debbugs.gnu.org \
--cc=dannym@scratchpost.org \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.