| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Run "make update-copyright".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mark functions as pure of const, per recommendations enabled by
new gcc -W options. Apply _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST.
* src/common.h: Apply new function attributes.
* src/pch.c: Likewise.
* src/pch.h: Likewise.
* src/util.c: Likewise.
* src/util.h: Likewise.
* configure.ac: Use -Wno-format-nonliteral.
* m4/.gitignore: Update.
* gnulib: Update to latest.
* cfg.mk: Exempt src/util.c from two tests, to avoid new
"make syntax-check" failures.
|
| |
|
|
|
|
|
|
|
|
|
| |
* src/util.h (enum file_attributes): Add FA_XATTRS flag for extended
attributes.
* src/patch.c (main): Use set_file_attributes() even when the infile doesn't
exist: it may still set the file time (FA_TIMES). Omit all other FA_ flags if
infile doesn't exist. Otherwise, add FA_XATTRS as well.
* src/util.c (set_file_attributes): Only copy extended attributes if FA_XATTRS
is set. Avoid using st where it may be undefined.
* tests/preserve-mode-and-timestamp: Add file create test.
|
| |
|
|
|
|
| |
* src/util.c: Include "error.h".
(ask): Use error, not perror. The latter would not have included
the usual "program name: " prefix.
|
| |
|
|
| |
* src/util.c (parse_c_string): Don't increment "s" in assert.
|
| |
|
|
|
|
|
| |
* src/util.c: Include "ignore-value.h".
(ask): Use ignore_value to tell tools that yes, we really do
mean to ignore any close failure on this error path.
* bootstrap.conf (gnulib_modules): Add ignore-value.
|
| |
|
|
| |
* src/util.c (fetchname): Don't leak "timestr" when returning early.
|
| |
|
|
|
|
|
|
| |
* src/util.c (fetchname): Avoid a used-uninitialized error.
Before, when "*t == '\n'", stamp.tv_nsec would have been
used undefined. The fix is to set that member rather than
stamp.tv_sec, which is already set to the desired value.
This was reported by coverity.
|
| |
|
|
|
|
|
|
|
|
| |
* bootstrap.conf (gnulib_modules): Include gnulib's signal module,
so that signal.h guarantees definition of certain macros.
* src/util.c (SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK): Remove definition.
Now, gnulib guarantees that these are defined.
* src/common.h (SIZE_MAX): Likewise.
* cfg.mk (local-checks-to-skip): Enable the
sc_prohibit_always-defined_macros check, now that it passes.
|
| |
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
* src/util.c (make_tempfile): Create missing directories when
necessary.
|
| |
|
|
|
| |
* src/util.c: USE_XATTR is defined to 0 or 1, so we need to use #if
instead of #ifdef.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
| |
* src/util.c (set_file_attributes): Always expect the mode
argument to be set when FA_MODE is specified.
(create_backup_copy): Update accordingly.
|
| |
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
| |
* bootstrap.conf: Use the gnulib tempname module.
* src/util.c (make_tempfile): New function.
|
| |
|
|
|
|
|
|
|
| |
* src/pch.c (includes): Add <io.h> for setmode.
(intuit_diff_type): Avoid 8-bit problems.
* src/util.c (parse_name): Likewise.
* src/util.h (skip_spaces): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
| |
|
|
|
|
|
|
|
|
| |
* src/util.c (create_backup): Document patch's backup file logic.
(create_backup, create_backup_copy): Add a flag to remember the backup
file; use when a patch deletes a file.
(move_file, copy_file): Better error messages.
* tests/Makefile.am (TESTS): Remove remember-backup-files-2.
* tests/remember-backup-files: Add tests from remember-backup-files-2.
* tests/symlinks: Add a symlink backup file test.
|
| | |
|
| |
|
|
|
|
|
| |
* src/pch.c (fetchmode): Document that the "diff --git" format does
not store file permissions of symlinks.
* src/util.c (set_file_attributes): Since we don't have symlink file
permissions, don't try to set them even on systems where we could.
|
| |
|
|
|
|
| |
* Removing an empty file does not work as expected.
* Deleted files are not being remembered correctly.
* Symlinks are not being remembered, either.
|
| |
|
|
|
|
|
|
|
| |
* src/patch.c (main): Convert outname into a char const *.
* src/util.ch (create_backup, move_file, removedirs): Take char const *
filenames.
* src/util.c (makedirs): Take a char const * filename.
(makedirs, removedirs): Take char const * filenames. Create and
modify a copy of the filename.
|
| |
|
|
|
|
|
|
|
|
| |
* src/pch.c (p_copy, p_rename): New variables.
(pch_copy, pch_rename): New functions.
(intuit_diff_type): Parse the "copy from", "copy to", "rename from",
and "rename to" headers.
* src/util.c (fetchname): Return the fetched name per reference (after
freeing the previous name if any). Also free the previous timestamp
string if any.
|
| |
|
|
|
|
|
|
| |
* src/patch.c (main): When a git diff includes a file mode change,
change to the new mode.
* src/util.c (set_file_attributes): Add a mode parameter.
* tests/file-modes: New test case.
* tests/Makefile.am (TESTS): Add test case.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* src/util.c (copy_file): Require the mode parameter to include the
file type. Use that to decide whether to copy a regular file or a
symlink.
(create_backup): Refuse to back up files which are neither a regular
file nor a symlink.
(move_file): Add support for turning a temporary output file into a
symlink.
* src/patch.c (move_file, copy_file): Pass down the file type.
* src/pch.h (prefix_components): Do not follow symlinks.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* src/util.h (enum file_attributes): New type.
(set_file_attributes): New function.
* src/util.c (set_file_attributes): Move the code for setting file
attributes here from create_backup_copy() and make it usable from
patch.c as well. Make it symlink safe. In addition, also preserve
the file owner when permitted.
(create_backup_copy): Use set_file_attributes().
* src/patch.c (main): Use set_file_attributes().
* bootstrap.conf: Use the gnulib lchmod module.
|
| |
|
|
| |
* src/util.c (move_file): Remove test which is always true.
|
| |
|
|
|
| |
* src/util.h: Include <backupfile.h> here and not in each C file
individually; this avoids a warning in merge.c with some compilers.
|
| |
|
|
|
|
|
|
|
|
| |
* src/inp.c (get_input_file), src/pch.c (there_is_another_patch,
intuit_diff_type): Use lstat instead of stat. This causes patch to
refuse patching symlinks (get_input_file() will refuse to read them).
* src/util.c (create_backup): Refuse to create backups of symlinks.
* tests/symlinks: New test case.
* tests/Makefile.am (TESTS): Add test case.
* bootstrap.conf: Use the gnulib lstat module.
|
| |
|
|
|
| |
* src/common.h, src/patch.c, src/util.c, src/util.h: Do not declare
variables as "volatile" unnecessarily.
|
| |
|
|
|
|
|
| |
* src/inp.c, src/patch.c, src/pch.c, src/util.c: Stop declaring
local variables as "register" all over the place: a decent compiler
will do a good enough job of place variables into registers where it
makes sense.
|
| |
|
|
|
|
|
|
| |
* src/pch.c (intuit_diff_type): Parse filenames in "diff --git" lines.
* src/util.c (parse_name): New helper function for parsing unquoted or
quoted filenames.
* src/util.h (parse_name): Declare.
(skip_spaces): New helper function for skipping spaces in a string.
|
| |
|
|
|
|
|
| |
* src/util.c (parse_c_string): New function.
(fetchname): Add support for quoted filenames.
* tests/quoted-filenames: New test case.
* tests/Makefile.am (TESTS): Add test case.
|
| |
|
|
| |
* src/util.c (fetchname): Untangle the name and timestamp parsing.
|
| |
|
|
|
| |
* src/util.c (strip_leading_slashes): Make this a separate function.
(fetchname): Use strip_leading_slashes() here.
|
| |
|
|
|
|
|
|
|
|
| |
* src/patch.c (main): Support nanosecond timestamps. Replaqce utime()
with utimens().
* src/util.c (create_backup_copy): Preserve nanosecond timestamps.
Replace utime() with utimens().
* src/util.h: Remove the utime() related declarations, and include
the utimens() and nanosecond related headers instead.
* bootstrap.conf: Add the stat-time and utimens modules.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/Makefile.am (patch_SOURCES): Remove maketime.c, maketime.h,
partime.c, and partime.h.
(patch_LDFLAGS): Add LIB_CLOCK_GETTIME for clock_gettime().
* src/util.c: Replace maketime.h and partime.h with getdate.h.
(fetchname): Replace str2time() with get_date(). Sanitize the test
for epoch timestamps.
* src/patch.c (main): When --set-utc is given, set the TZ environment
variable to UTC so that get_date() will default to UTC timestamps.
* tests/preserve-mode-and-timestamp: Switching to get_date() revealed
that str2time() was ignoring timezones. In order to test --set-utc
now that get_date() fixes this, we must use timestamps that do not
include timestamps here.
* bootstrap.conf: Add the clock-time, getdate, gettime, and setenv
modules.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/pch.h (pch_timestamp): Return timestamp as struct timespec
instead of time_t.
* src/pch.c: Use struct timespec instead of time_t. A tv_sec value
of -1 indicates "no timestamp".
* src/util.h (fetchname): Return timestamp as struct timespec
instead of time_t.
* src/util.c (fetchname): str2time() does not give us nanoseconds; set
them to zero for now.
* src/patch.c (main): Only use the seconds in timestamps for now.
* bootstrap.conf: Add the time module for getting struct timespec
declared on old hosts.
|
| |
|
|
|
|
|
| |
* src/util.c (quote_system_arg): Add a replacement for
quote_system_arg() which uses quotearg's shell quoting style.
* src/Makefile.am (patch_SOURCES): Remove quotesys.c and quotesys.h.
* src/quotesys.c, src/quotesys.h: Delete.
|
| |
|
|
| |
* src/util.c (fetchname): Cosmetic fix.
|
| |
|
|
| |
* Globally rename type LINENUM to lin (as in diffutils).
|
| |
|
|
|
|
|
|
| |
* src/bestmatch.h, src/diffseq.h, src/inp.c, src/maketime.c,
src/merge.c, src/partime.c, src/pch.c, src/util.c: No longer use
"continue" as the only instruction in a loop body: at least one
compiler chokes on this in combination with variable-length arrays
as in src/bestmatch.h.
|
| |
|
|
| |
* src/util.c (fetchname): Do not allow timestamps in Index lines.
|
| |
|
|
|
| |
* src/util.c (create_backup_copy): Try to preserve the owning group
in backup files.
|
| |
|
|
|
|
|
|
| |
src/maketime.c, src/maketime.h, src/merge.c, src/partime.c,
src/partime.h, src/patch.c, src/pch.c, src/pch.h, src/quotesys.c,
src/util.c, src/util.h, src/version.c: Add year 2010 to copyright
notice. Replace the GPLv2 license template with the GPLv3 license
template.
|
| | |
|
| | |
|
| | |
|
| | |
|