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: Resolve symlinks being written with size 0 in tar#1488

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
kylecarbs merged 1 commit intomainfromsymload
May 16, 2022
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletionsprovisionersdk/archive.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,14 @@ func Tar(directory string, limit int64) ([]byte, error) {
if err != nil {
return err
}
header, err := tar.FileInfoHeader(fileInfo, file)
var link string
if fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink {
link, err = os.Readlink(file)
if err != nil {
return err
}
}
header, err := tar.FileInfoHeader(fileInfo, link)
Comment on lines +28 to +35
Copy link
Contributor

@coadlercoadlerMay 16, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a bit confusing. It seems like this only works for symlinks, since we're no longer using thefile var if it's not.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The second arg is actually only alink. It was implemented incorrectly beforehand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

So it should be empty if the file isn't a symlink?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I believe so

if err != nil {
return err
}
Expand All@@ -45,7 +52,7 @@ func Tar(directory string, limit int64) ([]byte, error) {
if err := tarWriter.WriteHeader(header); err != nil {
return err
}
if fileInfo.IsDir() {
if!fileInfo.Mode().IsRegular() {
return nil
}
data, err := os.Open(file)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp