From a1a8908992368a74b62ce8ec22429a5639dd95fb Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 30 Jul 2016 08:40:43 -0700 Subject: [PATCH 1/4] gnulib: update to latest --- gnulib | 2 +- m4/.gitignore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gnulib b/gnulib index c2bfaa5..348402f 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit c2bfaa58dc0ce8bcf2c5c07aa126e7a55cb7800f +Subproject commit 348402f2aac342bc925b7aaea9ee3cc353f427a9 diff --git a/m4/.gitignore b/m4/.gitignore index f3498ce..2b37d23 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -262,3 +262,4 @@ xvasprintf.m4 /faccessat.m4 /getgroups.m4 /group-member.m4 +/hard-locale.m4 -- 2.7.4 From 646673648b72c7c2f63bb4e3ef29b6cb94d23dfd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 30 Jul 2016 08:35:23 -0700 Subject: [PATCH 2/4] maint: avoid new warning-errors from gcc-6.1 When configured with --enable-gcc-warnings and gcc-6.1, ... * src/safe.c (count_path_components): Use _GL_ATTRIBUTE_PURE, to avoid an error from -Werror=suggest-attribute=pure. * src/util.h (filename_is_safe): Likewise. * src/patch.c (main): Placate -Werror=format= by casting pch_mode's mode_t return type to the "unsigned int" required to match the %o format string. * src/patch.c (delete_files): Correct indentation, to avoid this error from -Werror=misleading-indentation: patch.c: In function 'delete_files': patch.c:1816:4: error: this 'if' clause does not guard... if (verbosity == VERBOSE) ^~ patch.c:1820:6: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' move_file (0, 0, 0, file_to_delete->name, mode, ^~~~~~~~~ --- src/patch.c | 10 +++++----- src/safe.c | 1 + src/util.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/patch.c b/src/patch.c index bf7e5c2..6c76276 100644 --- a/src/patch.c +++ b/src/patch.c @@ -241,8 +241,8 @@ main (int argc, char **argv) { say ("File %s: can't change file type from 0%o to 0%o.\n", quotearg (inname), - pch_mode (reverse) & S_IFMT, - pch_mode (! reverse) & S_IFMT); + (unsigned int) (pch_mode (reverse) & S_IFMT), + (unsigned int) (pch_mode (! reverse) & S_IFMT)); skip_rest_of_patch = true; somefailed = true; } @@ -1817,9 +1817,9 @@ delete_files (void) say ("Removing %s %s\n", S_ISLNK (mode) ? "symbolic link" : "file", quotearg (file_to_delete->name)); - move_file (0, 0, 0, file_to_delete->name, mode, - file_to_delete->backup); - removedirs (file_to_delete->name); + move_file (0, 0, 0, file_to_delete->name, mode, + file_to_delete->backup); + removedirs (file_to_delete->name); } } gl_list_iterator_free (&iter); diff --git a/src/safe.c b/src/safe.c index d2ff0d2..5a7202f 100644 --- a/src/safe.c +++ b/src/safe.c @@ -243,6 +243,7 @@ out: return entry; } +_GL_ATTRIBUTE_PURE static unsigned int count_path_components (const char *path) { unsigned int components; diff --git a/src/util.h b/src/util.h index ab46540..f4936ec 100644 --- a/src/util.h +++ b/src/util.h @@ -68,7 +68,7 @@ enum file_id_type lookup_file_id (struct stat const *); void set_queued_output (struct stat const *, bool); bool has_queued_output (struct stat const *); int stat_file (char const *, struct stat *); -bool filename_is_safe (char const *); +bool filename_is_safe (char const *) _GL_ATTRIBUTE_PURE; bool cwd_is_root (char const *); enum file_attributes { -- 2.7.4 From fae597ad316e8b1af91d8441f52e0ecb11862ad1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 30 Jul 2016 08:58:54 -0700 Subject: [PATCH 3/4] maint: placate a "make syntax-check" rule * src/pch.c (set_hunkmax): Don't cast return value of xmalloc. (grow_hunkmax): Likewise for two uses of realloc that the syntax-check rule did not detect. --- src/pch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pch.c b/src/pch.c index 84adba1..94a0ac1 100644 --- a/src/pch.c +++ b/src/pch.c @@ -170,9 +170,9 @@ static void set_hunkmax (void) { if (!p_line) - p_line = (char **) xmalloc (hunkmax * sizeof *p_line); + p_line = xmalloc (hunkmax * sizeof *p_line); if (!p_len) - p_len = (size_t *) xmalloc (hunkmax * sizeof *p_len); + p_len = xmalloc (hunkmax * sizeof *p_len); if (!p_Char) p_Char = xmalloc (hunkmax * sizeof *p_Char); } @@ -184,8 +184,8 @@ grow_hunkmax (void) { hunkmax *= 2; assert (p_line && p_len && p_Char); - if ((p_line = (char **) realloc (p_line, hunkmax * sizeof (*p_line))) - && (p_len = (size_t *) realloc (p_len, hunkmax * sizeof (*p_len))) + if ((p_line = realloc (p_line, hunkmax * sizeof (*p_line))) + && (p_len = realloc (p_len, hunkmax * sizeof (*p_len))) && (p_Char = realloc (p_Char, hunkmax * sizeof (*p_Char)))) return true; if (!using_plan_a) -- 2.7.4 From 6040ae520b39c6d33cdd17f2b50a425e3fa68e12 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 30 Jul 2016 10:25:01 -0700 Subject: [PATCH 4/4] tests: use $PATCH rather than hard-coded path * tests/git-cleanup: Don't hard-code program name. --- tests/git-cleanup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/git-cleanup b/tests/git-cleanup index a71be97..2e3e4c6 100644 --- a/tests/git-cleanup +++ b/tests/git-cleanup @@ -47,7 +47,7 @@ patching file g Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file g.rej patching file h -/home/agruenba/git/patch/src/patch: **** malformed patch at line 20: BAD PATCH +$PATCH: **** malformed patch at line 20: BAD PATCH status: 2 EOF -- 2.7.4