-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from hashicorp/TF-10898-go-slug-0-13-1-wont-co…
…mpile-on-linux-386-platforms Fixes linux 32bit build issue on v0.13.1
- Loading branch information
Showing
4 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//go:build linux_amd || linux_arm | ||
// +build linux_amd linux_arm | ||
|
||
package unpackinfo | ||
|
||
import ( | ||
"golang.org/x/sys/unix" | ||
) | ||
|
||
// Lchtimes modifies the access and modified timestamps on a target path | ||
// This capability is only available on Linux and Darwin as of now. | ||
func (i UnpackInfo) Lchtimes() error { | ||
return unix.Lutimes(i.Path, []unix.Timeval{ | ||
{Sec: i.OriginalAccessTime.Unix(), Usec: int32(i.OriginalAccessTime.Nanosecond() / 1e6 % 1e6)}, | ||
{Sec: i.OriginalModTime.Unix(), Usec: int32(i.OriginalModTime.Nanosecond() / 1e6 % 1e6)}}, | ||
) | ||
} | ||
|
||
// CanMaintainSymlinkTimestamps determines whether is is possible to change | ||
// timestamps on symlinks for the the current platform. For regular files | ||
// and directories, attempts are made to restore permissions and timestamps | ||
// after extraction. But for symbolic links, go's cross-platform | ||
// packages (Chmod and Chtimes) are not capable of changing symlink info | ||
// because those methods follow the symlinks. However, a platform-dependent option | ||
// is provided for linux and darwin (see Lchtimes) | ||
func CanMaintainSymlinkTimestamps() bool { | ||
return true | ||
} |
4 changes: 2 additions & 2 deletions
4
internal/unpackinfo/lchtimes_linux.go → internal/unpackinfo/lchtimes_linux64.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters