findutils icon indicating copy to clipboard operation
findutils copied to clipboard

Implement support for following symlinks

Open refi64 opened this issue 4 years ago • 6 comments

Signed-off-by: Ryan Gonzalez [email protected]


Unfortunately, it wasn't possible to make work as needed without these two PRs to walkdir: https://github.com/BurntSushi/walkdir/pull/159 https://github.com/BurntSushi/walkdir/pull/160

However, it seems that PRs to walkdir have been stagnant since late 2020 / early 2021, so for the purpose of testing, I created a single branch on my fork with both PRs merged in, and Cargo.toml in here is pointing to that branch. I'm not quite sure how to handle this as a result, so this is in draft status. Any thoughts on how to handle this?

refi64 avatar Jan 22 '22 00:01 refi64

Codecov Report

Merging #131 (9492b36) into main (1517cc0) will decrease coverage by 1.96%. The diff coverage is 93.75%.

:exclamation: Current head 9492b36 differs from pull request most recent head 29e5f52. Consider uploading reports for the commit 29e5f52 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
- Coverage   52.52%   50.56%   -1.97%     
==========================================
  Files          23       19       -4     
  Lines        4655     2589    -2066     
  Branches     1531      688     -843     
==========================================
- Hits         2445     1309    -1136     
+ Misses       1664     1039     -625     
+ Partials      546      241     -305     
Impacted Files Coverage Δ
src/find/mod.rs 62.76% <85.71%> (+1.40%) :arrow_up:
src/find/matchers/printf.rs 67.49% <88.88%> (-0.22%) :arrow_down:
tests/find_cmd_tests.rs 93.67% <100.00%> (+15.60%) :arrow_up:
src/lib.rs 25.70% <0.00%> (-10.17%) :arrow_down:
src/testing/commandline/main.rs 70.27% <0.00%> (-1.16%) :arrow_down:
tests/xargs_tests.rs
src/xargs/main.rs
src/xargs/mod.rs
src/find/matchers/regex.rs
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1517cc0...29e5f52. Read the comment docs.

codecov[bot] avatar Jan 22 '22 01:01 codecov[bot]

Clap clap:


Warning: Congrats! The bfs test test_L is now passing!
Warning: Congrats! The bfs test test_L_depth is now passing!
Warning: Congrats! The bfs test test_L_type_l is now passing!
Warning: Congrats! The bfs test test_flag_comma is now passing!
Warning: Congrats! The bfs test test_flag_weird_names is now passing!
Warning: Congrats! The bfs test test_type_l is now passing!

sylvestre avatar Jan 22 '22 15:01 sylvestre

Ah nice! This seems to affect quite a few tests. Any ideas for how to handle the walkdir issue, though?

refi64 avatar Jan 24 '22 15:01 refi64

The initial release of findutils was pinned to a specific version in my branch of walkdir, while I waited for https://github.com/BurntSushi/walkdir/pull/19 to be accepted and included in a release.

So it's not without precedent.

Long term, I'd suggest giving it a few months and then making our own branch if the PRs keep piling up there untouched?

Mark

On Mon, Jan 24, 2022 at 3:04 PM Ryan Gonzalez @.***> wrote:

Ah nice! This seems to affect quite a few tests. Any ideas for how to handle the walkdir issue, though?

— Reply to this email directly, view it on GitHub https://github.com/uutils/findutils/pull/131#issuecomment-1020194768, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3MQF34BO2IMWYGHUX2HT3UXVTAZANCNFSM5MQ65VVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

mcharsley avatar Jan 24 '22 15:01 mcharsley

It is possible to work around https://github.com/BurntSushi/walkdir/pull/160 the same way fd does it: https://github.com/sharkdp/fd/blob/9f5ed8534e824b3e2a0934ff3aa0b781cb370688/src/walk.rs#L490-L503. But it would be nice if walkdir would do it itself.

tavianator avatar Jan 30 '22 03:01 tavianator

@tavianator I was originally going to try using a similar system here, but there were 2 things that made me go with the walkdir patches instead:

  • walkdir patches are needed anyway so that find a-symlink will not traverse into it without -L. The alternative would be to manually check if it's a symlink ourselves first but...
  • ...findutils does seem to use more platform-specific DirEntry functionality that fd does, so re-implementing a custom DirEntry wrapper would be a decent bit messier, at least from my initial investigations

That being said, if the walkdir PR stays stagnant for too long, it may be worth switching over.

refi64 avatar Jan 31 '22 21:01 refi64