<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/patch.git, branch master</title>
<subtitle>git.savannah.gnu.org: git/patch.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/'/>
<entry>
<title>Pass the correct stat to backup files</title>
<updated>2022-05-10T08:53:04+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2022-04-06T08:48:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=c835ecc67b7e37c0d0b7dd7e032209fdaa285808'/>
<id>c835ecc67b7e37c0d0b7dd7e032209fdaa285808</id>
<content type='text'>
The last case to call output_file() in the main loop is
    output_file (outname, NULL, &amp;tmpoutst, NULL, NULL,
                 file_type | 0, backup);
and this essentially means to create a backup file (where to=NULL)
only if backup=true, and does nothing else.

And, in the current code, the passed file stat (&amp;tmpoutst) is a file
stat of the temporary file that has been processed, not the original
file (outname) to be backed up.  When the backup is performed
immediately, this is no big problem.  However, output_file() may
schedule the deferred handling, and the given file may be backed up at
a later point.  The problem is that create_backup() tries to avoid the
backup of the same file twice, and it checks the given stat i-node
number in the hash list.  Since it's a stat of a temporary file, the
same i-node number may be reused once a temp file is deleted and
another is created.  This results in a false-positive detection of the
already existing file, eventually missing a backup file.

This patch attempts to address the issue:
- Modify the condition for better understanding, clearly indicating
  that the code there is for creating a backup file
- Pass the stat of the original file instead of a temporary file

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1198106
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Jean Delvare &lt;jdelvare@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The last case to call output_file() in the main loop is
    output_file (outname, NULL, &amp;tmpoutst, NULL, NULL,
                 file_type | 0, backup);
and this essentially means to create a backup file (where to=NULL)
only if backup=true, and does nothing else.

And, in the current code, the passed file stat (&amp;tmpoutst) is a file
stat of the temporary file that has been processed, not the original
file (outname) to be backed up.  When the backup is performed
immediately, this is no big problem.  However, output_file() may
schedule the deferred handling, and the given file may be backed up at
a later point.  The problem is that create_backup() tries to avoid the
backup of the same file twice, and it checks the given stat i-node
number in the hash list.  Since it's a stat of a temporary file, the
same i-node number may be reused once a temp file is deleted and
another is created.  This results in a false-positive detection of the
already existing file, eventually missing a backup file.

This patch attempts to address the issue:
- Modify the condition for better understanding, clearly indicating
  that the code there is for creating a backup file
- Pass the stat of the original file instead of a temporary file

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1198106
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Jean Delvare &lt;jdelvare@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>maint: modernize README-{hacking,prereq}</title>
<updated>2021-10-30T23:33:05+00:00</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-10-30T23:28:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=24f81beb27b3ea92bc6bccfca960f93de7f9055d'/>
<id>24f81beb27b3ea92bc6bccfca960f93de7f9055d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix test for presence of BASH_LINENO[0]</title>
<updated>2021-01-08T09:15:31+00:00</updated>
<author>
<name>Kerin Millar</name>
<email>kfm@plushkava.net</email>
</author>
<published>2021-01-03T07:25:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=7623b2dc0d1837ecfd58f32efc78e35834deeb38'/>
<id>7623b2dc0d1837ecfd58f32efc78e35834deeb38</id>
<content type='text'>
eval is not some sort of magical sandbox for executing code that might cause
the shell's parser to take exception. Render the test resilient by carrying
it out within a subshell. While at it, position the redirection so that
STDERR is, in fact, muted.

Signed-off-by: Kerin Millar &lt;kfm@plushkava.net&gt;
Reported-by: Paolo Pedroni &lt;paolo.pedroni@iol.it&gt;
Closes: https://bugs.gentoo.org/738810
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
eval is not some sort of magical sandbox for executing code that might cause
the shell's parser to take exception. Render the test resilient by carrying
it out within a subshell. While at it, position the redirection so that
STDERR is, in fact, muted.

Signed-off-by: Kerin Millar &lt;kfm@plushkava.net&gt;
Reported-by: Paolo Pedroni &lt;paolo.pedroni@iol.it&gt;
Closes: https://bugs.gentoo.org/738810
</pre>
</div>
</content>
</entry>
<entry>
<title>gnulib: update to latest</title>
<updated>2020-05-14T12:01:13+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2020-05-14T10:36:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=099394003477b83c2eb4be07fd0173d6e696cf4e'/>
<id>099394003477b83c2eb4be07fd0173d6e696cf4e</id>
<content type='text'>
* bootstrap: Update.
* bootstrap.conf (gnulib_modules): Replace getdate with parse-datetime, malloc
with malloc-gnu, and realloc with realloc-gnu.
* src/patch.c (main): Function find_backup_file_name has gained a new dir_fd
argument.
* src/util.c (create_backup): Likewise.
(fetchname): Function get_date has been renamed to parse_datetime.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bootstrap: Update.
* bootstrap.conf (gnulib_modules): Replace getdate with parse-datetime, malloc
with malloc-gnu, and realloc with realloc-gnu.
* src/patch.c (main): Function find_backup_file_name has gained a new dir_fd
argument.
* src/util.c (create_backup): Likewise.
(fetchname): Function get_date has been renamed to parse_datetime.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add missing-section tests to context-format test case</title>
<updated>2019-12-23T23:26:49+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2019-07-30T10:10:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=78ed9decdf54d6185d3d3d1ef8784f5978f81422'/>
<id>78ed9decdf54d6185d3d3d1ef8784f5978f81422</id>
<content type='text'>
* tests/context-format: Add tests with a missing pattern and a missing
replacement section in a hunk.  Patch should fill in the missing
sections from the existing sections.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* tests/context-format: Add tests with a missing pattern and a missing
replacement section in a hunk.  Patch should fill in the missing
sections from the existing sections.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix failed assertion 'outstate-&gt;after_newline'</title>
<updated>2019-07-15T23:16:28+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2019-07-15T23:16:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=76e775847f4954b63dc72afe34d9d921c6688b31'/>
<id>76e775847f4954b63dc72afe34d9d921c6688b31</id>
<content type='text'>
The assertion triggers when the -o FILE option is used, more than one output
file is written into FILE, and one of those files (except the last one) ends in
the middle of a line.
* src/patch.c (main): Fix the case described above.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The assertion triggers when the -o FILE option is used, more than one output
file is written into FILE, and one of those files (except the last one) ends in
the middle of a line.
* src/patch.c (main): Fix the case described above.
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid invalid memory access in context format diffs</title>
<updated>2019-07-15T17:53:50+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2019-07-15T17:10:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=15b158db3ae11cb835f2eb8d2eb48e09d1a4af48'/>
<id>15b158db3ae11cb835f2eb8d2eb48e09d1a4af48</id>
<content type='text'>
* src/pch.c (another_hunk): Avoid invalid memory access in context format
diffs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/pch.c (another_hunk): Avoid invalid memory access in context format
diffs.
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't follow symlinks unless --follow-symlinks is given</title>
<updated>2019-07-15T17:53:27+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2019-07-15T14:21:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=dce4683cbbe107a95f1f0d45fabc304acfb5d71a'/>
<id>dce4683cbbe107a95f1f0d45fabc304acfb5d71a</id>
<content type='text'>
* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
append_to_file): Unless the --follow-symlinks option is given, open files with
the O_NOFOLLOW flag to avoid following symlinks.  So far, we were only doing
that consistently for input files.
* src/util.c (create_backup): When creating empty backup files, (re)create them
with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
append_to_file): Unless the --follow-symlinks option is given, open files with
the O_NOFOLLOW flag to avoid following symlinks.  So far, we were only doing
that consistently for input files.
* src/util.c (create_backup): When creating empty backup files, (re)create them
with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't crash when RLIMIT_NOFILE is set to RLIM_INFINITY</title>
<updated>2019-06-28T09:20:31+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2019-06-27T09:10:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=61d7788b83b302207a67b82786f4fd79e3538f30'/>
<id>61d7788b83b302207a67b82786f4fd79e3538f30</id>
<content type='text'>
* src/safe.c (min_cached_fds): Define minimum number of cached dir file
descriptors.
(max_cached_fds): Change type to rlim_t to allow storing RLIM_INFINITY.
(init_dirfd_cache): Set max_cached_fds to RLIM_INFINITY when RLIMIT_NOFILE is
RLIM_INFINITY.  Set the initial hash table size to min_cached_fds, independent
of RLIMIT_NOFILE: patches commonly only affect one or a few files, so a small
hash table will usually suffice; if needed, the hash table will grow.
(insert_cached_dirfd): Don't shrink the cache when max_cached_fds is
RLIM_INFINITY.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/safe.c (min_cached_fds): Define minimum number of cached dir file
descriptors.
(max_cached_fds): Change type to rlim_t to allow storing RLIM_INFINITY.
(init_dirfd_cache): Set max_cached_fds to RLIM_INFINITY when RLIMIT_NOFILE is
RLIM_INFINITY.  Set the initial hash table size to min_cached_fds, independent
of RLIMIT_NOFILE: patches commonly only affect one or a few files, so a small
hash table will usually suffice; if needed, the hash table will grow.
(insert_cached_dirfd): Don't shrink the cache when max_cached_fds is
RLIM_INFINITY.
</pre>
</div>
</content>
</entry>
<entry>
<title>Abort when cleaning up fails</title>
<updated>2019-06-27T22:46:06+00:00</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@gnu.org</email>
</author>
<published>2019-06-27T22:30:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/patch.git/commit/?id=b7b028a77bd855f6f56b17c8837fc1cca77b469d'/>
<id>b7b028a77bd855f6f56b17c8837fc1cca77b469d</id>
<content type='text'>
When a fatal error triggers during cleanup, another attempt will be made to
clean up, which will likely lead to the same fatal error.  So instead, bail out
when that happens.
src/patch.c (cleanup): Bail out when called recursively.
(main): There is no need to call output_files() before cleanup() as cleanup()
already does that.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a fatal error triggers during cleanup, another attempt will be made to
clean up, which will likely lead to the same fatal error.  So instead, bail out
when that happens.
src/patch.c (cleanup): Bail out when called recursively.
(main): There is no need to call output_files() before cleanup() as cleanup()
already does that.
</pre>
</div>
</content>
</entry>
</feed>
