Commit b9346ec
authored
grep -r should not sort directory entries
* A directory might have 1000s of entries and sorting would make grep -r slower (there is no standard option to toggle sort behaviour)
* Be consistent with OpenBSD and GNU versions by processing directory entries in the order they appear
* As part of verification, I compared output of grep -r on OpenBSD (filenames not sorted) with output of "ls -1a" (filenames sorted)
* Clarification: list-list is only for setting up argument list for recursive matchfile() call. Declare it within if-block scope to avoid potential of old entries appearing between loop iterations.1 parent 04d90b4 commit b9346ec
1 file changed
+3
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
407 | 406 | | |
408 | 407 | | |
409 | 408 | | |
| |||
0 commit comments