Skip to content

Commit

Permalink
fix(archlinux): .MTREE should have dir permissions too (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Apr 5, 2023
1 parent 3174a22 commit 571a32b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion arch/arch.go
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
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

0 comments on commit 571a32b

Please sign in to comment.