>From 5914a5ca4f49d62d6cfa4c4ba772aea01851b53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 3 Feb 2015 03:15:10 +0000 Subject: [PATCH] build: fix invalid gnulib patch * gl/lib/tempname.c.diff: Fix recent breakage so it applies again. Invalid patch was noticed at http://hydra.nixos.org/eval/1172233 * cfg.mk: Exempt diff files from these "id_est" syntax checks. (sc_ensure_gl_diffs_apply): A new syntax check, to ensure all patches under gl/ apply cleanly. Note we use --fuzz=0 to check patches apply cleanly for safety, due to the patch(1) issue detailed in commit v8.21-117-g46f7e05 * gl/lib/regcomp.c.diff: Rediffed. * gl/lib/regex_internal.c.diff: Likewise. * gl/lib/regex_internal.h.diff: Likewise. * gl/lib/regexec.c.diff: Likewise. * gl/lib/tempname.h.diff: Likewise. --- cfg.mk | 20 ++++++++++++++++---- gl/lib/regcomp.c.diff | 14 +++++++------- gl/lib/regex_internal.c.diff | 10 +++++----- gl/lib/regex_internal.h.diff | 4 ++-- gl/lib/regexec.c.diff | 14 +++++++------- gl/lib/tempname.c.diff | 16 ++++++++-------- gl/lib/tempname.h.diff | 2 +- 7 files changed, 46 insertions(+), 34 deletions(-) diff --git a/cfg.mk b/cfg.mk index 21a00d3..e16125f 100644 --- a/cfg.mk +++ b/cfg.mk @@ -122,6 +122,14 @@ sc_tests_executable: | sed -e "s/^/$(ME): Please make test executable: /" | grep . \ && exit 1; : +# Ensure all gnulib patches apply cleanly +sc_ensure_gl_diffs_apply_cleanly: + @find gl/ -name '*.diff' | while read p; do \ + patch --fuzz=0 -s -d gnulib/ -p1 --dry-run < "$$p" \ + || { echo "$$p" ; echo 'To refresh run:' \ + 'make refresh-gnulib-patches'; exit 1; } \ + done + # Avoid :>file which doesn't propagate errors sc_prohibit_colon_redirection: @cd $(srcdir)/tests && GIT_PAGER= git grep -n ': *>.*||' \ @@ -364,15 +372,15 @@ sc_prohibit_uppercase_id_est: $(_sc_search_regexp) # Enforce double-space before "I.e." at the beginning of a sentence. -sc_ensure_double_space_after_dot_before_id_est: - @prohibit='\. I\.e\.' \ +sc_ensure_dblspace_after_dot_before_id_est: + @prohibit='\. I\.e\.' \ halt='Single space after dot before "i.e."; use ". i.e." instead' \ $(_sc_search_regexp) # Enforce comma after "i.e." (at least before a blank or at EOL). sc_ensure_comma_after_id_est: - @prohibit='[Ii]\.e\.( |$$)' \ - halt='Missing comma after "i.e."; use "i.e.," instead' \ + @prohibit='[Ii]\.e\.( |$$)' \ + halt='Missing comma after "i.e."; use "i.e.," instead' \ $(_sc_search_regexp) # The SEE ALSO section of a man page should not be terminated with @@ -691,6 +699,10 @@ exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$ # Exception here as we don't want __attribute elided on non GCC exclude_file_name_regexp--sc_prohibit-gl-attributes = ^src/libstdbuf\.c$$ +exclude_file_name_regexp--sc_prohibit_uppercase_id_est = \.diff$ +exclude_file_name_regexp--sc_ensure_dblspace_after_dot_before_id_est = \.diff$$ +exclude_file_name_regexp--sc_ensure_comma_after_id_est = \.diff$ + # Augment AM_CFLAGS to include our per-directory options: AM_CFLAGS += $($(@D)_CFLAGS) diff --git a/gl/lib/regcomp.c.diff b/gl/lib/regcomp.c.diff index 9042a6e..cc6649f 100644 --- a/gl/lib/regcomp.c.diff +++ b/gl/lib/regcomp.c.diff @@ -1,8 +1,8 @@ diff --git a/lib/regcomp.c b/lib/regcomp.c -index 6d5525a..c9331d4 100644 +index 840220f..192632c 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c -@@ -539,7 +539,7 @@ regerror (errcode, preg, errbuf, errbuf_size) +@@ -540,7 +540,7 @@ regerror (errcode, preg, errbuf, errbuf_size) size_t errbuf_size; #else /* size_t might promote */ size_t @@ -11,7 +11,7 @@ index 6d5525a..c9331d4 100644 char *_Restrict_ errbuf, size_t errbuf_size) #endif { -@@ -1421,7 +1421,7 @@ calc_first (void *extra, bin_tree_t *node) +@@ -1427,7 +1427,7 @@ calc_first (void *extra, bin_tree_t *node) /* Pass 2: compute NEXT on the tree. Preorder visit. */ static reg_errcode_t @@ -20,7 +20,7 @@ index 6d5525a..c9331d4 100644 { switch (node->token.type) { -@@ -2807,8 +2807,10 @@ build_range_exp (const reg_syntax_t syntax, +@@ -2820,8 +2820,10 @@ build_range_exp (const reg_syntax_t syntax, static reg_errcode_t internal_function # ifdef RE_ENABLE_I18N @@ -33,7 +33,7 @@ index 6d5525a..c9331d4 100644 # else /* not RE_ENABLE_I18N */ build_collating_symbol (bitset_t sbcset, const unsigned char *name) # endif /* not RE_ENABLE_I18N */ -@@ -3392,7 +3394,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, +@@ -3389,7 +3391,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, static reg_errcode_t parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, @@ -43,7 +43,7 @@ index 6d5525a..c9331d4 100644 reg_syntax_t syntax, bool accept_hyphen) { #ifdef RE_ENABLE_I18N -@@ -3479,8 +3482,10 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, +@@ -3476,8 +3479,10 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, static reg_errcode_t #ifdef RE_ENABLE_I18N @@ -56,7 +56,7 @@ index 6d5525a..c9331d4 100644 #else /* not RE_ENABLE_I18N */ build_equiv_class (bitset_t sbcset, const unsigned char *name) #endif /* not RE_ENABLE_I18N */ -@@ -3886,7 +3891,7 @@ free_token (re_token_t *node) +@@ -3883,7 +3888,7 @@ free_token (re_token_t *node) and its children. */ static reg_errcode_t diff --git a/gl/lib/regex_internal.c.diff b/gl/lib/regex_internal.c.diff index a27f672..355cadb 100644 --- a/gl/lib/regex_internal.c.diff +++ b/gl/lib/regex_internal.c.diff @@ -1,17 +1,17 @@ diff --git a/lib/regex_internal.c b/lib/regex_internal.c -index 7e8c1bc..e68c9da 100644 +index 36ae6ab..c11ff09 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c -@@ -16,6 +16,8 @@ - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ +@@ -17,6 +17,8 @@ + License along with the GNU C Library; if not, see + . */ +#include "verify.h" +#include "intprops.h" static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, RE_TRANSLATE_TYPE trans, bool icase, -@@ -1393,7 +1395,10 @@ static void +@@ -1389,7 +1391,10 @@ static void internal_function re_node_set_remove_at (re_node_set *set, Idx idx) { diff --git a/gl/lib/regex_internal.h.diff b/gl/lib/regex_internal.h.diff index f410882..a4d78af 100644 --- a/gl/lib/regex_internal.h.diff +++ b/gl/lib/regex_internal.h.diff @@ -1,8 +1,8 @@ diff --git a/lib/regex_internal.h b/lib/regex_internal.h -index 439444c..7242084 100644 +index ff486bb..ff85ac8 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h -@@ -827,7 +827,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx) +@@ -863,7 +863,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx) # ifndef NOT_IN_libc static int internal_function __attribute__ ((pure, unused)) diff --git a/gl/lib/regexec.c.diff b/gl/lib/regexec.c.diff index 897d248..1aa3c24 100644 --- a/gl/lib/regexec.c.diff +++ b/gl/lib/regexec.c.diff @@ -1,17 +1,17 @@ diff --git a/lib/regexec.c b/lib/regexec.c -index 7d130a0..a58d454 100644 +index d3920c4..a8152b5 100644 --- a/lib/regexec.c +++ b/lib/regexec.c -@@ -16,6 +16,8 @@ - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ +@@ -17,6 +17,8 @@ + License along with the GNU C Library; if not, see + . */ +#include "verify.h" +#include "intprops.h" static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, Idx n) internal_function; static void match_ctx_clean (re_match_context_t *mctx) internal_function; -@@ -374,8 +376,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp, +@@ -373,8 +375,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp, Idx len = length1 + length2; char *s = NULL; @@ -25,7 +25,7 @@ index 7d130a0..a58d454 100644 /* Concatenate the strings. */ if (length2 > 0) -@@ -426,11 +431,14 @@ re_search_stub (struct re_pattern_buffer *bufp, +@@ -423,11 +428,14 @@ re_search_stub (struct re_pattern_buffer *bufp, Idx last_start = start + range; /* Check for out-of-range. */ @@ -42,4 +42,4 @@ index 7d130a0..a58d454 100644 + else if (BE (/* last_start < 0 || */ (range < 0 && start <= last_start), 0)) last_start = 0; - __libc_lock_lock (dfa->lock); + lock_lock (dfa->lock); diff --git a/gl/lib/tempname.c.diff b/gl/lib/tempname.c.diff index 7cf9230..5138df2 100644 --- a/gl/lib/tempname.c.diff +++ b/gl/lib/tempname.c.diff @@ -1,5 +1,5 @@ diff --git a/lib/tempname.c b/lib/tempname.c -index 26a38ce..5944ee0 100644 +index 088b224..e9a6c0c 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -20,6 +20,7 @@ @@ -18,7 +18,7 @@ index 26a38ce..5944ee0 100644 #include #include #include -@@ -175,14 +177,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, +@@ -172,14 +174,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, } #endif /* _LIBC */ @@ -33,7 +33,7 @@ index 26a38ce..5944ee0 100644 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; /* Generate a temporary file name based on TMPL. TMPL must match the -- rules for mk[s]temp (i.e., end in "XXXXXX", possibly with a suffix). +- rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). + rules for mk[s]temp (i.e., end in at least X_SUFFIX_LEN "X"s, + possibly with a suffix). The name constructed does not exist at the time of the call to @@ -42,7 +42,7 @@ index 26a38ce..5944ee0 100644 KIND may be one of: __GT_NOCREATE: simply verify that the name does not exist -@@ -193,23 +202,24 @@ static const char letters[] = +@@ -190,23 +199,24 @@ static const char letters[] = We use a clever algorithm to get hard-to-predict names. */ int @@ -72,7 +72,7 @@ index 26a38ce..5944ee0 100644 #define ATTEMPTS_MIN (62 * 62 * 62) /* The number of times to attempt to generate a temporary file. To -@@ -221,43 +231,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +@@ -218,43 +228,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) #endif len = strlen (tmpl); @@ -128,7 +128,7 @@ index 26a38ce..5944ee0 100644 switch (kind) { -@@ -272,7 +267,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +@@ -269,7 +264,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) break; case __GT_NOCREATE: @@ -137,7 +137,7 @@ index 26a38ce..5944ee0 100644 succeeds if __xstat fails because the name does not exist. Note the continue to bypass the common logic at the bottom of the loop. */ -@@ -281,11 +276,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +@@ -278,11 +273,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) if (errno == ENOENT) { __set_errno (save_errno); @@ -156,7 +156,7 @@ index 26a38ce..5944ee0 100644 } continue; -@@ -297,13 +296,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +@@ -294,13 +293,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) if (fd >= 0) { __set_errno (save_errno); diff --git a/gl/lib/tempname.h.diff b/gl/lib/tempname.h.diff index 2e885e1..ec70a47 100644 --- a/gl/lib/tempname.h.diff +++ b/gl/lib/tempname.h.diff @@ -1,5 +1,5 @@ diff --git a/lib/tempname.h b/lib/tempname.h -index 7972562..7ced9a9 100644 +index b560ee5..6e162c3 100644 --- a/lib/tempname.h +++ b/lib/tempname.h @@ -46,5 +46,7 @@ -- 2.1.0