Repository navigation
find: fix day selection with -daystart - #942
zhangpan2001 wants to merge 1 commit into
Conversation
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #942 +/- ##
==========================================
+ Coverage 92.44% 92.49% +0.04%
==========================================
Files 38 38
Lines 8896 8952 +56
Branches 440 442 +2
==========================================
+ Hits 8224 8280 +56
Misses 532 532
Partials 140 140 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
thanks for the PR! |
I added the extra second to match GNU find's behavior around midnight. Here is a minimal example with GNU find 4.11.0: export TZ=UTC0 LC_ALL=C
d=$(mktemp -d)
M=$(date -d 'today 00:00:00' +%s)
touch -d "@$((M-1))" "$d/age_1s"
touch -d "@$((M-1)).5" "$d/age_0_5s"
/usr/bin/find "$d" -type f -daystart -mtime -1 -printf '%f\n'
# Output:
# age_0_5sThe file exactly one second before midnight does not match. The file half a second before midnight matches. The find in this branch gives the same output. With I also checked And the GNU and bfs testsuites show no regressions. |
|
sorry but it needs to be rebased |
|
last ping |
| } | ||
| }; | ||
|
|
||
| if self.today_start { |
There was a problem hiding this comment.
could you please run the GNU and bfs testsuites on this?
git clone https://git.savannah.gnu.org/git/findutils.git ../findutils.gnu
bash util/build-gnu.sh
bash util/build-bfs.sh
There was a problem hiding this comment.
yep, I ran both and found no regressions.
553574c to
1647b65
Compare
done. |
|
Commit 1647b65 has test result changes: GNU findutils testsuite: |
1 similar comment
|
Commit 1647b65 has test result changes: GNU findutils testsuite: |
1647b65 to
5ffa6d6
Compare
|
Commit 5ffa6d6 has test result changes: GNU findutils testsuite: |
-daystart -mtime 1 selected files from two days ago: truncating the age measured from today's midnight counted both today's and yesterday's files as zero days old. Compare signed ages with GNU find's day ranges, keeping its separate boundaries for n, +n and -n. Use i128 so large day arguments cannot overflow. Add matcher tests for the day ranges and fractional-second boundaries, plus an expression test for -mtime, -atime and the position of -daystart. Cross-checked against GNU find with 108 paired comparisons.
5ffa6d6 to
9858c40
Compare
-daystart -mtime 1selected files from two days ago: truncating the age measured from today's midnight counted both today's and yesterday's files as zero days old.Compare signed ages with GNU find's day ranges, keeping its separate boundaries for
n,+nand-n. Usei128so large day arguments cannot overflow.Add matcher tests for the day ranges and fractional-second boundaries, plus an expression test for
-mtime,-atimeand the position of-daystart. Cross-checked against GNU find with 108 paired comparisons.