[Git][NTPsec/ntpsec][master] ntpleapfetch requires UNIX line endings

Hal Murray gitlab at mg.gitlab.com
Tue Jan 9 12:06:45 UTC 2018


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
3a7e76dc by Sanjeev Gupta at 2018-01-09T11:22:31+00:00
ntpleapfetch requires UNIX line endings

The file from NIST has \r\n .  Modified the script
to remove \r.

See https://gitlab.com/NTPsec/ntpsec/issues/429

- - - - -


1 changed file:

- ntpclients/ntpleapfetch


Changes:

=====================================
ntpclients/ntpleapfetch
=====================================
--- a/ntpclients/ntpleapfetch
+++ b/ntpclients/ntpleapfetch
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # Copyright (C) 2014 Timothe Litt litt at acm dot org
+# Modified 20180105 Sanjeev Gupta ghane0 at gmail.com
 #
 # SPDX-License-Identifier: BSD-2-clause
 #
@@ -286,7 +287,12 @@ function verifySHA1 {
     # Extract the file's hash. Restore any leading zeroes in hash segments.
 
     # The sed [] includes a tab (\t) and space; #h is followed by a tab and space
-    local FSHA1="`echo \"$RAW\" | sed -e'/^#h/!d' -e's/^#h//' -e's/[ 	] */ 0x/g'`"
+    # The file of 8-Jul-2016 uses \r\n as line delimiters.  This must
+    # be corrected on UNIX systems, else the extra \r is read from the
+    # last line.  I am not clear if this is an error in the NIST file,
+    # or intentional.  Nevertheless - Sanjeev Gupta 20180105
+    #
+    local FSHA1="`echo \"$RAW\" | sed -e's/\r//' | sed -e'/^#h/!d' -e's/^#h//' -e's/[ 	] */ 0x/g'`"
     FSHA1=`printf '%08x%08x%08x%08x%08x' $FSHA1`
 
     if [ -n "$FSHA1" -a \( "$FSHA1" = "$DSHA1" \) ]; then



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3a7e76dc3dda4a92adbf7ed69abb92211ddbc114

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3a7e76dc3dda4a92adbf7ed69abb92211ddbc114
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180109/3b0bb2f6/attachment.html>


More information about the vc mailing list