diff options
Diffstat (limited to 'meta/recipes-extended/findutils/findutils-4.4.2/02-28824.patch')
-rw-r--r-- | meta/recipes-extended/findutils/findutils-4.4.2/02-28824.patch | 294 |
1 files changed, 294 insertions, 0 deletions
diff --git a/meta/recipes-extended/findutils/findutils-4.4.2/02-28824.patch b/meta/recipes-extended/findutils/findutils-4.4.2/02-28824.patch new file mode 100644 index 0000000000..c0ff3ff1c0 --- /dev/null +++ b/meta/recipes-extended/findutils/findutils-4.4.2/02-28824.patch | |||
@@ -0,0 +1,294 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | commit 76ed377d6d3e4a83a00cabd401f751b37ecd1e7b | ||
4 | Author: James Youngman <jay@gnu.org> | ||
5 | Date: Sat Feb 20 13:11:45 2010 +0000 | ||
6 | |||
7 | Fix Savannah bug# 28824: "-ctime x" yields "missing argument to `-ctime'". | ||
8 | |||
9 | * find/parser.c (parse_fls): If the argument is invalid, reverse | ||
10 | the change that collect_arg() made to *arg_ptr (that is, don't | ||
11 | consume the argument). | ||
12 | (parse_fprint0): Likewise. | ||
13 | (parse_gid): Likewise. | ||
14 | (parse_group): Likewise. | ||
15 | (parse_inum): Likewise. | ||
16 | (parse_links): Likewise. | ||
17 | (do_parse_xmin): Likewise. | ||
18 | (parse_name): Likewise. | ||
19 | (parse_printf): Likewise. | ||
20 | (parse_uid): Likewise. | ||
21 | (parse_used): Likewise. | ||
22 | (parse_time): Likewise. | ||
23 | |||
24 | Signed-off-by: James Youngman <jay@gnu.org> | ||
25 | |||
26 | diff --git a/ChangeLog b/ChangeLog | ||
27 | index d0ce1fe..13539a4 100644 | ||
28 | --- a/ChangeLog | ||
29 | +++ b/ChangeLog | ||
30 | @@ -1,0 +1,19 @@ | ||
31 | +2010-02-20 James Youngman <jay@gnu.org> | ||
32 | + | ||
33 | + Fix Savannah bug# 28824: "-ctime x" yields "missing argument to | ||
34 | + `-ctime'". | ||
35 | + * find/parser.c (parse_fls): If the argument is invalid, reverse | ||
36 | + the change that collect_arg() made to *arg_ptr (that is, don't | ||
37 | + consume the argument). | ||
38 | + (parse_fprint0): Likewise. | ||
39 | + (parse_gid): Likewise. | ||
40 | + (parse_group): Likewise. | ||
41 | + (parse_inum): Likewise. | ||
42 | + (parse_links): Likewise. | ||
43 | + (do_parse_xmin): Likewise. | ||
44 | + (parse_name): Likewise. | ||
45 | + (parse_printf): Likewise. | ||
46 | + (parse_uid): Likewise. | ||
47 | + (parse_used): Likewise. | ||
48 | + (parse_time): Likewise. | ||
49 | + | ||
50 | diff --git a/NEWS b/NEWS | ||
51 | index 5394311..4e910df 100644 | ||
52 | --- a/NEWS | ||
53 | +++ b/NEWS | ||
54 | @@ -4,5 +4,8 @@ GNU findutils NEWS - User visible changes. -*- outline -*- (allout) | ||
55 | |||
56 | ** Bug Fixes | ||
57 | |||
58 | +#28824: Corrected error message for "-ctime x". | ||
59 | + Likewise for -gid, -inum, -links, -mmin, -cmin, -amin, | ||
60 | + -uid, -used, -atime, -mtime, -ctime. | ||
61 | #26537: find -prune now makes sure it has valid stat() information. | ||
62 | |||
63 | diff --git a/find/parser.c b/find/parser.c | ||
64 | index 2e6b989..08758ee 100644 | ||
65 | --- a/find/parser.c | ||
66 | +++ b/find/parser.c | ||
67 | @@ -886,8 +886,14 @@ static boolean | ||
68 | parse_fls (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
69 | { | ||
70 | const char *filename; | ||
71 | - return collect_arg(argv, arg_ptr, &filename) | ||
72 | - && insert_fls(entry, filename); | ||
73 | + if (collect_arg(argv, arg_ptr, &filename)) | ||
74 | + { | ||
75 | + if (insert_fls(entry, filename)) | ||
76 | + return true; | ||
77 | + else | ||
78 | + --*arg_ptr; /* don't consume the invalid arg. */ | ||
79 | + } | ||
80 | + return false; | ||
81 | } | ||
82 | |||
83 | static boolean | ||
84 | @@ -937,9 +943,13 @@ parse_fprint0 (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
85 | { | ||
86 | const char *filename; | ||
87 | if (collect_arg(argv, arg_ptr, &filename)) | ||
88 | - return insert_fprint(entry, filename); | ||
89 | - else | ||
90 | - return false; | ||
91 | + { | ||
92 | + if (insert_fprint(entry, filename)) | ||
93 | + return true; | ||
94 | + else | ||
95 | + --*arg_ptr; /* don't consume the bad arg. */ | ||
96 | + } | ||
97 | + return false; | ||
98 | } | ||
99 | |||
100 | static float estimate_fstype_success_rate(const char *fsname) | ||
101 | @@ -993,6 +1003,7 @@ parse_gid (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | + --*arg_ptr; /* don't consume the invalid argument. */ | ||
106 | return false; | ||
107 | } | ||
108 | } | ||
109 | @@ -1049,6 +1060,7 @@ static boolean | ||
110 | parse_group (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
111 | { | ||
112 | const char *groupname; | ||
113 | + const int saved_argc = *arg_ptr; | ||
114 | |||
115 | if (collect_arg(argv, arg_ptr, &groupname)) | ||
116 | { | ||
117 | @@ -1077,6 +1089,7 @@ parse_group (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
118 | "because it has the unexpected suffix %s"), | ||
119 | quotearg_n_style(0, options.err_quoting_style, groupname), | ||
120 | quotearg_n_style(1, options.err_quoting_style, groupname+gid_len)); | ||
121 | + *arg_ptr = saved_argc; /* don't consume the invalid argument. */ | ||
122 | return false; | ||
123 | } | ||
124 | } | ||
125 | @@ -1092,6 +1105,7 @@ parse_group (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
126 | { | ||
127 | error(1, 0, _("argument to -group is empty, but should be a group name")); | ||
128 | } | ||
129 | + *arg_ptr = saved_argc; /* don't consume the invalid argument. */ | ||
130 | return false; | ||
131 | } | ||
132 | } | ||
133 | @@ -1256,6 +1270,7 @@ parse_inum (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | + --*arg_ptr; /* don't consume the invalid argument. */ | ||
138 | return false; | ||
139 | } | ||
140 | } | ||
141 | @@ -1310,6 +1325,7 @@ parse_links (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | + --*arg_ptr; /* don't consume the invalid argument. */ | ||
146 | return false; | ||
147 | } | ||
148 | } | ||
149 | @@ -1358,6 +1374,7 @@ insert_depthspec(const struct parser_table* entry, char **argv, int *arg_ptr, | ||
150 | error(1, 0, _("Expected a positive decimal integer argument to %s, but got %s"), | ||
151 | predicate, | ||
152 | quotearg_n_style(0, options.err_quoting_style, depthstr)); | ||
153 | + /* NOTREACHED */ | ||
154 | return false; | ||
155 | } | ||
156 | /* missing argument */ | ||
157 | @@ -1385,6 +1402,7 @@ do_parse_xmin (const struct parser_table* entry, | ||
158 | enum xval xv) | ||
159 | { | ||
160 | const char *minutes; | ||
161 | + const int saved_argc = *arg_ptr; | ||
162 | |||
163 | if (collect_arg(argv, arg_ptr, &minutes)) | ||
164 | { | ||
165 | @@ -1401,6 +1419,11 @@ do_parse_xmin (const struct parser_table* entry, | ||
166 | our_pred->est_success_rate = estimate_timestamp_success_rate(tval.ts.tv_sec); | ||
167 | return true; | ||
168 | } | ||
169 | + else | ||
170 | + { | ||
171 | + /* Don't consume the invalid argument. */ | ||
172 | + *arg_ptr = saved_argc; | ||
173 | + } | ||
174 | } | ||
175 | return false; | ||
176 | } | ||
177 | @@ -1427,6 +1450,8 @@ static boolean | ||
178 | parse_name (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
179 | { | ||
180 | const char *name; | ||
181 | + const int saved_argc = *arg_ptr; | ||
182 | + | ||
183 | if (collect_arg(argv, arg_ptr, &name)) | ||
184 | { | ||
185 | fnmatch_sanitycheck(); | ||
186 | @@ -1438,6 +1463,10 @@ parse_name (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
187 | our_pred->est_success_rate = estimate_pattern_match_rate(name, 0); | ||
188 | return true; | ||
189 | } | ||
190 | + else | ||
191 | + { | ||
192 | + *arg_ptr = saved_argc; /* don't consume the invalid argument. */ | ||
193 | + } | ||
194 | } | ||
195 | return false; | ||
196 | } | ||
197 | @@ -1954,11 +1983,21 @@ static boolean | ||
198 | parse_printf (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
199 | { | ||
200 | const char *format; | ||
201 | + const int saved_argc = *arg_ptr; | ||
202 | + | ||
203 | if (collect_arg(argv, arg_ptr, &format)) | ||
204 | { | ||
205 | struct format_val fmt; | ||
206 | open_stdout(&fmt); | ||
207 | - return insert_fprintf (&fmt, entry, pred_fprintf, format); | ||
208 | + if (insert_fprintf (&fmt, entry, pred_fprintf, format)) | ||
209 | + { | ||
210 | + return true; | ||
211 | + } | ||
212 | + else | ||
213 | + { | ||
214 | + *arg_ptr = saved_argc; /* don't consume the invalid argument. */ | ||
215 | + return false; | ||
216 | + } | ||
217 | } | ||
218 | return false; | ||
219 | } | ||
220 | @@ -1967,15 +2006,21 @@ static boolean | ||
221 | parse_fprintf (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
222 | { | ||
223 | const char *format, *filename; | ||
224 | + int saved_argc = *arg_ptr; | ||
225 | + | ||
226 | if (collect_arg(argv, arg_ptr, &filename)) | ||
227 | { | ||
228 | if (collect_arg(argv, arg_ptr, &format)) | ||
229 | { | ||
230 | struct format_val fmt; | ||
231 | open_output_file (filename, &fmt); | ||
232 | - return insert_fprintf (&fmt, entry, pred_fprintf, format); | ||
233 | + saved_argc = *arg_ptr; | ||
234 | + | ||
235 | + if (insert_fprintf (&fmt, entry, pred_fprintf, format)) | ||
236 | + return true; | ||
237 | } | ||
238 | } | ||
239 | + *arg_ptr = saved_argc; /* don't consume the invalid argument. */ | ||
240 | return false; | ||
241 | } | ||
242 | |||
243 | @@ -2405,6 +2450,7 @@ parse_uid (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
244 | } | ||
245 | else | ||
246 | { | ||
247 | + --*arg_ptr; /* don't consume the invalid argument. */ | ||
248 | return false; | ||
249 | } | ||
250 | } | ||
251 | @@ -2431,6 +2477,7 @@ parse_used (const struct parser_table* entry, char **argv, int *arg_ptr) | ||
252 | else | ||
253 | { | ||
254 | error(1, 0, _("Invalid argument %s to -used"), offset_str); | ||
255 | + /*NOTREACHED*/ | ||
256 | return false; | ||
257 | } | ||
258 | } | ||
259 | @@ -2610,6 +2657,7 @@ insert_type (char **argv, int *arg_ptr, | ||
260 | if (strlen(typeletter) != 1u) | ||
261 | { | ||
262 | error(1, 0, _("Arguments to -type should contain only one letter")); | ||
263 | + /*NOTREACHED*/ | ||
264 | return false; | ||
265 | } | ||
266 | |||
267 | @@ -2657,6 +2705,7 @@ insert_type (char **argv, int *arg_ptr, | ||
268 | #endif | ||
269 | default: /* None of the above ... nuke 'em. */ | ||
270 | error(1, 0, _("Unknown argument to -type: %c"), (*typeletter)); | ||
271 | + /*NOTREACHED*/ | ||
272 | return false; | ||
273 | } | ||
274 | our_pred = insert_primary_withpred (entry, which_pred, typeletter); | ||
275 | @@ -3349,6 +3398,7 @@ parse_time (const struct parser_table* entry, char *argv[], int *arg_ptr) | ||
276 | const char *errmsg = "arithmetic overflow while converting %s " | ||
277 | "days to a number of seconds"; | ||
278 | struct timespec origin; | ||
279 | + const int saved_argc = *arg_ptr; | ||
280 | |||
281 | if (!collect_arg(argv, arg_ptr, &timearg)) | ||
282 | return false; | ||
283 | @@ -3381,7 +3431,10 @@ parse_time (const struct parser_table* entry, char *argv[], int *arg_ptr) | ||
284 | timearg = orig_timearg; | ||
285 | |||
286 | if (!get_relative_timestamp(timearg, &tval, origin, DAYSECS, errmsg)) | ||
287 | - return false; | ||
288 | + { | ||
289 | + *arg_ptr = saved_argc; /* don't consume the invalid argument */ | ||
290 | + return false; | ||
291 | + } | ||
292 | |||
293 | our_pred = insert_primary (entry, orig_timearg); | ||
294 | our_pred->args.reftime = tval; | ||