internal/providercache: Fix positions on selections file/dir

On Unix-derived systems a directory must be marked as "executable" in
order to be accessible, so our previous mode of 0660 here was unsufficient
and would cause a failure if it happened to be the installer that was
creating the plugins directory for the first time here.

Now we'll make it executable and readable for all but only writable by
the same user/group. For consistency, we also make the selections file
itself readable by everyone. In both cases, the umask we are run with may
further constrain these modes.
This commit is contained in:
Martin Atkins 2020-03-31 14:38:26 -07:00
parent d40085f374
commit 2ff4582be2
1 changed files with 2 additions and 2 deletions

View File

@ -82,9 +82,9 @@ func (lf *lockFile) Write(new map[addrs.Provider]lockFileEntry) error {
}
os.MkdirAll(
filepath.Dir(lf.filename), 0660,
filepath.Dir(lf.filename), 0775,
) // ignore error since WriteFile below will generate a better one anyway
return ioutil.WriteFile(lf.filename, buf, 0660)
return ioutil.WriteFile(lf.filename, buf, 0664)
}
func (lfe *lockFileEntry) UnmarshalJSON(src []byte) error {