Check for ^M in packages file when booting
authorIan Lynagh <igloo@earth.li>
Thu, 14 Apr 2011 21:45:02 +0000 (22:45 +0100)
committerIan Lynagh <igloo@earth.li>
Thu, 14 Apr 2011 21:45:02 +0000 (22:45 +0100)
If we find one then we print an error message and fail.

boot

diff --git a/boot b/boot
index 9d7eb38..66bff3e 100755 (executable)
--- a/boot
+++ b/boot
@@ -24,6 +24,24 @@ while ($#ARGV ne -1) {
     }
 }
 
+{
+    local $/ = undef;
+    open FILE, "packages" or die "Couldn't open file: $!";
+    binmode FILE;
+    my $string = <FILE>;
+    close FILE;
+
+    if ($string =~ /\r/) {
+        print STDERR <<EOF;
+Found ^M in packages.
+Perhaps you need to run
+    git config --global core.autocrlf false
+and re-check out the tree?
+EOF
+        exit 1;
+    }
+}
+
 # Create libraries/*/{ghc.mk,GNUmakefile}
 system("/usr/bin/perl", "-w", "boot-pkgs") == 0
     or die "Running boot-pkgs failed: $?";