-
Notifications
You must be signed in to change notification settings - Fork 39
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
match_tree doesn't return the symlinks regardless of the followSymlinks parameter #31
Comments
I have a PR for this but I don't have access to this repo. Can you please give me access so I can create the PR? |
@cpburnz Caleb? |
@ftrofin You don't need direct access to create a pull request. Just fork the project, commit your changes there, then submit a pull request. I think you're right that it's a bug. In my experience most programs treat symlinks as regular files if they're not resolving the target. Git, in particular, I think treats symlinks as files regardless if they point to a file or folder. |
I tried that. I cloned (using https), created a branch named 'issue_31' and tried to push it back: |
@ftrofin Are you familiar with how to fork and make pull requests on Github? On Github you have to use the web interface to perform those actions, not directly using git. |
@ftrofin I've implemented this on the master branch. |
Thank you Caleb. Any idea when you're going to make a new release with the latest changes/fixes? |
@ftrofin I'll be able to get to it this coming weekend. |
v0.8.0 has been released which supports symlinks. |
118: Update pathspec to 0.8.0 r=rehandalal a=pyup-bot This PR updates [pathspec](https://pypi.org/project/pathspec) from **0.7.0** to **0.8.0**. <details> <summary>Changelog</summary> ### 0.8.0 ``` ------------------ - `Issue 30`_: Expose what patterns matched paths. Added `util.detailed_match_files()`. - `Issue 31`_: `match_tree()` doesn't return symlinks. - `Issue 34`_: Support `pathlib.Path`\ s. - Add `PathSpec.match_tree_entries` and `util.iter_tree_entries()` to support directories and symlinks. - API change: `match_tree()` has been renamed to `match_tree_files()`. The old name `match_tree()` is still available as an alias. - API change: `match_tree_files()` now returns symlinks. This is a bug fix but it will change the returned results. .. _`Issue 30`: cpburnz/python-pathspec#30 .. _`Issue 31`: cpburnz/python-pathspec#31 .. _`Issue 34`: cpburnz/python-pathspec#34 ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pathspec - Changelog: https://pyup.io/changelogs/pathspec/ - Repo: https://github.com/cpburnz/python-path-specification </details> Co-authored-by: pyup-bot <github-bot@pyup.io>
This may be considered a bug or "works as designed", depending on the interpretation of "followSymlinks", but wanted to point out a (design?) flaw in match_tree:
Suppose I want to archive a folder so I specify a very inclusive pattern: "Libs/"
Under 'Libs/' I have a Mac framework named 'Crmsdk'. Mac frameworks are really just directories with a particular structure inside but the interesting aspect for us is that it has symlinks. This is how Crmsdk.framework looks inside (first level):
Notice that
Resources
is a symlink pointing inside theVersions
folder.Now, when I call the path_spec.match_tree() function, regardless of the value of
followSymlinks
parameter, I can never get theResources
folder as an entry in the result set. Which, someone might argue, is what I should expect because:followSymlinks
is True I will get entries like:Which is normal because the code is following the symlinks and
Resources
is just a symlink toVersions/Current/Resources
.followSymlinks
is False, thenResources
doesn't even show up in the results list as a folder after CrmSdk.framework, in other words I get only these entries:I don't get any
Libs/CrmSdk.framework/Resources
entries.This puts me in the impossibility to create an archive of the matched entries that I can unzip on another location and have it recreated the same (because the symlinks are missing).
One may claim that this is a bug and when
followSymlinks
is False, the Resources folder should be returned in the list of results (clients shouldn't make an assumption about the entries returned: they may be files, folders or symlinks - it's their job to properly handle it). Bottom line is that symlinks are missing in the results list regardless of the flag's value.The text was updated successfully, but these errors were encountered: