Skip to content

Add resolve file attributes from hdr.Xattrs#2872

Closed
Ace-Tang wants to merge 1 commit intocontainerd:masterfrom
Ace-Tang:add_tar_xattr
Closed

Add resolve file attributes from hdr.Xattrs#2872
Ace-Tang wants to merge 1 commit intocontainerd:masterfrom
Ace-Tang:add_tar_xattr

Conversation

@Ace-Tang
Copy link
Copy Markdown
Contributor

Through golang indicate that tar header field 'Xattrs' should be Deprecated,
but moby still use 'Xattrs' to deal with file extended attributes, maybe
other image build tools also do this way. Add resolve file attributes from
'hdr.Xattrs' make these images work good, let extended file take effect.

Fixes: #2863

Signed-off-by: Ace-Tang [email protected]

I am trying to add a test for file xattrs

Through golang indicate that tar header field 'Xattrs' should be Deprecated,
but moby still use 'Xattrs' to deal with file extended attributes, maybe
other image build tools also do this way. Add resolve file attributes from
'hdr.Xattrs' make these images work good, let extended file take effect.

Fixes: containerd#2863

Signed-off-by: Ace-Tang <[email protected]>
@Ace-Tang
Copy link
Copy Markdown
Contributor Author

CI do not like add the Deprecated field

 proto-fmt
71+ check
72gometalinter --config .gometalinter.json ./...
73archive\tar.go:425:26:warning: hdr.Xattrs is deprecated: Use PAXRecords instead.  (SA1019) (staticcheck)
74Makefile:109: recipe for target 'check' failed
75mingw32-make: *** [check] Error 1
76Command exited with code 2

Comment thread archive/tar.go
// in https://github.com/moby/moby/blob/master/pkg/archive/archive.go, moby still use 'Xattrs'
// to deal with file extended attributes, maybe other image build tools also do this way.
// Add resolve file attributes from 'hdr.Xattrs' make these images work good
for key, value := range hdr.Xattrs {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can close this PR. As @dmcgowan mentions, the hdr.Xattrs has been deprecated.

In > go1.10 version, I read the code in golang code base. The PAXRecords will contains all values in hdr.Xattrs. please check this https://github.com/golang/go/blob/50bd1c4d4eb4fac8ddeb5f063c099daccfb71b26/src/archive/tar/reader.go#L249

If I understand correctly, after go1.10, user can retrieve the SCHILY.xattr. value from PAXRecords. PAXRecords can provides unify entrypoint to user.

@Ace-Tang
Copy link
Copy Markdown
Contributor Author

@fuweid , you are right, I check the golang 1.10 release note, https://golang.org/doc/go1.10#archive/tar

Reader and the Writer now support arbitrary PAX records, using the new Header.PAXRecords field, a generalization of the existing Xattrs field.

Xattrs and PAX records will keep same by golang, so I will cose this.

@Ace-Tang Ace-Tang closed this Dec 12, 2018
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.

[bug] lose file capability when use ctr pull image

2 participants