GNU bug report logs - #77214
`guix pull` fails with `autocrlf=true` in git config

Previous Next

Package: guix;

Reported by: Jodi Jodingtonstinski <jodijodingtondev <at> gmail.com>

Date: Sun, 23 Mar 2025 17:46:03 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Jodi Jodingtonstinski <jodijodingtondev <at> gmail.com>
Cc: 77214 <at> debbugs.gnu.org
Subject: bug#77214: `guix pull` fails with `autocrlf=true` in git config
Date: Fri, 11 Apr 2025 21:47:51 +0200
[Message part 1 (text/plain, inline)]
Hello,

Jodi Jodingtonstinski <jodijodingtondev <at> gmail.com> skribis:

> Ideally `guix pull` would ignore this setting (and possibly all user git
> settings?) if it does not work with it.
>  This causes errors such as:
>  `gnu/packages/music.scm:2732:1: invalid character in escape sequence:
> #\return`
> and can be resolved by disabling autocrlf and deleting
> `~/.cache/guix/checkouts` (thanks Rutherther)

I agree that ‘guix pull’ should ignore such settings; even if errors
like the one above did not occur, you’d get a checkout that’s different
at the binary level, and so no substitutes etc.

I think the patch below should do that, at least for new checkouts.

It would be great if you could try it and check that it works for you.
You can do that by:

  rm -rf ~/.cache/guix/checkouts
  git config --global core.autocrlf true
  ./pre-inst-env guix download --git \
     https://git.savannah.gnu.org/git/shepherd.git
  
Although I’m not sure ‘autocrlf’ would fire on this repo (why does it
fire in the first place on the Git repo⁈).

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/git.scm b/guix/git.scm
index 4164531c0b..0a7bcea9bb 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe <at> gmail.com>
-;;; Copyright © 2018-2024 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2018-2025 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2021 Kyle Meyer <kyle <at> kyleam.com>
 ;;; Copyright © 2021 Marius Bakke <marius <at> gnu.org>
 ;;; Copyright © 2022 Maxime Devos <maximedevos <at> telenet.be>
@@ -236,10 +236,17 @@ (define* (clone* url directory #:key (verify-certificate? #t))
     (lambda ()
       (mkdir-p directory)
 
-      (clone url directory
-             (make-clone-options
-              #:fetch-options (make-default-fetch-options
-                               #:verify-certificate? verify-certificate?))))
+      (let* ((repository
+              (clone url directory
+                     (make-clone-options
+                      #:fetch-options (make-default-fetch-options
+                                       #:verify-certificate?
+                                       verify-certificate?))))
+             (config (repository-config repository)))
+        ;; Prevent modification of the raw data.
+        (set-config-string config "core.autocrlf" "input")
+
+        repository))
     (lambda _
       (false-if-exception (rmdir directory)))))
 

This bug report was last modified 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.