Open lowjoel opened 11 months ago
Hey and thanks for the fix! I'm trying to understand how this happens:
Unzipping this on my Mac host directly yields the correct directory. This means that the Zip file is fine, the unzip process is broken. Using bsdtar causes the directory to be correctly created.
What exactly are you unzipping? The same zip file that Sourcegraph gave src-cli, or one from the code host? (Just want to make sure our zip endpoint is not flawed instead). Also, is there any chance to get a minimally reproducible version of the repo you're seeing that error with? Can be completely of bogus content, just the same file structure that causes this issue to happen :)
What exactly are you unzipping? The same zip file that Sourcegraph gave src-cli, or one from the code host?
The one Sourcegraph gave the CLI when trying to perform the batch change. That's the raw endpoint:
https://sourcegraph.<domain>/<repo-path>/-/raw?format=zip
Also, is there any chance to get a minimally reproducible version of the repo you're seeing that error with? Can be completely of bogus content, just the same file structure that causes this issue to happen :)
I have no idea what causes it. Maybe it's size? I observed it on a 5Gib zip archive, but I don't know what may cause such a problem to manifest. I couldn't find a common theme across the different repositories that failed in this manner when running the batch change preview.
Fixed tests.
There are situations where a Zip archive from Sourcegraph causes the directory to be improperly recreated within the container. Using libarchive-tools fixes this.
Example broken output:
I then docker-exec'ed into the container. Unzip was creating
.gitmodules
as a symlink with the file contents rather than a normal file. Both the Git repository and Sourcegraph show the file correctly:Unzipping this on my Mac host directly yields the correct directory. This means that the Zip file is fine, the unzip process is broken. Using bsdtar causes the directory to be correctly created.
Test plan
batch-change-volume-workspace
image