Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
johnstcn merged 4 commits intomainfromcj/fileszip-directory-member
Mar 11, 2024

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedMar 8, 2024
edited
Loading

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 thatprovisionersdk.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:

  • Adds a unit test to reproduce the behaviour
  • Modifiescoderd.CreateZipFromTar to transparently add the trailing path separator
  • Modifiesprovisionersdk.Tar to add the trailing path separator

* I can reproduce this withUnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

Copy link
Member

@mtojekmtojek left a comment
edited
Loading

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?

@johnstcn
Copy link
MemberAuthor

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.

mtojek reacted with thumbs up emoji

@johnstcnjohnstcnforce-pushed thecj/files-nil-ptr-deref branch from33029d7 toc2b061aCompareMarch 11, 2024 13:32
@johnstcnjohnstcnforce-pushed thecj/fileszip-directory-member branch from0e62aab to9fa67f5CompareMarch 11, 2024 13:36
Base automatically changed fromcj/files-nil-ptr-deref tomainMarch 11, 2024 14:03
@johnstcnjohnstcn merged commitbed61f7 intomainMar 11, 2024
@johnstcnjohnstcn deleted the cj/fileszip-directory-member branchMarch 11, 2024 14:06
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 11, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@mtojekmtojekmtojek approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@mafredri@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp