Skip to content

Commit

Permalink
Preserve source file perms in http-archive file exports (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanjli authored May 7, 2024
1 parent 9d9396f commit 937fd8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.7.2-alpha.1 - 2024-05-07

## Fixed

- (cli) File permissions are now preserved in the exports of `http-archive` source files extracted from `.tar`/`.tar.gz` archives.

## 0.7.2-alpha.0 - 2024-05-07

## Added
Expand Down
2 changes: 1 addition & 1 deletion cmd/forklift/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const (
newStageStoreVersion = "v0.7.0"
// fallbackVersion is the version reported which the Forklift tool reports itself as if its actual
// version is unknown.
fallbackVersion = "v0.7.1-dev"
fallbackVersion = "v0.7.2-dev"
)

var (
Expand Down
5 changes: 4 additions & 1 deletion internal/app/forklift/bundles.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ func extractFile(tarReader *tar.Reader, sourcePath string, exportPath string) er
)
}
case tar.TypeReg:
targetFile, err := os.Create(filepath.FromSlash(targetPath))
targetFile, err := os.OpenFile(
filepath.FromSlash(targetPath), os.O_RDWR|os.O_CREATE|os.O_TRUNC,
fs.FileMode(header.Mode&int64(fs.ModePerm)),
)
if err != nil {
return errors.Wrapf(err, "couldn't create export file at %s", targetPath)
}
Expand Down

0 comments on commit 937fd8c

Please sign in to comment.