-
Notifications
You must be signed in to change notification settings - Fork 23
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
Excluding folders from zip file is broken in main since #61 #67
Comments
This test DOES NOT fail for me on MacOS or Ubuntu:
Can you modify that to get a failing test please? Ironically, excluding At the very least, this can be fixed by conditionally setting the escaped characters for |
@BrianHenryIE Thanks for reacting so quickly! I am working inside a WordPress Docker Container so maybe something special about the shell/zip in there. Sorry for keeping the issue a bit too vague, but like I've already mentioned I don't have time right now for a more thorough investigation but will try to produce a proper testcase, but probably will take me 1 or 2 weeks. |
Okay, so I finally managed to make this fail @BrianHenryIE . The problem is that having So if you modify the test to create a file inside a subfolder of So, this is a complete test that fails for me, but only for zip:
Escaping the Finally my gut still feels bad running unescaped glob patterns on the shell. |
@kraftner Thanks for the additional discovery! Want to submit a PR with your work? |
Well. We now have a reproducible error, but it is still unclear how to properly solve this in a way that consistently works across tar/zip and Win/Mac/Linux. Since I am not sure if/when I might find time to work on this I thought I'd report it just in case anybody wants to pick this up before me. In any case I feel like there is nothing yet that is ready for a PR. |
#61 seems to have broken excluding folders. 2d265e4 still works but f5b532c doesn't. This also isn't covered by the tests which might explain why it went unnoticed.
When we have a
.distignore
file that contains just.git
the.git
folder is not excluded from the archive.Before #61 this would have resulted in the following command being actually run:
Now what is run for
.git
isAlso when trying the newly anchored version
/.git
we getThe problem seems to be this line:
dist-archive-command/src/Dist_Archive_Command.php
Lines 246 to 247 in 55f14e8
When I turn it back into what it was before
dist-archive-command/src/Dist_Archive_Command.php
Line 208 in 2d265e4
we get this again which works:
So undoing the shell escaping seems to break things. Also I am not sure why this is needed anyway. Also feels risky from a security perspective. Maybe @BrianHenryIE or @schlessera can add some context why this was done in the first place in #61.
While we're at it: There are actually 3 excludes added now. While a single seems to also do the job:
Final note: Since I already spent way more time on it today than I currently have I only tested this on Linux. I also can't find time for a PR right now, but I thought I'd at least leave this here as a brain dump in case someone else hits this as well and/or finds time for a PR before me.
The text was updated successfully, but these errors were encountered: