Commit 68b178a4 authored by Amos Wenger's avatar Amos Wenger

Preserve file mode in fresh bowl and overlay bowl

parent 9bc5b831
Pipeline #14861 passed with stage
in 11 minutes and 21 seconds
......@@ -87,7 +87,7 @@ func (b *freshBowl) Resume(c *BowlCheckpoint) error {
}
func (b *freshBowl) GetWriter(index int64) (EntryWriter, error) {
return &freshEntryWriter{path: b.OutputPool.GetPath(index)}, nil
return &freshEntryWriter{path: b.OutputPool.GetPath(index), file: b.SourceContainer.Files[index]}, nil
}
func (b *freshBowl) Transpose(t Transposition) (rErr error) {
......@@ -140,6 +140,7 @@ type freshEntryWriter struct {
f *os.File
path string
offset int64
file *tlc.File
}
var _ EntryWriter = (*freshEntryWriter)(nil)
......@@ -154,7 +155,7 @@ func (few *freshEntryWriter) Resume(c *WriterCheckpoint) (int64, error) {
return 0, errors.WithStack(err)
}
f, err := screw.OpenFile(few.path, os.O_CREATE|os.O_WRONLY, os.FileMode(0644))
f, err := screw.OpenFile(few.path, os.O_CREATE|os.O_WRONLY, os.FileMode(few.file.Mode|tlc.ModeMask))
if err != nil {
return 0, errors.WithStack(err)
}
......
......@@ -180,7 +180,7 @@ func (b *overlayBowl) GetWriter(sourceFileIndex int64) (EntryWriter, error) {
debugf("returning move writer for '%s'", sourceFile.Path)
wPath := b.stagePool.GetPath(sourceFileIndex)
return &freshEntryWriter{path: wPath}, nil
return &freshEntryWriter{path: wPath, file: sourceFile}, nil
}
func (b *overlayBowl) markOverlay(sourceFileIndex int64) {
......@@ -719,7 +719,7 @@ func (b *overlayBowl) applyOverlays() error {
defer r.Close()
outputPath := filepath.Join(b.OutputFolder, nativePath)
w, err := screw.OpenFile(outputPath, os.O_WRONLY, 0644)
w, err := screw.OpenFile(outputPath, os.O_WRONLY, os.FileMode(file.Mode|tlc.ModeMask))
if err != nil {
return errors.WithStack(err)
}
......
......@@ -222,7 +222,7 @@ func runScenario(t *testing.T, params *bowlerParams) {
wp, err := zipwriterpool.New(p.SourceContainer, zw)
must(t, err)
b, err := bowl.NewPoolBowl(&bowl.PoolBowlParams{
b, err := bowl.NewPoolBowl(bowl.PoolBowlParams{
TargetContainer: p.TargetContainer,
TargetPool: p.TargetPool,
SourceContainer: p.SourceContainer,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment