From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#26353: GuixSD /tmp cleaner fails to clean when Umlauts like "=?UTF-8?Q?=C3=A4?=" are used in filenames Date: Sun, 23 Apr 2017 01:30:56 +0200 Message-ID: <87mvb8f2a7.fsf@gnu.org> References: <20170403202146.2a9317ce@scratchpost.org> <87poghdbge.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d24Va-0000mj-Ls for bug-guix@gnu.org; Sat, 22 Apr 2017 19:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d24VW-0003KG-O4 for bug-guix@gnu.org; Sat, 22 Apr 2017 19:32:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:36684) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d24VW-0003Jy-Kl for bug-guix@gnu.org; Sat, 22 Apr 2017 19:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d24VW-00083x-FE for bug-guix@gnu.org; Sat, 22 Apr 2017 19:32:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87poghdbge.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 12 Apr 2017 15:04:01 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Danny Milosavljevic Cc: 26353@debbugs.gnu.org Hello, Did you have a chance to look at this patch? TIA, Ludo=E2=80=99. ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Hi Danny, > > Danny Milosavljevic skribis: > >> the GuixSD /tmp cleaner fails to clean when Umlauts like "=C3=A4" are us= ed 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=C3=A4tstheorie!.webseealso~". > > The problem is that the =E2=80=9Cactivation scripts=E2=80=9D 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 =E2=80=9Cmostly=E2=80=9D because if /tmp contains a file in an enco= ding other than > that of the system locale, we still have a problem. > > Once we=E2=80=99ve switched to Guile 2.2, we should probably force use of= an > ISO-8859-1 locale to avoid file name decoding altogether. > > Thanks, > Ludo=E2=80=99. > > 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)) >=20=20 > -(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 appropria= te > + ;; locale. See . > + ;; 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)))))))) >=20=20 > (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 th= e 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)) >=20=20 > (pam-root-service (operating-system-pam-services os)) > (account-service (append (operating-system-accounts os)