- Notifications
You must be signed in to change notification settings - Fork928
fix(coderd): correctly handle tar dir entries with missing path separator#12479
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
e34a37a
to33029d7
Compare0a15bca
to0e62aab
Compare
mtojek left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
I'm curious how did you notice it? Do you need .zip files specifically or just want to tinker with them?
I was adding the template source into the support bundle for troubleshooting purposes, and noticed that the generated zip file (used zip for consistency cause having a tar in a zip seemed weird) and noticed the issue then when I tested with dev.coder.com. |
33029d7
toc2b061a
Compare0e62aab
to9fa67f5
Compare
Uh oh!
There was an error while loading.Please reload this page.
STACK:
#12477
#12476
#12475
#12479 <-- you are here
I noticed thathttps://cs.opensource.google/go/go/+/refs/tags/go1.22.1:src/archive/tar/common.go;l=658 has a special case that adds a trailing slash to directory entries.
It turns out that
provisionersdk.Tar
has beensilently stripping these when creating archives for a good while. Some versions ofunzip
* appear to ignorefileinfo.IsDir()
and simply assume that any header without a trailing path separator in the name is a file.This PR makes the following changes:
coderd.CreateZipFromTar
to transparently add the trailing path separatorprovisionersdk.Tar
to add the trailing path separator* I can reproduce this with
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.