Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Handle the case where files appear in the tar before their directories. #98

Merged
merged 1 commit into from
Sep 22, 2017

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Sep 21, 2017

This fixes the errors like:

E0921 08:10:02.661354   95571 image_prep_utils.go:99] Failed to untar layer with error: mkdir /var/folders/bk/_v630x5s2pd4nvjc0x_v9s5c005nm8/T/gcr.iodistrolessbase912372170/etc/ssl/certs: permission denied

// It's possible for a file to be included before the directory it's in is created.
baseDir := filepath.Dir(target)
if _, err := os.Stat(baseDir); os.IsNotExist(err) {
if err := os.MkdirAll(baseDir, 0755); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use the inherited mode from the header? header.FileInfo().mode() above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately the file mode doesn't work for the directory mode. I'm not really sure what the right thing to do here is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah I see, I'm not really sure either. Maybe we create the directory with these permissions and then create the files inside of it with the header's permissions? I'm just worried that file permissions will be different than what's expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah how's this?

@dlorenc dlorenc merged commit ec010de into GoogleContainerTools:master Sep 22, 2017
@dlorenc dlorenc deleted the tarorder branch September 22, 2017 20:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants