85 Commits

Author SHA256 Message Date
bdc89f604c Accepting request 1269225 from devel:tools
OBS-URL: https://build.opensuse.org/request/show/1269225
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=49
2025-04-16 18:38:13 +00:00
71f68bb3b0 Accepting request 1190852 from devel:tools
OBS-URL: https://build.opensuse.org/request/show/1190852
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=48
2024-08-02 15:25:27 +00:00
Martin Pluskal
34ab9541b6 Accepting request 1190482 from home:wfrisch:branches:devel:tools
- CVE-2019-20633.patch: Fix double-free/OOB read in pch.c (bsc#1167721)

OBS-URL: https://build.opensuse.org/request/show/1190482
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=70
2024-08-01 05:09:25 +00:00
dd790c3a68 Accepting request 1155079 from devel:tools
OBS-URL: https://build.opensuse.org/request/show/1155079
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=47
2024-03-06 22:04:06 +00:00
Jean Delvare
9162726f31 Accepting request 1153335 from home:dimstar:rpm4.20:p
Prepare for RPM 4.20

OBS-URL: https://build.opensuse.org/request/show/1153335
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=68
2024-03-05 10:49:20 +00:00
18e7b9ac6d Accepting request 980591 from devel:tools
OBS-URL: https://build.opensuse.org/request/show/980591
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=46
2022-06-09 12:09:45 +00:00
Martin Pluskal
06ada574ee Accepting request 979116 from home:coolo:branches:devel:tools
- Do not link unversioned file by URL
- Replace group keyring not intended for release checking with
  (expired since 2018) public key of Andreas

OBS-URL: https://build.opensuse.org/request/show/979116
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=66
2022-06-03 08:26:02 +00:00
0ae34683d5 Accepting request 976181 from devel:tools
- fix-swapping-fake-lines-in-pch_swap.patch: Fix swapping fake
  lines in pch_swap. This bug was causing a double free leading to
  a crash (boo#1080985 CVE-2018-6952).
- abort-when-cleaning-up-fails.patch: Abort when cleaning up fails.
  This bug could cause an infinite loop when a patch wouldn't
  apply, leading to a segmentation fault (boo#1111572).
- dont-follow-symlinks-unless-asked.patch: Don't follow symlinks
  unless --follow-symlinks is given. This increases the security
  against malicious patches (boo#1142041 CVE-2019-13636).
- pass-the-correct-stat-to-backup-files.patch: Pass the correct
  stat to backup files. This bug would occasionally cause backup
  files to be missing when all hunks failed to apply (boo#1198106).

OBS-URL: https://build.opensuse.org/request/show/976181
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=45
2022-05-12 20:57:23 +00:00
Jean Delvare
0c9f15e1a7 - fix-swapping-fake-lines-in-pch_swap.patch: Fix swapping fake
lines in pch_swap. This bug was causing a double free leading to
  a crash (boo#1080985 CVE-2018-6952).
- abort-when-cleaning-up-fails.patch: Abort when cleaning up fails.
  This bug could cause an infinite loop when a patch wouldn't
  apply, leading to a segmentation fault (boo#1111572).
- dont-follow-symlinks-unless-asked.patch: Don't follow symlinks
  unless --follow-symlinks is given. This increases the security
  against malicious patches (boo#1142041 CVE-2019-13636).
- pass-the-correct-stat-to-backup-files.patch: Pass the correct
  stat to backup files. This bug would occasionally cause backup
  files to be missing when all hunks failed to apply (boo#1198106).

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=64
2022-05-10 16:59:21 +00:00
d989842004 Accepting request 922373 from devel:tools
OBS-URL: https://build.opensuse.org/request/show/922373
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=44
2021-10-25 13:16:42 +00:00
Jean Delvare
fe014dfd31 Accepting request 922315 from home:dimstar:Factory
- Do not query %{verbose} to add V=1 or not: verbose changed
  semantics between rpm versions and there is currently no variant
  supporting rpm < 4.17 and rpm >= 4.17.

OBS-URL: https://build.opensuse.org/request/show/922315
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=63
2021-09-30 13:02:32 +00:00
51036daddf Accepting request 605717 from devel:tools
- ed-style-07-dont-leak-tmp-file.patch,
  ed-style-08-dont-leak-tmp-file-multi.patch: Fix temporary file
  leak when applying ed-style patches (bsc#1092500,
  savannah#53820).

OBS-URL: https://build.opensuse.org/request/show/605717
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=43
2018-05-13 13:53:43 +00:00
Jean Delvare
c90ceb95d6 - ed-style-07-dont-leak-tmp-file.patch,
ed-style-08-dont-leak-tmp-file-multi.patch: Fix temporary file
  leak when applying ed-style patches (bsc#1092500,
  savannah#53820).

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=61
2018-05-09 09:53:49 +00:00
4a1162ae0f Accepting request 597758 from devel:tools
Fix arbitrary command execution in ed-style patches (CVE-2018-1000156, bsc#1088420)

OBS-URL: https://build.opensuse.org/request/show/597758
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=42
2018-04-22 12:42:28 +00:00
Jean Delvare
7f7fcb70a3 - Add ed as BuildRequires so ed-style patches can be checked by
the test suite.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=59
2018-04-18 09:18:05 +00:00
Jean Delvare
113fbdee3e Fix CVE-2018-1000156 (bsc#1088420, savannah#53566).
- ed-style-01-missing-input-files.patch: Allow input files to be
  missing for ed-style patches.
- ed-style-02-fix-arbitrary-command-execution.patch,
  ed-style-03-update-test-Makefile.patch: Fix arbitrary command
  execution in ed-style patches.
- ed-style-04-invoke-ed-directly.patch: Invoke ed directly instead
  of using the shell.
- ed-style-05-minor-cleanups.patch: Minor cleanups in do_ed_script.
- ed-style-06-fix-test-failure.patch: Fix 'ed-style' test failure.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=58
2018-04-18 08:58:17 +00:00
9dfa552ac5 Accepting request 590591 from devel:tools
- Move COPYING from %doc to %license.
- Add AUTHORS and COPYING to %doc.
- fix-segfault-mangled-rename.patch: Fix segfault with mangled
  rename patch (bsc#1080951, CVE-2018-6951, savannah#53132).
- patch 2.7.6:
  * Files specified on the command line are no longer verified to
    be inside the current working directory, so commands like
    "patch -i foo.diff ../foo" will work again
  * Fixes CVE-2016-10713 (Out-of-bounds access within
    pch_write_line() in pch.c could possibly lead to DoS via a
    crafted input file; bsc#1080918)
  * Various fixes

OBS-URL: https://build.opensuse.org/request/show/590591
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=41
2018-03-30 09:55:13 +00:00
Jean Delvare
7364d525c4 %license should work on SLE_12_SP2 now.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=56
2018-03-26 07:49:20 +00:00
Jean Delvare
163aef10cd Don't use %license on SLE_12_SP2, it does not work.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=55
2018-03-22 14:22:21 +00:00
Jean Delvare
27e7211fa9 - Move COPYING from %doc to %license.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=54
2018-03-22 08:44:22 +00:00
Jean Delvare
03fcca2352 Update changes file to mention CVE-2016-10713
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=53
2018-03-21 16:13:53 +00:00
Jean Delvare
2bda6a542b - Add AUTHORS and COPYING to %doc.
- fix-segfault-mangled-rename.patch: Fix segfault with mangled
  rename patch (bsc#1080951, CVE-2018-6951, savannah#53132).

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=52
2018-03-21 15:47:14 +00:00
Jean Delvare
a19fa79f16 Accepting request 573892 from home:AndreasStieger:branches:devel:tools
patch 2.7.6

OBS-URL: https://build.opensuse.org/request/show/573892
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=51
2018-02-14 10:52:50 +00:00
961092e7ae Accepting request 290774 from devel:tools
Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/290774
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=40
2015-03-16 05:55:02 +00:00
Jean Delvare
6f0d2bb9b0 Fix SLE_11_SP3 build
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=49
2015-03-07 10:36:08 +00:00
Jean Delvare
652a1be131 - patch 2.7.5
Fixes a functional regression introduced by the previous update. 
  + Patching through symbolic links works again, as long as the
    target is within the working tree.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=48
2015-03-07 09:46:19 +00:00
f7a0be8225 Accepting request 287342 from devel:tools
Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/287342
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=39
2015-03-01 13:45:27 +00:00
Jean Delvare
aca5b2b799 - patch 2.7.4
Fixes a functional regression introduced by the previous security
  fix. The security fix would forbid legitimate use cases of
  relative symbolic links.
  [boo#918058]
  + Allow arbitrary symlink targets again.
  + Do not change permissions if there isn't an explicit mode
    change.
  + Fix indentation heuristic for context diffs.
- Please also note that the previous update fixed security bugs
  boo#915328 and boo#915329 even though it did not say so.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=46
2015-02-16 14:06:29 +00:00
Martin Pluskal
002b7f85d2 Update patch.keyring
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=45
2015-01-26 19:50:19 +00:00
Martin Pluskal
8cbaa2a560 Accepting request 282506 from home:AndreasStieger:branches:devel:tools
patch 2.7.3 [boo#913678] [CVE-2015-1196]

OBS-URL: https://build.opensuse.org/request/show/282506
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=44
2015-01-26 19:44:12 +00:00
a361305fd1 Accepting request 262036 from devel:tools
Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/262036
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=38
2014-11-24 10:08:00 +00:00
Jean Delvare
cb63dc7adf Update upstream status.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=42
2014-11-10 11:45:21 +00:00
Jean Delvare
88d552055b - reject-print-function-01-drop-useless-test.patch: Drop useless
test in another_hunk().
- reject-print-function-02-handle-unified-format.patch: Preserve C
  function name in unified rejects (bnc#904519).

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=41
2014-11-10 10:38:51 +00:00
Stephan Kulow
c27d19435f Accepting request 236123 from devel:tools
- error-report-crash.patch: fix crash after reporting error during option
  parsing (forwarded request 234823 from jdelvare)

OBS-URL: https://build.opensuse.org/request/show/236123
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=36
2014-06-18 20:04:30 +00:00
Jean Delvare
3a734d31a8 Accepting request 234823 from home:Andreas_Schwab:Factory
- error-report-crash.patch: fix crash after reporting error during option
  parsing

OBS-URL: https://build.opensuse.org/request/show/234823
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=39
2014-06-03 08:28:09 +00:00
Stephan Kulow
561fe96475 Accepting request 144605 from devel:tools
Update to version 2.7.1.

OBS-URL: https://build.opensuse.org/request/show/144605
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=33
2012-12-10 11:20:28 +00:00
Jean Delvare
0c36e4a3d8 - Back to bz2 archive format as old products lack xz.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=37
2012-12-06 15:20:24 +00:00
Jean Delvare
8f63ffa22d - Add missing build requirement: xz.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=36
2012-12-06 15:04:53 +00:00
Jean Delvare
89dd502416 - Version 2.7.1
+ Patch no longer gets a failed assertion for certain mangled
    patches.
  + Ignore destination file names that are absolute or that contain
    a component of "..", except when working in the root directory.
    This addresses CVE-2010-4651.
  + Support for most features of the "diff --git" format, including
    renames and copies, permission changes, and symlink diffs.
    Binary diffs are not supported yet; patch will complain and
    skip them.
  + Support for double-quoted filenames: when a filename starts
    with a double quote, it is interpreted as a C string literal.
    The escape sequences \\, \", \a, \b, \f, \n, \r, \t, \v, and
    \ooo (a three-digit octal number between 0 and 255) are
    recognized.
  + Refuse to apply a normal patch to a symlink. (Previous versions
    of patch were replacing the symlink with a regular file.)
  + New --follow-symlinks option to allow to treat symlinks as
    files: this was patch's behavior before version 2.7.
  + When trying to modify a read-only file, warn about the
    potential problem by default. The --read-only command line
    option allows to change this behavior.
  + Files to be deleted are deleted once the entire input has been
    processed, not immediately. This fixes a bug with numbered
    backup files.
  + When a timestamp specifies a time zone, honor that instead of
    assuming the local time zone (--set-date) or Universal
    Coordinated Time (--set-utc).
  + Support for nanosecond precision timestamps.
  + Many bug fixes.
  + Clarify the message printed when a patch is expected to empty
    out and delete a file, but the file does not become empty.
  + Various improvements to messages when applying a patch to a
    file of different type (regular file vs. symlink), when there
    are line ending differences (LF vs. CRLF), and when in
    --dry-run mode.
  + Ignore when extended attributes cannot be preserved because
    they are unsupported or because permission to set them is
    denied.
- patch-revert-e0f70752.patch: Dropped, original bug fixed
  upstream.
- patch-stdio.in.patch: Dropped, merged upstream.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=35
2012-12-06 14:43:28 +00:00
Stephan Kulow
5e8bb3b532 Accepting request 133232 from devel:tools
- patch-stdio.in.patch:
   Fix build with missing gets declaration (glibc 2.16)

OBS-URL: https://build.opensuse.org/request/show/133232
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=32
2012-09-13 05:07:24 +00:00
Stephan Kulow
2c113766b1 - patch-stdio.in.patch:
Fix build with missing gets declaration (glibc 2.16)

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=33
2012-09-07 12:46:28 +00:00
d6b22c081d Accepting request 128103 from home:a_jaeger:FactoryFix
Fix build with missing gets declaration (glibc 2.16)

OBS-URL: https://build.opensuse.org/request/show/128103
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=32
2012-08-07 07:30:43 +00:00
Stephan Kulow
744f4fc71c Accepting request 113094 from devel:tools
- Revert broken upstream commit (bnc#755136).
- Update to a less ancient alpha snapshot.

OBS-URL: https://build.opensuse.org/request/show/113094
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=30
2012-04-12 07:44:52 +00:00
Jean Delvare
0a622f8d7f - patch-revert-e0f70752.patch: Revert broken upstream commit
(bnc#755136).

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=30
2012-04-06 12:24:18 +00:00
Jean Delvare
32ed207b62 xz isn't available in SLE11 SP1 and older, so stick to bzip2 for now.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=29
2012-04-05 08:25:04 +00:00
Jean Delvare
edf8511579 Add missing BuildRequires.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=28
2012-04-04 18:41:46 +00:00
Jean Delvare
231fb6e34a - Version 2.6.1.136
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=27
2012-04-04 17:17:36 +00:00
Stephan Kulow
23f7e8097f replace license with spdx.org variant
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=29
2011-12-06 17:36:03 +00:00
Ruediger Oertel
044aea8b43 Accepting request 86710 from devel:tools
- cross-build fix: use %configure macro (forwarded request 86685 from uli_suse)

OBS-URL: https://build.opensuse.org/request/show/86710
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=27
2011-10-06 14:44:41 +00:00
2c983da3bb Accepting request 86685 from home:uli_suse:branches:devel:tools
- cross-build fix: use %configure macro

OBS-URL: https://build.opensuse.org/request/show/86685
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=25
2011-10-05 15:23:39 +00:00
Sascha Peilicke
57e09f332d Autobuild autoformatter for 66399
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=26
2011-04-07 08:07:32 +00:00
OBS User buildservice-autocommit
8370b5d1b8 Updating link to change in openSUSE:Factory/patch revision 26.0
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=d36540181dc7f1b623796d54ec610ff6
2011-04-07 08:07:32 +00:00
Sascha Peilicke
b72fc26176 Accepting request 66399 from devel:tools
Accepted submit request 66399 from user coolo

OBS-URL: https://build.opensuse.org/request/show/66399
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=25
2011-04-07 08:07:03 +00:00
Jean Delvare
cffc447f94 Document the conflict with patchutils < 0.3.2.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=23
2011-04-04 15:31:57 +00:00
Jean Delvare
4a75e4b044 - Version 2.6.1.116:
+ Patch now ignores destination file names that are absolute or
    that contain a component of ".." (CVE-2010-4651, bnc#662957).
- Drop unified-reject-files-compat.diff. Compatibility has been
  provided for the past 18 months, hopefully nobody is relying on
  it any longer.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=22
2011-04-04 13:15:18 +00:00
OBS User autobuild
97191683e0 Accepting request 49168 from devel:tools
Copy from devel:tools/patch based on submit request 49168 from user coolo

OBS-URL: https://build.opensuse.org/request/show/49168
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=23
2010-09-27 13:51:16 +00:00
OBS User autobuild
f47cd05101 Accepting request 49168 from devel:tools
checked in (request 49168)

OBS-URL: https://build.opensuse.org/request/show/49168
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=21
2010-09-27 13:51:15 +00:00
Andreas Gruenbacher
873f1112d9 Accepting request 42404 from home:jengelh:smp
Copy from home:jengelh:smp/patch via accept of submit request 42404 revision 2.
Request was accepted with message:
reviewed ok.

OBS-URL: https://build.opensuse.org/request/show/42404
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=20
2010-07-02 08:21:11 +00:00
OBS User autobuild
4f6c787180 Accepting request 39416 from devel:tools
Copy from devel:tools/patch based on submit request 39416 from user agruen

OBS-URL: https://build.opensuse.org/request/show/39416
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=20
2010-05-05 20:51:18 +00:00
OBS User buildservice-autocommit
1a4053bd8e Updating link to change in openSUSE:Factory/patch revision 20.0
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=1fb07bfae10cb5cabf8c560f45b3402d
2010-05-05 20:51:18 +00:00
OBS User autobuild
fb3b41f19d Accepting request 39416 from devel:tools
checked in (request 39416)

OBS-URL: https://build.opensuse.org/request/show/39416
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=19
2010-05-05 20:51:17 +00:00
Andreas Gruenbacher
e6cdd7d5c3 - Version 2.6.1.81:
+ Fix backup file detection for deleted files
  + Allow to create and delete empty files
  + Stick to the best name in the reversed-patch check
  + Various portability improvements

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=18
2010-05-04 23:37:55 +00:00
OBS User autobuild
517563b876 Accepting request 39270 from devel:tools
Copy from devel:tools/patch based on submit request 39270 from user agruen

OBS-URL: https://build.opensuse.org/request/show/39270
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=19
2010-05-03 19:39:00 +00:00
OBS User buildservice-autocommit
7c1a299de1 Updating link to change in openSUSE:Factory/patch revision 19.0
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=d8fc6c51ce681fb6c01e6f1d9cced28f
2010-05-03 19:39:00 +00:00
OBS User autobuild
c18f09dedd Accepting request 39270 from devel:tools
checked in (request 39270)

OBS-URL: https://build.opensuse.org/request/show/39270
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=17
2010-05-03 19:38:59 +00:00
Andreas Gruenbacher
0a6686df2c - Fix the linker library order.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=16
2010-05-02 13:58:21 +00:00
Andreas Gruenbacher
34ab43d3ca - Be more verbose when %verbose is defined.
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=15
2010-05-02 12:41:33 +00:00
Andreas Gruenbacher
3b8bf5d048 - Version 2.6.1.64:
+ Support for most features of the "diff --git" format: renames
    and copies, permission changes, symlink diffs.  (Binary diffs
    are not supported yet; patch will complain and skip them.)
  + Support for double-quoted filenames: when a filename in a
    context diff starts with a double quote, it is interpreted as
    a C string literal.  The escape sequences \\, \", \a, \b, \f, \n,
    \r, \t, \v, and \ooo (a three-digit octal number between 0 and
    255) are recognized.
  + Refuse to patch read-only files by default, or at least warn
    when patching such files with --force or --batch.
  + Refuse to apply a normal patch to a symlink.  (Previous
    versions of patch were wrongly replacing the symlink with a
    regular file.)
  + When a timestamp specifies a time zone, honor that instead of
    assuming the local time zone (--set-date) or Universal
    Coordinated Time (--set-utc).
  + Support for nanosecond precision timestamps.
  + Many portability and bug fixes.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=14
2010-05-02 12:11:50 +00:00
OBS User autobuild
7581d29327 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=18 2010-03-18 15:15:11 +00:00
OBS User buildservice-autocommit
212b886518 Updating link to change in openSUSE:Factory/patch revision 18.0
OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=c3be1f47245ce36da5cdc505c399bb9e
2010-03-18 15:15:11 +00:00
OBS User autobuild
b9b24b06f2 Accepting request 30879 from devel:tools
Copy from devel:tools/patch based on submit request 30879 from user agruen

OBS-URL: https://build.opensuse.org/request/show/30879
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=17
2010-02-04 08:11:00 +00:00
OBS User autobuild
fc7cf49875 Accepting request 27907 from devel:tools
Copy from devel:tools/patch based on submit request 27907 from user agruen

OBS-URL: https://build.opensuse.org/request/show/27907
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=16
2010-01-08 16:31:55 +00:00
OBS User autobuild
2ff96b8001 Accepting request 27158 from devel:tools
Copy from devel:tools/patch based on submit request 27158 from user dirkmueller

OBS-URL: https://build.opensuse.org/request/show/27158
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=15
2009-12-21 13:32:32 +00:00
OBS User autobuild
e15ff121e8 Accepting request 21490 from devel:tools
Copy from devel:tools/patch based on submit request 21490 from user agruen

OBS-URL: https://build.opensuse.org/request/show/21490
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=13
2009-10-03 01:35:36 +00:00
OBS User unknown
4900247a4d OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=12 2009-07-23 16:41:11 +00:00
OBS User unknown
085266c636 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=11 2009-06-20 03:11:45 +00:00
OBS User unknown
13d7385c40 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=10 2009-04-07 23:00:02 +00:00
OBS User unknown
20880fd984 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=9 2009-04-07 09:58:41 +00:00
OBS User unknown
e2c9334e5c OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=8 2009-04-06 08:32:20 +00:00
OBS User unknown
940f272444 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=7 2009-04-02 16:49:52 +00:00
OBS User unknown
4031722516 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=6 2009-02-26 17:17:05 +00:00
OBS User unknown
e553963af3 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=5 2009-02-03 23:18:23 +00:00
OBS User unknown
ea52ba878c OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=3 2008-04-23 23:49:14 +00:00
OBS User unknown
3aeedafe31 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=2 2007-11-02 09:40:24 +00:00
OBS User unknown
eb1f8528c1 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patch?expand=0&rev=1 2006-12-18 23:17:23 +00:00
15 changed files with 0 additions and 868 deletions

View File

@@ -1,48 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 28 Jun 2019 00:30:25 +0200
Subject: Abort when cleaning up fails
Patch-mainline: Yes
Git-commit: b7b028a77bd855f6f56b17c8837fc1cca77b469d
References: boo#1111572 savannah#54845
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.
---
src/patch.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/src/patch.c
+++ b/src/patch.c
@@ -681,7 +681,6 @@ main (int argc, char **argv)
}
if (outstate.ofp && (ferror (outstate.ofp) || fclose (outstate.ofp) != 0))
write_fatal ();
- output_files (NULL);
cleanup ();
delete_files ();
if (somefailed)
@@ -1977,7 +1976,6 @@ void
fatal_exit (int sig)
{
cleanup ();
-
if (sig)
exit_with_signal (sig);
@@ -1997,6 +1995,12 @@ remove_if_needed (char const *name, bool
static void
cleanup (void)
{
+ static bool already_cleaning_up;
+
+ if (already_cleaning_up)
+ return;
+ already_cleaning_up = true;
+
remove_if_needed (TMPINNAME, &TMPINNAME_needs_removal);
remove_if_needed (TMPOUTNAME, &TMPOUTNAME_needs_removal);
remove_if_needed (TMPPATNAME, &TMPPATNAME_needs_removal);

View File

@@ -1,103 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Mon, 15 Jul 2019 16:21:48 +0200
Subject: Don't follow symlinks unless --follow-symlinks is given
Patch-mainline: Yes
Git-commit: dce4683cbbe107a95f1f0d45fabc304acfb5d71a
References: boo#1142041 CVE-2019-13636
* 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.
---
src/inp.c | 12 ++++++++++--
src/util.c | 14 +++++++++++---
2 files changed, 21 insertions(+), 5 deletions(-)
--- a/src/inp.c
+++ b/src/inp.c
@@ -238,8 +238,13 @@ plan_a (char const *filename)
{
if (S_ISREG (instat.st_mode))
{
- int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
+ int flags = O_RDONLY | binary_transput;
size_t buffered = 0, n;
+ int ifd;
+
+ if (! follow_symlinks)
+ flags |= O_NOFOLLOW;
+ ifd = safe_open (filename, flags, 0);
if (ifd < 0)
pfatal ("can't open file %s", quotearg (filename));
@@ -340,6 +345,7 @@ plan_a (char const *filename)
static void
plan_b (char const *filename)
{
+ int flags = O_RDONLY | binary_transput;
int ifd;
FILE *ifp;
int c;
@@ -353,7 +359,9 @@ plan_b (char const *filename)
if (instat.st_size == 0)
filename = NULL_DEVICE;
- if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
+ if (! follow_symlinks)
+ flags |= O_NOFOLLOW;
+ if ((ifd = safe_open (filename, flags, 0)) < 0
|| ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
pfatal ("Can't open file %s", quotearg (filename));
if (TMPINNAME_needs_removal)
--- a/src/util.c
+++ b/src/util.c
@@ -388,7 +388,7 @@ create_backup (char const *to, const str
try_makedirs_errno = ENOENT;
safe_unlink (bakname);
- while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
+ while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0)
{
if (errno != try_makedirs_errno)
pfatal ("Can't create file %s", quotearg (bakname));
@@ -579,10 +579,13 @@ create_file (char const *file, int open_
static void
copy_to_fd (const char *from, int tofd)
{
+ int from_flags = O_RDONLY | O_BINARY;
int fromfd;
ssize_t i;
- if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
+ if (! follow_symlinks)
+ from_flags |= O_NOFOLLOW;
+ if ((fromfd = safe_open (from, from_flags, 0)) < 0)
pfatal ("Can't reopen file %s", quotearg (from));
while ((i = read (fromfd, buf, bufsize)) != 0)
{
@@ -625,6 +628,8 @@ copy_file (char const *from, char const
else
{
assert (S_ISREG (mode));
+ if (! follow_symlinks)
+ to_flags |= O_NOFOLLOW;
tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode,
to_dir_known_to_exist);
copy_to_fd (from, tofd);
@@ -640,9 +645,12 @@ copy_file (char const *from, char const
void
append_to_file (char const *from, char const *to)
{
+ int to_flags = O_WRONLY | O_APPEND | O_BINARY;
int tofd;
- if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
+ if (! follow_symlinks)
+ to_flags |= O_NOFOLLOW;
+ if ((tofd = safe_open (to, to_flags, 0)) < 0)
pfatal ("Can't reopen file %s", quotearg (to));
copy_to_fd (from, tofd);
if (close (tofd) != 0)

View File

@@ -1,30 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 6 Apr 2018 11:34:51 +0200
Subject: Allow input files to be missing for ed-style patches
Patch-mainline: yes
Git-commit: b5a91a01e5d0897facdd0f49d64b76b0f02b43e1
References: bsc#1088420, savannah#53566, CVE-2018-1000156
* src/pch.c (do_ed_script): Allow input files to be missing so that new
files will be created as with non-ed-style patches.
---
src/pch.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/src/pch.c
+++ b/src/pch.c
@@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char c
if (! dry_run && ! skip_rest_of_patch) {
int exclusive = *outname_needs_removal ? 0 : O_EXCL;
- assert (! inerrno);
- *outname_needs_removal = true;
- copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+ if (inerrno != ENOENT)
+ {
+ *outname_needs_removal = true;
+ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+ }
sprintf (buf, "%s %s%s", editor_program,
verbosity == VERBOSE ? "" : "- ",
outname);

View File

@@ -1,201 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 6 Apr 2018 12:14:49 +0200
Subject: Fix arbitrary command execution in ed-style patches
Patch-mainline: yes
Git-commit: 123eaff0d5d1aebe128295959435b9ca5909c26d
References: bsc#1088420, savannah#53566, CVE-2018-1000156
* src/pch.c (do_ed_script): Write ed script to a temporary file instead
of piping it to ed: this will cause ed to abort on invalid commands
instead of rejecting them and carrying on.
* tests/ed-style: New test case.
* tests/Makefile.am (TESTS): Add test case.
---
src/pch.c | 91 +++++++++++++++++++++++++++++++++++++++---------------
tests/Makefile.am | 1
tests/ed-style | 41 ++++++++++++++++++++++++
3 files changed, 108 insertions(+), 25 deletions(-)
--- a/src/pch.c
+++ b/src/pch.c
@@ -33,6 +33,7 @@
# include <io.h>
#endif
#include <safe.h>
+#include <sys/wait.h>
#define INITHUNKMAX 125 /* initial dynamic allocation size */
@@ -2389,24 +2390,28 @@ do_ed_script (char const *inname, char c
static char const editor_program[] = EDITOR_PROGRAM;
file_offset beginning_of_this_line;
- FILE *pipefp = 0;
size_t chars_read;
+ FILE *tmpfp = 0;
+ char const *tmpname;
+ int tmpfd;
+ pid_t pid;
+
+ if (! dry_run && ! skip_rest_of_patch)
+ {
+ /* Write ed script to a temporary file. This causes ed to abort on
+ invalid commands such as when line numbers or ranges exceed the
+ number of available lines. When ed reads from a pipe, it rejects
+ invalid commands and treats the next line as a new command, which
+ can lead to arbitrary command execution. */
+
+ tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
+ if (tmpfd == -1)
+ pfatal ("Can't create temporary file %s", quotearg (tmpname));
+ tmpfp = fdopen (tmpfd, "w+b");
+ if (! tmpfp)
+ pfatal ("Can't open stream for file %s", quotearg (tmpname));
+ }
- if (! dry_run && ! skip_rest_of_patch) {
- int exclusive = *outname_needs_removal ? 0 : O_EXCL;
- if (inerrno != ENOENT)
- {
- *outname_needs_removal = true;
- copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
- }
- sprintf (buf, "%s %s%s", editor_program,
- verbosity == VERBOSE ? "" : "- ",
- outname);
- fflush (stdout);
- pipefp = popen(buf, binary_transput ? "wb" : "w");
- if (!pipefp)
- pfatal ("Can't open pipe to %s", quotearg (buf));
- }
for (;;) {
char ed_command_letter;
beginning_of_this_line = file_tell (pfp);
@@ -2417,14 +2422,14 @@ do_ed_script (char const *inname, char c
}
ed_command_letter = get_ed_command_letter (buf);
if (ed_command_letter) {
- if (pipefp)
- if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
+ if (tmpfp)
+ if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
write_fatal ();
if (ed_command_letter != 'd' && ed_command_letter != 's') {
p_pass_comments_through = true;
while ((chars_read = get_line ()) != 0) {
- if (pipefp)
- if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
+ if (tmpfp)
+ if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
write_fatal ();
if (chars_read == 2 && strEQ (buf, ".\n"))
break;
@@ -2437,13 +2442,49 @@ do_ed_script (char const *inname, char c
break;
}
}
- if (!pipefp)
+ if (!tmpfp)
return;
- if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, pipefp) == 0
- || fflush (pipefp) != 0)
+ if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, tmpfp) == 0
+ || fflush (tmpfp) != 0)
write_fatal ();
- if (pclose (pipefp) != 0)
- fatal ("%s FAILED", editor_program);
+
+ if (lseek (tmpfd, 0, SEEK_SET) == -1)
+ pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
+
+ if (! dry_run && ! skip_rest_of_patch) {
+ int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+ *outname_needs_removal = true;
+ if (inerrno != ENOENT)
+ {
+ *outname_needs_removal = true;
+ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+ }
+ sprintf (buf, "%s %s%s", editor_program,
+ verbosity == VERBOSE ? "" : "- ",
+ outname);
+ fflush (stdout);
+
+ pid = fork();
+ if (pid == -1)
+ pfatal ("Can't fork");
+ else if (pid == 0)
+ {
+ dup2 (tmpfd, 0);
+ execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
+ _exit (2);
+ }
+ else
+ {
+ int wstatus;
+ if (waitpid (pid, &wstatus, 0) == -1
+ || ! WIFEXITED (wstatus)
+ || WEXITSTATUS (wstatus) != 0)
+ fatal ("%s FAILED", editor_program);
+ }
+ }
+
+ fclose (tmpfp);
+ safe_unlink (tmpname);
if (ofp)
{
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,6 +32,7 @@ TESTS = \
crlf-handling \
dash-o-append \
deep-directories \
+ ed-style \
empty-files \
false-match \
fifo \
--- /dev/null
+++ b/tests/ed-style
@@ -0,0 +1,41 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+cat > ed1.diff <<EOF
+0a
+foo
+.
+EOF
+
+check 'patch -e foo -i ed1.diff' <<EOF
+EOF
+
+check 'cat foo' <<EOF
+foo
+EOF
+
+cat > ed2.diff <<EOF
+1337a
+r !echo bar
+,p
+EOF
+
+check 'patch -e foo -i ed2.diff 2> /dev/null || echo "Status: $?"' <<EOF
+?
+Status: 2
+EOF
+
+check 'cat foo' <<EOF
+foo
+EOF

View File

@@ -1,35 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Subject: Update tests/Makefile.in
Patch-mainline: no, temporary integration
References: bsc#1088420, savannah#53566, CVE-2018-1000156
Previous patch modifies tests/Makefile.am. Mirror the changes to
tests/Makefile.in so that we don't need automake.
---
tests/Makefile.in | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1308,6 +1308,7 @@ TESTS = \
crlf-handling \
dash-o-append \
deep-directories \
+ ed-style \
empty-files \
false-match \
fifo \
@@ -1638,6 +1639,13 @@ deep-directories.log: deep-directories
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+ed-style.log: ed-style
+ @p='ed-style'; \
+ b='ed-style'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
empty-files.log: empty-files
@p='empty-files'; \

View File

@@ -1,35 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 6 Apr 2018 19:36:15 +0200
Subject: Invoke ed directly instead of using the shell
Git-commit: 3fcd042d26d70856e826a42b5f93dc4854d80bf0
Patch-mainline: yes
References: bsc#1088420, savannah#53566, CVE-2018-1000156
* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell
command to avoid quoting vulnerabilities.
---
src/pch.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- a/src/pch.c
+++ b/src/pch.c
@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char c
*outname_needs_removal = true;
copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
}
- sprintf (buf, "%s %s%s", editor_program,
- verbosity == VERBOSE ? "" : "- ",
- outname);
fflush (stdout);
pid = fork();
@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char c
else if (pid == 0)
{
dup2 (tmpfd, 0);
- execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
+ assert (outname[0] != '!' && outname[0] != '-');
+ execlp (editor_program, editor_program, "-", outname, (char *) NULL);
_exit (2);
}
else

View File

@@ -1,95 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 6 Apr 2018 20:32:46 +0200
Subject: Minor cleanups in do_ed_script
Git-commit: 2a32bf09f5e9572da4be183bb0dbde8164351474
Patch-mainline: yes
References: bsc#1088420, savannah#53566, CVE-2018-1000156
* src/pch.c (do_ed_script): Minor cleanups.
Backporting notes: adjusted because we don't have commit ff1d3a67da1e
("Use gnulib execute module") so the context is very different.
---
src/pch.c | 56 +++++++++++++++++++++++++++-----------------------------
1 file changed, 27 insertions(+), 29 deletions(-)
--- a/src/pch.c
+++ b/src/pch.c
@@ -2395,6 +2395,8 @@ do_ed_script (char const *inname, char c
char const *tmpname;
int tmpfd;
pid_t pid;
+ int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+
if (! dry_run && ! skip_rest_of_patch)
{
@@ -2442,7 +2444,7 @@ do_ed_script (char const *inname, char c
break;
}
}
- if (!tmpfp)
+ if (dry_run || skip_rest_of_patch)
return;
if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, tmpfp) == 0
|| fflush (tmpfp) != 0)
@@ -2451,35 +2453,31 @@ do_ed_script (char const *inname, char c
if (lseek (tmpfd, 0, SEEK_SET) == -1)
pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
- if (! dry_run && ! skip_rest_of_patch) {
- int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+ if (inerrno != ENOENT)
+ {
*outname_needs_removal = true;
- if (inerrno != ENOENT)
- {
- *outname_needs_removal = true;
- copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
- }
- fflush (stdout);
-
- pid = fork();
- if (pid == -1)
- pfatal ("Can't fork");
- else if (pid == 0)
- {
- dup2 (tmpfd, 0);
- assert (outname[0] != '!' && outname[0] != '-');
- execlp (editor_program, editor_program, "-", outname, (char *) NULL);
- _exit (2);
- }
- else
- {
- int wstatus;
- if (waitpid (pid, &wstatus, 0) == -1
- || ! WIFEXITED (wstatus)
- || WEXITSTATUS (wstatus) != 0)
- fatal ("%s FAILED", editor_program);
- }
- }
+ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+ }
+ fflush (stdout);
+
+ pid = fork();
+ if (pid == -1)
+ pfatal ("Can't fork");
+ else if (pid == 0)
+ {
+ dup2 (tmpfd, 0);
+ assert (outname[0] != '!' && outname[0] != '-');
+ execlp (editor_program, editor_program, "-", outname, (char *) NULL);
+ _exit (2);
+ }
+ else
+ {
+ int wstatus;
+ if (waitpid (pid, &wstatus, 0) == -1
+ || ! WIFEXITED (wstatus)
+ || WEXITSTATUS (wstatus) != 0)
+ fatal ("%s FAILED", editor_program);
+ }
fclose (tmpfp);
safe_unlink (tmpname);

View File

@@ -1,24 +0,0 @@
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 7 Apr 2018 12:34:03 +0200
Subject: Fix 'ed-style' test failure
Git-commit: 458ac51a05426c1af9aa6bf1342ecf60728c19b4
Patch-mainline: yes
References: bsc#1088420, savannah#53566, CVE-2018-1000156
* tests/ed-style: Remove '?' line from expected output.
---
tests/ed-style | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/tests/ed-style
+++ b/tests/ed-style
@@ -31,8 +31,7 @@ r !echo bar
,p
EOF
-check 'patch -e foo -i ed2.diff 2> /dev/null || echo "Status: $?"' <<EOF
-?
+check 'patch -e foo -i ed2.diff > /dev/null 2> /dev/null || echo "Status: $?"' <<EOF
Status: 2
EOF

View File

@@ -1,95 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Thu, 3 May 2018 14:31:55 +0200
Subject: Don't leak temporary file on failed ed-style patch
Git-commit: 19599883ffb6a450d2884f081f8ecf68edbed7ee
Patch-mainline: yes
References: bsc#1092500, savannah#53820
Now that we write ed-style patches to a temporary file before we
apply them, we need to ensure that the temporary file is removed
before we leave, even on fatal error.
* src/pch.c (do_ed_script): Use global TMPEDNAME instead of local
tmpname. Don't unlink the file directly, instead tag it for removal
at exit time.
* src/patch.c (cleanup): Unlink TMPEDNAME at exit.
This closes bug #53820:
https://savannah.gnu.org/bugs/index.php?53820
Fixes: 123eaff0d5d1 ("Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)")
---
src/common.h | 2 ++
src/patch.c | 1 +
src/pch.c | 11 +++++------
3 files changed, 8 insertions(+), 6 deletions(-)
--- a/src/common.h
+++ b/src/common.h
@@ -94,10 +94,12 @@ XTERN char const *origsuff;
XTERN char const * TMPINNAME;
XTERN char const * TMPOUTNAME;
XTERN char const * TMPPATNAME;
+XTERN char const * TMPEDNAME;
XTERN bool TMPINNAME_needs_removal;
XTERN bool TMPOUTNAME_needs_removal;
XTERN bool TMPPATNAME_needs_removal;
+XTERN bool TMPEDNAME_needs_removal;
#ifdef DEBUGGING
XTERN int debug;
--- a/src/patch.c
+++ b/src/patch.c
@@ -1999,6 +1999,7 @@ cleanup (void)
remove_if_needed (TMPINNAME, &TMPINNAME_needs_removal);
remove_if_needed (TMPOUTNAME, &TMPOUTNAME_needs_removal);
remove_if_needed (TMPPATNAME, &TMPPATNAME_needs_removal);
+ remove_if_needed (TMPEDNAME, &TMPEDNAME_needs_removal);
remove_if_needed (TMPREJNAME, &TMPREJNAME_needs_removal);
output_files (NULL);
}
--- a/src/pch.c
+++ b/src/pch.c
@@ -2392,7 +2392,6 @@ do_ed_script (char const *inname, char c
file_offset beginning_of_this_line;
size_t chars_read;
FILE *tmpfp = 0;
- char const *tmpname;
int tmpfd;
pid_t pid;
int exclusive = *outname_needs_removal ? 0 : O_EXCL;
@@ -2406,12 +2405,13 @@ do_ed_script (char const *inname, char c
invalid commands and treats the next line as a new command, which
can lead to arbitrary command execution. */
- tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
+ tmpfd = make_tempfile (&TMPEDNAME, 'e', NULL, O_RDWR | O_BINARY, 0);
if (tmpfd == -1)
- pfatal ("Can't create temporary file %s", quotearg (tmpname));
+ pfatal ("Can't create temporary file %s", quotearg (TMPEDNAME));
+ TMPEDNAME_needs_removal = true;
tmpfp = fdopen (tmpfd, "w+b");
if (! tmpfp)
- pfatal ("Can't open stream for file %s", quotearg (tmpname));
+ pfatal ("Can't open stream for file %s", quotearg (TMPEDNAME));
}
for (;;) {
@@ -2451,7 +2451,7 @@ do_ed_script (char const *inname, char c
write_fatal ();
if (lseek (tmpfd, 0, SEEK_SET) == -1)
- pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
+ pfatal ("Can't rewind to the beginning of file %s", quotearg (TMPEDNAME));
if (inerrno != ENOENT)
{
@@ -2480,7 +2480,6 @@ do_ed_script (char const *inname, char c
}
fclose (tmpfp);
- safe_unlink (tmpname);
if (ofp)
{

View File

@@ -1,72 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 7 May 2018 15:14:45 +0200
Subject: Don't leak temporary file on failed multi-file ed-style patch
Git-commit: 369dcccdfa6336e5a873d6d63705cfbe04c55727
Patch-mainline: yes
References: bsc#1092500, savannah#53820
The previous fix worked fine with single-file ed-style patches, but
would still leak temporary files in the case of multi-file ed-style
patch. Fix that case as well, and extend the test case to check for
it.
* src/patch.c (main): Unlink TMPEDNAME if needed before moving to
the next file in a patch.
This closes bug #53820:
https://savannah.gnu.org/bugs/index.php?53820
Fixes: 123eaff0d5d1 ("Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)")
Fixes: 19599883ffb6 ("Don't leak temporary file on failed ed-style patch")
---
src/patch.c | 1 +
tests/ed-style | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
--- a/src/patch.c
+++ b/src/patch.c
@@ -236,6 +236,7 @@ main (int argc, char **argv)
}
remove_if_needed (TMPOUTNAME, &TMPOUTNAME_needs_removal);
}
+ remove_if_needed (TMPEDNAME, &TMPEDNAME_needs_removal);
if (! skip_rest_of_patch && ! file_type)
{
--- a/tests/ed-style
+++ b/tests/ed-style
@@ -38,3 +38,34 @@ EOF
check 'cat foo' <<EOF
foo
EOF
+
+# Test the case where one ed-style patch modifies several files
+
+cat > ed3.diff <<EOF
+--- foo
++++ foo
+1c
+bar
+.
+--- baz
++++ baz
+0a
+baz
+.
+EOF
+
+# Apparently we can't create a file with such a patch, while it works fine
+# when the file name is provided on the command line
+cat > baz <<EOF
+EOF
+
+check 'patch -e -i ed3.diff' <<EOF
+EOF
+
+check 'cat foo' <<EOF
+bar
+EOF
+
+check 'cat baz' <<EOF
+baz
+EOF

View File

@@ -1,25 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Mon, 12 Feb 2018 16:48:24 +0100
Subject: Fix segfault with mangled rename patch
Patch-mainline: yes
Git-commit: f290f48a621867084884bfff87f8093c15195e6a
References: bsc#1080951, CVE-2018-6951, savannah#53133
http://savannah.gnu.org/bugs/?53132
* src/pch.c (intuit_diff_type): Ensure that two filenames are specified
for renames and copies (fix the existing check).
diff --git a/src/pch.c b/src/pch.c
index ff9ed2c..bc6278c 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -974,7 +974,8 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
if ((pch_rename () || pch_copy ())
&& ! inname
&& ! ((i == OLD || i == NEW) &&
- p_name[! reverse] &&
+ p_name[reverse] && p_name[! reverse] &&
+ name_is_valid (p_name[reverse]) &&
name_is_valid (p_name[! reverse])))
{
say ("Cannot %s file without two valid file names\n", pch_rename () ? "rename" : "copy");

View File

@@ -1,27 +0,0 @@
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 17 Aug 2018 13:35:40 +0200
Subject: Fix swapping fake lines in pch_swap
Patch-mainline: Yes
Git-commit: 9c986353e420ead6e706262bf204d6e03322c300
References: boo#1080985 savannah#53133 CVE-2018-6952
* src/pch.c (pch_swap): Fix swapping p_bfake and p_efake when there is a
blank line in the middle of a context-diff hunk: that empty line stays
in the middle of the hunk and isn't swapped.
Fixes: https://savannah.gnu.org/bugs/index.php?53133
---
src/pch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/pch.c
+++ b/src/pch.c
@@ -2115,7 +2115,7 @@ pch_swap (void)
}
if (p_efake >= 0) { /* fix non-freeable ptr range */
if (p_efake <= i)
- n = p_end - i + 1;
+ n = p_end - p_ptrn_lines;
else
n = -i;
p_efake += n;

View File

@@ -1,59 +0,0 @@
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 6 Apr 2022 10:48:35 +0200
Subject: Pass the correct stat to backup files
Patch-mainline: Yes
Git-commit: c835ecc67b7e37c0d0b7dd7e032209fdaa285808
References: boo#1198106 savananh#62364
The last case to call output_file() in the main loop is
output_file (outname, NULL, &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 (&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 <tiwai@suse.de>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
src/patch.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/src/patch.c
+++ b/src/patch.c
@@ -611,9 +611,16 @@ main (int argc, char **argv)
output_file (NULL, NULL, NULL, inname, &instat,
mode, backup);
}
- else
- output_file (outname, NULL, &tmpoutst, NULL, NULL,
- file_type | 0, backup);
+ else if (backup)
+ {
+ struct stat outstat;
+
+ if (stat_file (outname, &outstat) != 0)
+ say ("Cannot stat file %s, skipping backup\n", outname);
+ else
+ output_file (outname, NULL, &outstat, NULL, NULL,
+ file_type | 0, true);
+ }
}
}
}

BIN
patch-2.7.6.tar.xz (Stored with Git LFS)

Binary file not shown.

View File

@@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJaed0dAAoJENW/n+sDE2U62ScQAK02GcPxJccBefkcuC6q/or9
f1im2lIpc1YJqxHmmhDeRu9twjuFycUV55hud+OroJe2xYKZrI6oUwJBldKTRfHu
whlhRzERO3U4z9pvi8XWbKvObsmqSBIgsM72oby4aPLCWk7IpJprR6BnRZdtnBg1
jzM3Yka8k01+dmVH2rsoSEGAe9sZbXJazBoYg8N/wHKe2+NY4W3esZ7flxQJ9RvB
GxjVU/KbyoNXIoFU4EnMalcLTZTHThhv2kQ1/cQZ+gt/1+f00DoieaUaIg3qB8jX
IqYE4GvXILgx8+REE3utt0zKv7pYGBNRkuACUE2hLZoY4SporJ0J63/7Y8zrzjxQ
GE27+DcjxBQGd1GnpO/Xb4kpqBGyn4KrlBIiHkhk2GgyBewpXPMog3cJki7A/1vz
Qb+JTY8PBqvOe7DmxW4Bp1vX6eOKn14FDQ7q3ZPjAd52Jtn7GUEt4etCduQh7ZNt
ElLLvpPro1wxG1bTbA3+TysCd+9XWWjwKJlPK5Jbdii0R73iy386UZGN1t1kmBzS
1mn3nh82z/XO9lPU3e1WP0BANAzTrNqA66ZbfQ9fIu6UO8R/+ygT7U5yie+X3xwP
kM6HR6oD0eDkqbPbOr8hey0kPG3FAWkZ47Oju5ad1ntUBFj4buLybEY0e08hncJS
gdt7wrbeKKxzdrcyQ1qy
=mjHo
-----END PGP SIGNATURE-----