429 Commits

Author SHA1 Message Date
Jim Meyering
db2fb7cdba maint: update copyright date year ranges to include 2011
* bootstrap.conf (gnulib_modules): Add update-copyright.
Run "make update-copyright".
2011-03-27 09:16:46 +02:00
Jim Meyering
d8fdb88440 build: avoid three gcc warnings
* src/patch.c (mangled_patch): Add "noreturn" attribute.
* src/pch.h (pch_timestamp): Remove ignored "const" attribute.
* src/version.c (XTERN): Remove unused #undef and #define.
2011-03-27 09:16:45 +02:00
Jim Meyering
38cecf52b6 tests: temporarily disable failing syntax-check rules
* cfg.mk (local-checks-to-skip): Define, to skip all of the
currently-failing syntax-check rules.  We'll reenable them
one by one, as problems are addressed.
2011-03-27 09:16:42 +02:00
Jim Meyering
7db2653124 build: accept new configure-time option --enable-gcc-warnings
* configure.ac: Enable many options.
* bootstrap.conf (gnulib_modules): Add manywarnings.
* src/Makefile.am (AM_CFLAGS): Use $(WARN_CFLAGS) and $(WERROR_CFLAGS).
2011-03-26 14:20:28 +01:00
Jim Meyering
2876ed918f maint: avoid non-portable use of test -a
With these changes, "make sc_prohibit_test_minus_ao" almost passes.
Uses of "test -o" remain.
Note: unchecked uses of test -ot/-nt also remain.
* tests/empty-files: Use "test C1 && test C2", not "test C1 -a C2"
* tests/merge: Likewise.
* tests/symlinks: Likewise.
* tests/test-lib.sh: Likewise.
2011-03-26 14:20:28 +01:00
Jim Meyering
02e3376350 maint: allow the sc_prohibit_empty_lines_at_EOF test to pass
* tests/test-lib.sh: Remove empty line at end of file.
2011-03-26 14:20:28 +01:00
Jim Meyering
07d4792620 maint: remove trailing blanks
* bootstrap.conf: Remove trailing blanks.
* tests/reject-format: Define a dummy, empty variable, and use it in
here-doc to protect required trailing blanks from accidental removal.
* tests/no-newline-triggers-assert: Likewise.
* tests/preserve-c-function-names: Likewise.
* tests/create-delete: Likewise.
* tests/global-reject-files: Complete a sentence that ended in a space.
2011-03-26 14:20:28 +01:00
Jim Meyering
8d6290df9f maint: add some m4 quoting
* m4/setmode.m4 (AC_FUNC_SETMODE_DOS): Use proper M4 quoting.
2011-03-26 14:20:28 +01:00
Jim Meyering
f266434caf maint: arrange for the sc_require_config_h_first test to pass
* cfg.mk: New file, to configure maint.mk.
* Makefile.am (EXTRA_DIST): Add, so the new file is distributed.
(config_h_header): Define, to make the sc_require_config_h_first
syntax-check test pass.
* pc/chdirsaf.c: Include <config.h>.
2011-03-26 14:20:28 +01:00
Jim Meyering
94e032f941 maint: use gnulib's maintainer-makefile module
* bootstrap.conf (gnulib_modules): Add maintainer-makefile.
2011-03-26 14:17:36 +01:00
Jim Meyering
7d41c04e7b doc: update README-hacking
* README-hacking: Update from coreutils, including mention of
how to use vc-dwim to git-commit efficiently and safely using
a non-VC'd ChangeLog file.
2011-03-21 18:40:39 +01:00
Jim Meyering
d96503d66a build: update gnulib submodule to latest 2011-03-21 18:26:46 +01:00
Jim Meyering
764d0ea12e do not version-control ChangeLog; instead, generate it from git log
With this change, all ChangeLog entries going forward are generated
into a file named ChangeLog in each distribution tarball.
ChangeLog entries prior to today's date are in ChangeLog-2011.
* Makefile.am (gen-ChangeLog): New rule.
(dist-hook): Depend on it.
(EXTRA_DIST): Add ChangeLog-2011.
* ChangeLog-2011: Renamed from ChangeLog
* ChangeLog: Remove file.
* .gitignore: Ignore ChangeLog.
* bootstrap.conf: Ensure that ChangeLog exists.
(gnulib_modules): Add gitlog-to-changelog.
2011-03-17 11:12:37 +01:00
Jim Meyering
8678ae92ea maint: remove unnecessary tests before free
There is no longer any need to avoid "free(NULL)" (since SunOS 4),
so replace each "if (P) free (P);" with "free (P);".
* src/inp.c (get_input_file): Remove unnecessary test-before-free.
* src/patch.c (get_some_switches): Likewise.
* src/pch.c (intuit_diff_type, pch_swap): Likewise.
2011-02-21 00:29:54 +01:00
Jim Meyering
e0f707523c don't warn twice about the same invalid file name
* src/pch.c (name_is_valid): Don't warn about the same name twice.
* tests/bad-filenames (emit_patch): Exercise the new code.
2011-02-17 10:00:57 +01:00
Andreas Gruenbacher
f663762bf0 Ignore dangerous filenames instead of failing immediately
* src/pch.c (name_is_valid): New function.
(intuit_diff_type, best_name): Use name_is_valid() here.
(strip_leading_slashes): Remove name validation tests from here.
* tests/bad-filenames: Add more tests for covering more of the
file name guessing corner cases in intuit_diff_type(), update the
existing tests.
* NEWS: Update.
2011-02-16 12:01:19 +01:00
Andreas Gruenbacher
dcfb493578 Fix use of uninitialized outst
* src/patch.c (main): Fix use of initialized outst and add an
additional assert.  Reported by Jim Meyering.
2011-02-15 11:23:44 +01:00
Ozan Çağlayan
3fc5b24073 Create directory test case
* tests/create-delete: New test case creating a file in a new
sub-directory (bug fixed on 2010-12-04).
2011-02-04 00:10:28 +01:00
Andreas Gruenbacher
3c776b0844 Also check if the input file is seekable if a filename is given (-i)
* src/pch.c (open_patch_file): Also check if the input file is
seekable if a filename is given (-i).
* tests/pipe: New file.  Test this.
* tests/Makefile.am (TESTS): Add it.
2011-02-03 23:22:56 +01:00
Jim Meyering
4c3004c17f doc: mention the fix for CVE-2010-4651
* NEWS: Mention the fix.
2011-02-03 23:08:03 +01:00
Jim Meyering
685a78b605 Do not let a malicious patch create files above current directory
This addresses CVE-2010-4651, reported by Jakub Wilk.
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2010-4651
* src/util.c (strip_leading_slashes): Reject absolute file names
and file names containing a component of "..".
* tests/bad-filenames: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.
Improvements by Andreas Gruenbacher.
2011-02-03 22:00:50 +01:00
Andreas Gruenbacher
7fae6755f4 Create missing parent directories of temporary files
* src/util.c (make_tempfile): Create missing directories when
necessary.
2010-12-04 23:05:00 +01:00
Andreas Gruenbacher
77e15c7286 Fix the USE_XATTR checks
* src/util.c: USE_XATTR is defined to 0 or 1, so we need to use #if
instead of #ifdef.
2010-10-29 14:32:51 +02:00
Andreas Gruenbacher
76d0e43140 Preserve extended attributes of patched files when possible
* src/patch.c (main): Set all file attributes of the temporary output
file before renaming it over the final output file (possibly replacing
the input file).  Pass the input file name to set_file_attributes().
* src/util.c (set_file_attributes): When enabled (USE_XATTR), also
copy extended attributes including attributes which define
permissions.
(copy_attr_error, copy_attr_quote, copy_attr_free, copy_attr_check,
copy_attr): Helper functions for copying extended attributes.
* m4/xattr.m4 (gl_FUNC_XATTR): Import from coreutils.
* src/Makefile.am (patch_LDADD): Add $(LIB_XATTR) here.
* bootstrap.conf: Use the gnulib verror module.
2010-10-27 02:53:42 +02:00
Andreas Gruenbacher
28113637f5 A minor set_file_attributes() cleanup
* src/util.c (set_file_attributes): Always expect the mode
argument to be set when FA_MODE is specified.
(create_backup_copy): Update accordingly.
2010-10-27 02:36:42 +02:00
Andreas Gruenbacher
03f337dabc Remove obsolete checks for mktemp
* configure.ac: Remove obsolete checks for mktemp.
2010-10-26 14:08:50 +02:00
Andreas Gruenbacher
1119764035 Remove obsolete comment
* src/patch.c (print_header_line): Remove obsolete comment.
2010-10-26 14:07:46 +02:00
Andreas Gruenbacher
5b460672d7 Fix the --binary option when used together with --silent
* src/pch.c (there_is_another_patch): Set p_strip_trailing_cr
to false if no_strip_trailing_cr is set independent of the verbosity.
This broke the --binary option in combination with --silent.
2010-10-14 00:11:11 +02:00
Andreas Gruenbacher
3e234c40d2 Only recognize quited filename in the "diff --git" format
* src/util.c: Add a maybe_quoted parameter to fetchname.
* src/pch.c: Only recognize quited filename in the "diff --git"
format, at least for now.
* tests/quoted-filenames: Update accordingly.
* NEWS: Update accordingly.
2010-10-05 19:21:35 +02:00
Andreas Gruenbacher
86e12910c6 Add copy-after-modify test case
* tests/criss-cross: Add copy-after-modify test case.
2010-09-17 13:35:58 +02:00
Andreas Gruenbacher
7e6d1e6718 Document that "diff --git" criss-cross renames don't work
* NEWS: Document that "diff --git" criss-cross renames are broken
still.
* tests/criss-cross: Test case currently expected to fail.
2010-09-17 13:16:08 +02:00
Andreas Gruenbacher
19aecf8108 Fix the "patching file" message for renames and copies
* src/patch.c (main): Generate the "patching file" message here.  When
the input and output file name is not he same, include both names in
the message.
* src/inp.c (scan_input): Previously the "patching file" message was
generated here.
* tests/unmodified-files, tests/copy-rename: Update.
2010-09-17 12:19:43 +02:00
Andreas Gruenbacher
b73bec8e45 Remove double quotearg()
* src/inp.c (scan_input): Remove double quotearg().
2010-09-17 11:04:58 +02:00
Andreas Gruenbacher
fdafb60cc0 Stop using mktemp() for TMPOUTNAME
* src/patch.c (main): Compute TMPOUTNAME with make_tempfile().
(make_temp): Remove obsolete function.
2010-09-17 02:06:25 +02:00
Andreas Gruenbacher
a1a66e6032 Stop using mktemp() for TMPREJNAME
* src/patch.c (main): Compute TMPREJNAME with make_tempfile() only if
needed.
(abort_hunk, init_reject): Pass through the output file name, and base
TMPREJNAME on it.
2010-09-17 02:03:26 +02:00
Andreas Gruenbacher
93129f45a1 Replace unnecessary local variable
* src/patch.c (abort_hunk_unified): Replace unnecessary local variable.
2010-09-17 01:57:22 +02:00
Andreas Gruenbacher
76649aba9e Stop using mktemp() for TMPPATNAME
* src/pch.c (open_patch_file): Compute TMPPATNAME with make_tempfile()
if needed instead of precomputing it in src/patch.c (main).
2010-09-17 01:51:50 +02:00
Andreas Gruenbacher
51147ca57d Stop using mktemp() for TMPINNAME
* src/inp.c (plan_b): Compute TMPINNAME with make_tempfile() if needed
instead of precomputing it in src/patch.c (main).
2010-09-17 01:46:02 +02:00
Andreas Gruenbacher
4b6267d62f Add function make_tempfile()
* bootstrap.conf: Use the gnulib tempname module.
* src/util.c (make_tempfile): New function.
2010-09-17 01:36:53 +02:00
Andreas Gruenbacher
0eef74e981 do_ed_script(): Pass in the filenames to use
* src/pch.c (do_ed_script): Add inname, outname, and
outname_needs_removal arguments.  This isolates TMPOUTNAME and
TMPOUTNAME_needs_removal to patch.c.
* src/patch.c (main): Update do_ed_script() call.
2010-09-17 01:33:45 +02:00
Andreas Gruenbacher
206e87000c Split up init_output()
* src/patch.c (open_outfile): New function.
(init_output): Split into open_outfile() and the rest.
2010-09-17 01:33:42 +02:00
Andreas Gruenbacher
9f1beb577a A lot of years in the ChangeLog are wrong (2009 -> 2010) 2010-09-17 01:32:20 +02:00
Tim Waugh
94d856cfd3 Stop "patch --get 1" from segfaulting
* src/patch.c: Stop "patch --get 1" from segfaulting.
2010-07-27 19:33:01 +02:00
Andreas Gruenbacher
2475341173 Fix read-only file check for ed scripts
* src/patch.c: The read-only file check was not done for ed scripts;
fix this.
2010-05-11 02:08:34 +02:00
Andreas Gruenbacher
423d17d562 test suite: Another Solaris portability fix
* tests/corrupt-reject-files, tests/crlf-handling: On Solaris, cat's
-e option is only effective if -v is specified as well.
2010-05-06 18:48:02 +02:00
Andreas Gruenbacher
d94b00785d test suite: Ignore error messages during cleanup
* tests/test-lib.sh: Ignore error messages when cleaning up after a
test has finished.
2010-05-06 18:44:24 +02:00
Andreas Gruenbacher
7e9296614a test library: Only use GNU diff when available
* tests/test-lib.sh: Only use GNU diff when available.
* tests/dash-o-append: Fix the expected result.
2010-05-05 13:09:18 +02:00
Andreas Gruenbacher
99d75edf46 More test suite fixes
* tests/create-delete: Do not use 'diff' here.
* tests/merge: Require GNU diff.
2010-05-05 12:18:41 +02:00
Andreas Gruenbacher
5b68db86ce Use the gnulib unistd module
* bootstrap.conf: Use the gnulib unistd module.
2010-05-05 01:03:57 +02:00
Andreas Gruenbacher
a78d3c405b Use the gnulib mkdir module
* bootstrap.conf: Use the gnulib mkdir module.
* m4/mkdir.m4: Delete.
2010-05-05 01:00:39 +02:00