Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure files from the tar stream are created with proper permissions #787

Merged
merged 1 commit into from Aug 10, 2017

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Aug 7, 2017

@bparees
Copy link
Contributor Author

bparees commented Aug 7, 2017

@@ -338,6 +338,7 @@ func (t *stiTar) ExtractTarStreamFromTarReader(dir string, tarReader Reader, log
glog.Errorf("Error creating dir %q: %v", dirPath, err)
return err
}
t.Chmod(dirPath, header.FileInfo().Mode())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that i did this instead of changing the 0700 above because i only wanted to affect the permissions of files/dirs explicitly defined in the tar file, not parent dirs being indirectly created.

@bparees
Copy link
Contributor Author

bparees commented Aug 7, 2017

@rcernich fyi. after this merges we'll have to updated openshift w/ the change, it'll be part of 3.6.1 at this point. In the meantime the workaround would be to perform permission fixing in your assemble script.

@rcernich
Copy link

rcernich commented Aug 7, 2017

Awesome. Thanks @bparees!

@jim-minter
Copy link
Contributor

Oops :( Fix lgtm, please update the unit test.

@bparees
Copy link
Contributor Author

bparees commented Aug 8, 2017

@jim-minter unit tests updated.

return nil
}

func isDir(mode os.FileMode) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. interesting that doesn't exist for symlinks.

@jim-minter
Copy link
Contributor

hopefully it'll pass on Windows too? [test]

@bparees bparees force-pushed the tar_permissions branch 3 times, most recently from 60013ec to 48860b4 Compare August 8, 2017 18:41
if files[i].mode&0100 == 0100 {
// if the file is executable, make it executable for everyone
files[i].mode |= 0111
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jim-minter please sanity check the above permission logic.

@bparees bparees force-pushed the tar_permissions branch 2 times, most recently from e3b27f1 to a7574d4 Compare August 8, 2017 19:05
@jim-minter
Copy link
Contributor

assuming it passes the tests, lgtm

}
if files[i].mode.IsDir() {
// if the file is a directory, make it executable for everyone
files[i].mode |= 0111
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jim-minter changed this logic to only apply to directories (not files+symlinks) based on the latest failure.

@openshift openshift deleted a comment from openshift-bot Aug 8, 2017
@openshift openshift deleted a comment from openshift-bot Aug 8, 2017
@openshift openshift deleted a comment from openshift-bot Aug 8, 2017
@openshift-bot
Copy link
Contributor

Evaluated for source to image test up to b283c1e

@openshift openshift deleted a comment from openshift-bot Aug 8, 2017
@openshift-bot
Copy link
Contributor

Source To Image Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_s2i/608/) (Base Commit: 0d91192) (PR Branch Commit: b283c1e)

@bparees
Copy link
Contributor Author

bparees commented Aug 8, 2017

finally. @jim-minter please give a final review, i had to tweak the permission operations in the unit test a bit to make windows happy.

@jim-minter
Copy link
Contributor

lgtm, please merge

@bparees
Copy link
Contributor Author

bparees commented Aug 10, 2017

[merge]

let the backporting begin.

@openshift-bot
Copy link
Contributor

openshift-bot commented Aug 10, 2017

Source To Image Merge Results: Waiting: You are in the build queue at position: 1

@openshift-bot
Copy link
Contributor

Evaluated for source to image merge up to b283c1e

@openshift-bot openshift-bot merged commit d6f07ef into openshift:master Aug 10, 2017
@bparees bparees deleted the tar_permissions branch August 10, 2017 15:46
@bparees
Copy link
Contributor Author

bparees commented Aug 10, 2017

backport to 3.6 branch: https://github.com/openshift/source-to-image/pull/788/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants