]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - pkgs/tar/patches/tar-1.25-listedincremental.patch
Move packages to pkgs subdirectory.
[people/ms/ipfire-3.x.git] / pkgs / tar / patches / tar-1.25-listedincremental.patch
1 From 065cf0958c39600f2062cbeeb5b76929d03c207b Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@cs.ucla.edu>
3 Date: Mon, 22 Nov 2010 22:50:58 -0800
4 Subject: [PATCH] * src/names.c: tar: fix bug with --one-file-system --listed-incremental
5
6 Problem (and idea for fix) reported by Martin Weigel
7 <http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00071.html>.
8 * src/common.h (is_individual_file): Remove decl.
9 * src/create.c (dump_file0): Replace "is_individual_file (p)"
10 with "top_level".
11 * src/incremen.c (procdir): Replace "!is_individual_file
12 (name_buffer)" with "st->parent". Fix bug with --one-file-system
13 and --listed-incremental.
14 * src/names.c (individual_file_table, register_individual_file):
15 (is_individual_file): Remove. All uses removed.
16 ---
17 src/common.h | 1 -
18 src/create.c | 4 ++--
19 src/incremen.c | 8 ++------
20 src/names.c | 26 --------------------------
21 4 files changed, 4 insertions(+), 35 deletions(-)
22
23 diff --git a/src/common.h b/src/common.h
24 index 35e056e..9444fd7 100644
25 --- a/src/common.h
26 +++ b/src/common.h
27 @@ -680,7 +680,6 @@ bool excluded_name (char const *name);
28
29 void add_avoided_name (char const *name);
30 bool is_avoided_name (char const *name);
31 -bool is_individual_file (char const *name);
32
33 bool contains_dot_dot (char const *name);
34
35 diff --git a/src/create.c b/src/create.c
36 index a1e90a3..e8de6b9 100644
37 --- a/src/create.c
38 +++ b/src/create.c
39 @@ -1678,9 +1678,9 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
40 put in the archive.
41
42 This check is omitted if incremental_option is set *and* the
43 - requested file is not explicitely listed in the command line. */
44 + requested file is not explicitly listed in the command line. */
45
46 - if (!(incremental_option && !is_individual_file (p))
47 + if (! (incremental_option && ! top_level)
48 && !S_ISDIR (st->stat.st_mode)
49 && OLDER_TAR_STAT_TIME (*st, m)
50 && (!after_date_option || OLDER_TAR_STAT_TIME (*st, c)))
51 diff --git a/src/incremen.c b/src/incremen.c
52 index 628ff29..2b33c5d 100644
53 --- a/src/incremen.c
54 +++ b/src/incremen.c
55 @@ -426,7 +426,6 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
56 {
57 struct directory *directory;
58 struct stat *stat_data = &st->stat;
59 - dev_t device = st->parent ? st->parent->stat.st_dev : 0;
60 bool nfs = NFS_FILE_STAT (*stat_data);
61
62 if ((directory = find_directory (name_buffer)) != NULL)
63 @@ -540,11 +539,8 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
64 }
65 }
66
67 - /* If the directory is on another device and --one-file-system was given,
68 - omit it... */
69 - if (one_file_system_option && device != stat_data->st_dev
70 - /* ... except if it was explicitely given in the command line */
71 - && !is_individual_file (name_buffer))
72 + if (one_file_system_option && st->parent
73 + && stat_data->st_dev != st->parent->stat.st_dev)
74 /* FIXME:
75 WARNOPT (WARN_XDEV,
76 (0, 0,
77 diff --git a/src/names.c b/src/names.c
78 index 6e214bf..ba4d509 100644
79 --- a/src/names.c
80 +++ b/src/names.c
81 @@ -47,8 +47,6 @@ static char *cached_no_such_gname;
82 static uid_t cached_no_such_uid;
83 static gid_t cached_no_such_gid;
84
85 -static void register_individual_file (char const *name);
86 -
87 /* Given UID, find the corresponding UNAME. */
88 void
89 uid_to_uname (uid_t uid, char **uname)
90 @@ -360,8 +358,6 @@ name_next_elt (int change_dirs)
91 {
92 if (unquote_option)
93 unquote_string (name_buffer);
94 - if (incremental_option)
95 - register_individual_file (name_buffer);
96 entry.type = ep->type;
97 entry.v.name = name_buffer;
98 return &entry;
99 @@ -1152,28 +1148,6 @@ excluded_name (char const *name)
100 return excluded_file_name (excluded, name + FILE_SYSTEM_PREFIX_LEN (name));
101 }
102 \f
103 -static Hash_table *individual_file_table;
104 -
105 -static void
106 -register_individual_file (char const *name)
107 -{
108 - struct stat st;
109 -
110 - if (deref_stat (name, &st) != 0)
111 - return; /* Will be complained about later */
112 - if (S_ISDIR (st.st_mode))
113 - return;
114 -
115 - hash_string_insert (&individual_file_table, name);
116 -}
117 -
118 -bool
119 -is_individual_file (char const *name)
120 -{
121 - return hash_string_lookup (individual_file_table, name);
122 -}
123 -
124 -\f
125
126 /* Return the size of the prefix of FILE_NAME that is removed after
127 stripping NUM leading file name components. NUM must be
128 --
129 1.7.1
130
131 From: Paul Eggert <eggert@cs.ucla.edu>
132 Date: Tue, 23 Nov 2010 01:58:55 +0000 (-0800)
133 Subject: tests: new test listed04 for --one-file-system --listed-incremental
134 X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=tar.git;a=commitdiff_plain;h=2a55b4b0373eef2e879408f9df6638bb03e16170
135
136 tests: new test listed04 for --one-file-system --listed-incremental
137
138 * tests/Makefile.am (TESTSUITE_AT): Add listed04.at.
139 * tests/listed04.at: New file.
140 * tests/testsuite.at: Include it.
141 ---
142
143 diff --git a/tests/Makefile.am b/tests/Makefile.am
144 index f289067..7b1e226 100644
145 --- a/tests/Makefile.am
146 +++ b/tests/Makefile.am
147 @@ -110,6 +110,7 @@ TESTSUITE_AT = \
148 listed01.at\
149 listed02.at\
150 listed03.at\
151 + listed04.at\
152 long01.at\
153 longv7.at\
154 lustar01.at\
155 diff --git a/tests/listed04.at b/tests/listed04.at
156 new file mode 100644
157 index 0000000..239998d
158 --- /dev/null
159 +++ b/tests/listed04.at
160 @@ -0,0 +1,47 @@
161 +# Process this file with autom4te to create testsuite. -*- Autotest -*-
162 +
163 +# Test suite for GNU tar.
164 +# Copyright (C) 2010 Free Software Foundation, Inc.
165 +
166 +# This program is free software; you can redistribute it and/or modify
167 +# it under the terms of the GNU General Public License as published by
168 +# the Free Software Foundation; either version 3, or (at your option)
169 +# any later version.
170 +
171 +# This program is distributed in the hope that it will be useful,
172 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
173 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174 +# GNU General Public License for more details.
175 +
176 +# You should have received a copy of the GNU General Public License
177 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
178 +
179 +# This checks for the bug reported by Martin Weigel
180 +# <http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00071.html>.
181 +# The test is derived from the ideas in Jean-Louis Martineau's followup email
182 +# <http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00087.html>.
183 +
184 +AT_SETUP([--listed-incremental and --one-file-system])
185 +AT_KEYWORDS([listed incremental listed04])
186 +
187 +AT_TAR_CHECK([
188 +
189 +mkdir dir
190 +echo a >dir/a
191 +echo b >dir/b
192 +
193 +tar --one-file-system -cvf archive.tar -g archive.incr dir || exit
194 +tar -tf archive.tar || exit
195 +],
196 +[0],
197 +[dir/
198 +dir/a
199 +dir/b
200 +dir/
201 +dir/a
202 +dir/b
203 +],
204 +[tar: dir: Directory is new
205 +],[],[],[gnu])
206 +
207 +AT_CLEANUP
208 diff --git a/tests/testsuite.at b/tests/testsuite.at
209 index db0db3a..e8df868 100644
210 --- a/tests/testsuite.at
211 +++ b/tests/testsuite.at
212 @@ -174,6 +174,7 @@ m4_include([incr02.at])
213 m4_include([listed01.at])
214 m4_include([listed02.at])
215 m4_include([listed03.at])
216 +m4_include([listed04.at])
217 m4_include([incr03.at])
218 m4_include([incr04.at])
219 m4_include([incr05.at])