From 208122317aa87c4b168158eee36198c2b355825b Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 29 Sep 2019 10:44:53 +0100 Subject: Try setting the en_US.UTF-8 locale, if the normalised fails Older versions of the glibc-locales package just contain the UTF-8 variants, not utf8. --- guix-data-service/jobs/load-new-guix-revision.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'guix-data-service') diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index 5df8700..0046cb4 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -2,6 +2,7 @@ #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (ice-9 hash-table) + #:use-module (rnrs exceptions) #:use-module (json) #:use-module (squee) #:use-module (guix monads) @@ -773,7 +774,24 @@ WHERE job_id = $1" (setenv "GUIX_LOCPATH" guix-locpath) ; restore GUIX_LOCPATH ;; Normalise the locale for the inferior process - (inferior-eval '(setlocale LC_ALL "en_US.utf8") inf) + (catch + 'system-error + (lambda () + (inferior-eval '(setlocale LC_ALL "en_US.utf8") inf)) + (lambda (key . args) + (simple-format (current-error-port) + "warning: failed to set locale to en_US.utf8: ~A ~A\n" + key args) + (display "trying to setlocale to en_US.UTF-8 instead\n" + (current-error-port)) + (with-exception-handler + (lambda (key . args) + (simple-format + (current-error-port) + "warning: failed to set locale to en_US.UTF-8: ~A ~A\n" + key args)) + (lambda () + (inferior-eval '(setlocale LC_ALL "en_US.UTF-8") inf))))) (inferior-eval '(use-modules (srfi srfi-1) (srfi srfi-34) -- cgit v1.2.3