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