package vfs import ( "context" "os" "path/filepath" "testing" ) // QA-6: a new archive gets 0666 minus umask (as os.Create would), not the // 0600 of the temp file and not a fixed 0644. func TestNewArchiveModeFollowsUmask(t *testing.T) { d, out := t.TempDir(), t.TempDir() qaWrite(t, filepath.Join(d, "a.txt"), "x", 0o644) arc := filepath.Join(out, "a.tar") if err := CreateArchive(context.Background(), []string{filepath.Join(d, "a.txt")}, arc, nil); err != nil { t.Fatal(err) } st, err := os.Stat(arc) if err != nil { t.Fatal(err) } if want := 0o666 &^ processUmask(); st.Mode().Perm() != want { t.Fatalf("new archive mode %o, want %o", st.Mode().Perm(), want) } }