1 |
cardoe 13/08/02 13:25:34 |
2 |
|
3 |
Added: |
4 |
patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch |
5 |
patch-2.7.1-Fix-removing-empty-directories.patch |
6 |
patch-2.7.1-Fix-removing-empty-directories-automake.patch |
7 |
Log: |
8 |
Fixes to prevent leaving empty directories around when the wrong patch level is used or if --dry-run is specified. bug #478548 |
9 |
|
10 |
(Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key D7DFA8D318FA9AEF!) |
11 |
|
12 |
Revision Changes Path |
13 |
1.1 sys-devel/patch/files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch |
14 |
|
15 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/patch/files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch?rev=1.1&view=markup |
16 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/patch/files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch?rev=1.1&content-type=text/plain |
17 |
|
18 |
Index: patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch |
19 |
=================================================================== |
20 |
From afdfa9ec8e5f9acea4afaa0db758a4ed752dbe65 Mon Sep 17 00:00:00 2001 |
21 |
From: Andreas Gruenbacher <agruen@××××××.com> |
22 |
Date: Tue, 30 Jul 2013 10:46:19 +0000 |
23 |
Subject: In dry-run mode, create temporary files in a temporary directory |
24 |
|
25 |
* src/util.c (make_tempfile): Do not create temporary files in the final output |
26 |
directory when in dry-run mode: the path may be read-only. In addition, we do |
27 |
not want to leave intermediary empty output directories around. |
28 |
--- |
29 |
diff --git a/src/util.c b/src/util.c |
30 |
index 1cc1a68..0af6013 100644 |
31 |
--- a/src/util.c |
32 |
+++ b/src/util.c |
33 |
@@ -1599,7 +1599,7 @@ make_tempfile (char const **name, char letter, char const *real_name, |
34 |
int try_makedirs_errno = ENOENT; |
35 |
char *template; |
36 |
|
37 |
- if (real_name) |
38 |
+ if (real_name && ! dry_run) |
39 |
{ |
40 |
char *dirname, *basename; |
41 |
|
42 |
-- |
43 |
cgit v0.9.0.2 |
44 |
|
45 |
|
46 |
|
47 |
1.1 sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories.patch |
48 |
|
49 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories.patch?rev=1.1&view=markup |
50 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories.patch?rev=1.1&content-type=text/plain |
51 |
|
52 |
Index: patch-2.7.1-Fix-removing-empty-directories.patch |
53 |
=================================================================== |
54 |
From 2f40ef66bea54be23a24f616cde021d8d7fc25be Mon Sep 17 00:00:00 2001 |
55 |
From: Andreas Gruenbacher <agruen@××××××.com> |
56 |
Date: Sun, 10 Mar 2013 18:02:54 +0000 |
57 |
Subject: Fix removing empty directories |
58 |
|
59 |
Reported by Thomas Moschny <thomas.moschny@×××.de>: |
60 |
src/patch.c (main): Temporary output files are created in the same directory as |
61 |
the output file. Make sure to remove them before removing empty files and |
62 |
their empty ancestor directories; else the directories won't be empty. |
63 |
tests/remove-directories: Add directory removal test case. |
64 |
tests/Makefile.am (TESTS): Add new test case. |
65 |
--- |
66 |
diff --git a/src/patch.c b/src/patch.c |
67 |
index 0255fbb..010c14a 100644 |
68 |
--- a/src/patch.c |
69 |
+++ b/src/patch.c |
70 |
@@ -646,8 +646,8 @@ main (int argc, char **argv) |
71 |
if (outstate.ofp && (ferror (outstate.ofp) || fclose (outstate.ofp) != 0)) |
72 |
write_fatal (); |
73 |
output_files (NULL); |
74 |
- delete_files (); |
75 |
cleanup (); |
76 |
+ delete_files (); |
77 |
if (somefailed) |
78 |
exit (1); |
79 |
return 0; |
80 |
diff --git a/tests/Makefile.am b/tests/Makefile.am |
81 |
index 5cea52d..cfc4f37 100644 |
82 |
--- a/tests/Makefile.am |
83 |
+++ b/tests/Makefile.am |
84 |
@@ -50,6 +50,7 @@ TESTS = \ |
85 |
reject-format \ |
86 |
remember-backup-files \ |
87 |
remember-reject-files \ |
88 |
+ remove-directories \ |
89 |
symlinks \ |
90 |
unmodified-files |
91 |
|
92 |
diff --git a/tests/remove-directories b/tests/remove-directories |
93 |
new file mode 100644 |
94 |
index 0000000..6acdc49 |
95 |
--- a/dev/null |
96 |
+++ b/tests/remove-directories |
97 |
@@ -0,0 +1,29 @@ |
98 |
+# Copyright (C) 2013 Free Software Foundation, Inc. |
99 |
+# |
100 |
+# Copying and distribution of this file, with or without modification, |
101 |
+# in any medium, are permitted without royalty provided the copyright |
102 |
+# notice and this notice are preserved. |
103 |
+ |
104 |
+. $srcdir/test-lib.sh |
105 |
+ |
106 |
+require_cat |
107 |
+use_local_patch |
108 |
+use_tmpdir |
109 |
+ |
110 |
+# ============================================================== |
111 |
+# Remove empty parent diectories when removing a file |
112 |
+ |
113 |
+mkdir dir |
114 |
+echo foobar > dir/file |
115 |
+cat > apatch <<EOF |
116 |
+--- dir/file |
117 |
++++ /dev/null |
118 |
+@@ -1 +0,0 @@ |
119 |
+-foobar |
120 |
+EOF |
121 |
+ |
122 |
+check 'patch -p0 -E < apatch' <<EOF |
123 |
+patching file dir/file |
124 |
+EOF |
125 |
+ |
126 |
+ncheck '! test -e dir' |
127 |
-- |
128 |
cgit v0.9.0.2 |
129 |
|
130 |
|
131 |
|
132 |
1.1 sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories-automake.patch |
133 |
|
134 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories-automake.patch?rev=1.1&view=markup |
135 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories-automake.patch?rev=1.1&content-type=text/plain |
136 |
|
137 |
Index: patch-2.7.1-Fix-removing-empty-directories-automake.patch |
138 |
=================================================================== |
139 |
Simple patch to prevent sys-devel/patch needing to depend on autotools to |
140 |
be built, which would likely make stage1 people unhappy. |
141 |
|
142 |
By: Doug Goldstein <cardoe@g.o> |
143 |
Ref: bug #478548 |
144 |
--- |
145 |
--- a/tests/Makefile.in 2012-09-28 11:41:32.000000000 -0500 |
146 |
+++ b/tests/Makefile.in 2013-07-31 07:55:44.879904245 -0500 |
147 |
@@ -1104,6 +1104,7 @@ |
148 |
reject-format \ |
149 |
remember-backup-files \ |
150 |
remember-reject-files \ |
151 |
+ remove-directories \ |
152 |
symlinks \ |
153 |
unmodified-files |
154 |
|
155 |
@@ -1352,6 +1353,8 @@ |
156 |
@p='remember-backup-files'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) |
157 |
remember-reject-files.log: remember-reject-files |
158 |
@p='remember-reject-files'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) |
159 |
+remove-directories.log: remove-directories |
160 |
+ @p='remove-directories'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) |
161 |
symlinks.log: symlinks |
162 |
@p='symlinks'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) |
163 |
unmodified-files.log: unmodified-files |