Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Avoid target directories within the source directory#29857
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Closed
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
…path name is equal to the target path
…IfInSourceDirectory
Member
nicolas-grekas commentedJan 24, 2019
That would qualify as a bug fix to me. Could you please rebase+retarget for 3.4? |
Member
nicolas-grekas commentedFeb 20, 2019
fabpot added a commit that referenced this pull requestMar 31, 2019
…in his child with realpath checks (Fleuv, XuruDragon)This PR was merged into the 4.3-dev branch.Discussion----------[Filesystem] Fix mirroring a directory into itself or in his child with realpath checks| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | none / PR#29857| License | MIT| Doc PR | n/aThis this the continuity of#29857 by@FleuvFix a bug while trying to mirror a directory into itself or in a childAdding handle real path checks when mirroring.Commits-------8011f49 Handling relative/absolute path59437a4 Skipping iterations in the mirror() method where the iterated file's path name is equal to the target path
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently when you run:
The method will get caught in a recursive loop of creating "bar" sub directories in the target directory.
This will happen:
Until the path is so long that is validated as an invalid path string and thus mkdir() crashes.
In this pull request I implemented an if statement at the beginning of the foreach in the mirror() method. This if statement ensures that the target directory in the mirror process is skipped.