| Anonymous | Login | Signup for a new account | 11-10-2008 11:10 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0001178 | [BusyBox] Standards Compliance | major | always | 01-26-07 00:04 | 01-26-07 15:00 | ||||
| Reporter | rockeychu | View Status | public | ||||||
| Assigned To | BusyBox | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | svn | ||||||
| Summary | 0001178: 'find' does not act as it is (with patch) | ||||||||
| Description |
When with any options of '-mtime', '-mmin', '-inum', 'perm' or '-newer', find does not act it might be, it just gives oppsite results. It also can't process (+N) or (-N) correctly. Patch as following (also with a attachment): Index: findutils/find.c =================================================================== --- findutils/find.c (revision 17534) +++ findutils/find.c (working copy) @@ -147,7 +147,7 @@ #if ENABLE_FEATURE_FIND_PERM ACTF(perm) { - return !((isdigit(ap->perm_char) && (statbuf->st_mode & 07777) == ap->perm_mask) + return ((isdigit(ap->perm_char) && (statbuf->st_mode & 07777) == ap->perm_mask) || (ap->perm_char == '-' && (statbuf->st_mode & ap->perm_mask) == ap->perm_mask) || (ap->perm_char == '+' && (statbuf->st_mode & ap->perm_mask) != 0)); } @@ -157,7 +157,7 @@ { time_t file_age = time(NULL) - statbuf->st_mtime; time_t mtime_secs = ap->mtime_days * 24 * 60 * 60; - return !((isdigit(ap->mtime_char) && file_age >= mtime_secs + return ((isdigit(ap->mtime_char) && file_age >= mtime_secs && file_age < mtime_secs + 24 * 60 * 60) || (ap->mtime_char == '+' && file_age >= mtime_secs + 24 * 60 * 60) || (ap->mtime_char == '-' && file_age < mtime_secs)); @@ -168,7 +168,7 @@ { time_t file_age = time(NULL) - statbuf->st_mtime; time_t mmin_secs = ap->mmin_mins * 60; - return !((isdigit(ap->mmin_char) && file_age >= mmin_secs + return ((isdigit(ap->mmin_char) && file_age >= mmin_secs && file_age < mmin_secs + 60) || (ap->mmin_char == '+' && file_age >= mmin_secs + 60) || (ap->mmin_char == '-' && file_age < mmin_secs)); @@ -177,13 +177,13 @@ #if ENABLE_FEATURE_FIND_NEWER ACTF(newer) { - return (ap->newer_mtime >= statbuf->st_mtime); + return (ap->newer_mtime < statbuf->st_mtime); } #endif #if ENABLE_FEATURE_FIND_INUM ACTF(inum) { - return (statbuf->st_ino != ap->inode_num); + return (statbuf->st_ino == ap->inode_num); } #endif #if ENABLE_FEATURE_FIND_EXEC @@ -391,10 +391,11 @@ if (!*++argv) bb_error_msg_and_die(bb_msg_requires_arg, arg); ap = ALLOC_ACTION(perm); - ap->perm_mask = xstrtol_range(arg1, 8, 0, 07777); ap->perm_char = arg1[0]; - if (ap->perm_char == '-') - ap->perm_mask = -ap->perm_mask; + ap->perm_mask = xstrtol_range(isdigit(ap->perm_char)? arg1 : arg1 + 1, 8, 0, 07777); + //ap->perm_mask = xstrtol_range((ap->perm_char == '-' || ap->perm_char == '+')? arg1 + 1: arg1, 8, 0, 07777); + //if (ap->perm_char == '-') + // ap->perm_mask = -ap->perm_mask; } #endif #if ENABLE_FEATURE_FIND_MTIME @@ -403,10 +404,11 @@ if (!*++argv) bb_error_msg_and_die(bb_msg_requires_arg, arg); ap = ALLOC_ACTION(mtime); - ap->mtime_days = xatol(arg1); ap->mtime_char = arg1[0]; - if (ap->mtime_char == '-') - ap->mtime_days = -ap->mtime_days; + ap->mtime_days = xatol(isdigit(ap->mtime_char)? arg1 : arg1 + 1); + //ap->mtime_days = xatol((ap->mtime_char == '-' || ap->mtime_char == '+')? arg1 + 1 : arg1); + //if (ap->mtime_char == '-') + // ap->mtime_days = -ap->mtime_days; } #endif #if ENABLE_FEATURE_FIND_MMIN @@ -415,10 +417,11 @@ if (!*++argv) bb_error_msg_and_die(bb_msg_requires_arg, arg); ap = ALLOC_ACTION(mmin); - ap->mmin_mins = xatol(arg1); ap->mmin_char = arg1[0]; - if (ap->mmin_char == '-') - ap->mmin_mins = -ap->mmin_mins; + ap->mmin_mins = xatol(isdigit(ap->mmin_char)? arg1 : arg1 + 1); + //ap->mmin_mins = xatol((ap->mmin_char == '-' || ap->mmin_char == '+')? arg1 + 1 : arg1); + //if (ap->mmin_char == '-') + // ap->mmin_mins = -ap->mmin_mins; } #endif #if ENABLE_FEATURE_FIND_NEWER |
||||||||
| Additional Information | |||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
| Copyright © 2000 - 2006 Mantis Group |