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

fix(archlinux): .MTREE should have dir permissions too #644

Merged
merged 1 commit into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion arch/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func createFilesInTar(info *nfpm.Info, tw *tar.Writer) ([]MtreeEntry, int64, err
entries = append(entries, MtreeEntry{
Destination: content.Destination,
Time: content.ModTime().Unix(),
Mode: int64(content.Mode()),
Type: files.TypeDir,
})
}
Expand Down Expand Up @@ -455,9 +456,10 @@ func (me *MtreeEntry) WriteTo(w io.Writer) (int64, error) {
case files.TypeDir:
n, err := fmt.Fprintf(
w,
"./%s time=%d.0 type=dir\n",
"./%s time=%d.0 mode=%o type=dir\n",
me.Destination,
me.Time,
me.Mode,
)
return int64(n), err
case files.TypeSymlink:
Expand Down
3 changes: 2 additions & 1 deletion arch/arch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func extractPkginfoFields(data []byte) map[string]string {
}

const correctMtree = `#mtree
./foo time=1234.0 type=dir
./foo time=1234.0 mode=755 type=dir
./3 time=12345.0 mode=644 size=100 type=file md5digest=abcd sha256digest=ef12
./sh time=123456.0 mode=777 type=link link=/bin/bash
`
Expand All @@ -266,6 +266,7 @@ func TestArchMtree(t *testing.T) {
Destination: "foo",
Time: 1234,
Type: files.TypeDir,
Mode: 0o755,
},
{
Destination: "3",
Expand Down