mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
git-download: Set locale to deal with Unicode in git metadata.
Without this the git-fetch GEXP is run in an environment that uses ASCII character encoding when strings are crossing the Guile - C boundary. It means that e.g. tag names that have Unicode chars in them will cause problems, e.g. when walking and deleting the .git directory. An example in the wild: https://github.com/klauspost/pgzip/tags Fixes <https://issues.guix.gnu.org/54893>. * guix/git-download.scm (git-fetch): Call 'setenv' and 'setlocale' to set it to en_US.utf8. * gnu/packages/commencement.scm (glibc-utf8-locales-final): Make public. Add 'properties' field. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
8540c2d86c
commit
8852f911ff
2 changed files with 16 additions and 1 deletions
|
@ -3613,7 +3613,7 @@ (define-public guile-final
|
|||
(with-boot4 (hidden-package
|
||||
(package-with-bootstrap-guile guile-3.0/fixed))))
|
||||
|
||||
(define glibc-utf8-locales-final
|
||||
(define-public glibc-utf8-locales-final
|
||||
;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
|
||||
;; by the build processes afterwards so their 'scm_to_locale_string' works
|
||||
;; with the full range of Unicode codepoints (remember
|
||||
|
@ -3621,6 +3621,8 @@ (define glibc-utf8-locales-final
|
|||
;; function.)
|
||||
(package
|
||||
(inherit glibc-utf8-locales)
|
||||
(properties `((hidden? . #t)
|
||||
,@(package-properties glibc-utf8-locales)))
|
||||
(native-inputs
|
||||
`(("glibc" ,glibc-final)
|
||||
("gzip" ,(with-boot4 gzip))))))
|
||||
|
|
|
@ -104,6 +104,12 @@ (define guile-zlib
|
|||
(define gnutls
|
||||
(module-ref (resolve-interface '(gnu packages tls)) 'gnutls))
|
||||
|
||||
(define glibc-locales
|
||||
;; Note: pick the '-final' variant to avoid circular dependency on
|
||||
;; i586-gnu, where 'glibc-utf8-locales' indirectly depends on Git.
|
||||
(module-ref (resolve-interface '(gnu packages commencement))
|
||||
'glibc-utf8-locales-final))
|
||||
|
||||
(define modules
|
||||
(delete '(guix config)
|
||||
(source-module-closure '((guix build git)
|
||||
|
@ -125,6 +131,13 @@ (define build
|
|||
(define recursive?
|
||||
(call-with-input-string (getenv "git recursive?") read))
|
||||
|
||||
;; Let Guile interpret file names as UTF-8, otherwise
|
||||
;; 'delete-file-recursively' might fail to delete all of
|
||||
;; '.git'--see <https://issues.guix.gnu.org/54893>.
|
||||
(setenv "GUIX_LOCPATH"
|
||||
#+(file-append glibc-locales "/lib/locale"))
|
||||
(setlocale LC_ALL "en_US.utf8")
|
||||
|
||||
;; The 'git submodule' commands expects Coreutils, sed,
|
||||
;; grep, etc. to be in $PATH.
|
||||
(set-path-environment-variable "PATH" '("bin")
|
||||
|
|
Loading…
Reference in a new issue