-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use scandir() in find_commands.py to avoid stat() calls #13070
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a regression in 23.7.x this should be targetting the 23.7.x branch and not main
Otherwise this seems okay
if m and isfile(join(dir_path, fn)): | ||
for entry in os.scandir(dir_path): | ||
m = pat.match(entry.name) | ||
if m and entry.is_file(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this follow symlinks (the default)? Otherwise:
if m and entry.is_file(): | |
if m and entry.is_file(follow_symlinks=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.path.isfile()
follows symlinks. IMO you would expect to be able to symlink a conda-* command into PATH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
@jezdez what if we target main and cherry-pick the fix into the release branch? |
we can, I think it makes more sense (git graph wise) to target the release branch and then merge this back into |
We usually do forward ports not backports for release regressions, that's why we have the release branches. Since we can't push to branches directly, cherry-picking doesn't much make it a shortcut. You'd have to open another PR to apply the cherry-picked commit to the release branch. In the forward port scenario, we can do multiple regression fixes in one PR to merge back into main, saving a little time. |
FYI the main branch has a pre-existing community contributed fix for this regression. #13035 |
superseded by 23.7.4 and #13094 |
Description
This function was especially slow on WSL. In addition to the previous fix, use
scandir()
which should grab theis_file
attribute without a separate syscall in most cases.Fixes #13067
See also #13071 which is backported to the 23.7.x branch.
Checklist - did you ...
news
directory (using the template) for the next release's release notes?