From b115c7b10dca734364f1e45270ef5467253fc518 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Mon, 11 Mar 2024 08:46:40 +0100 Subject: [PATCH] detect whitespace issues in rfc/index.txt earlier by checking with each fetch and update. --- rfc/Makefile | 4 ---- rfc/fetch.sh | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rfc/Makefile b/rfc/Makefile index e9440d3..b929099 100644 --- a/rfc/Makefile +++ b/rfc/Makefile @@ -8,7 +8,3 @@ link: genxr: go run xr.go -- xr/dev $$(git rev-parse --short HEAD) $$(git log -1 --date=format:"%Y-%m-%d" --format="%ad") $$(git tag --sort=v:refname | tail -n1) ../*.go ../*/*.go - -check: - # output should be empty - -grep ' ' index.txt | grep -E -v '^[^ ]+ [^ ]+ [^ ]+ [^ ]+$$' diff --git a/rfc/fetch.sh b/rfc/fetch.sh index 3c7de97..851ca76 100755 --- a/rfc/fetch.sh +++ b/rfc/fetch.sh @@ -1,4 +1,13 @@ -#!/bin/sh +#!/usr/bin/env bash +set -uo pipefail + +if grep ' ' index.txt | grep -E -v '^[^ ]+ [^ ]+ [^ ]+ [^ ]+$$'; then + echo 'bad lines in rfc/index.txt' + exit 1 +fi + +set -e + for number in $(sed -n 's/^\([0-9][0-9]*\)[ \t].*$/\1/p' index.txt); do if ! test -f "$number"; then curl https://www.rfc-editor.org/rfc/rfc$number.txt >$number || rm $number