hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.62k stars 226 forks source link

Remove existing files before writing to them #428

Closed finnag closed 1 year ago

finnag commented 1 year ago

go-getter currently truncates and writes over all existing files. This causes some problems with running binaries, you can get ETXTBSY when writing to them, and can cause issues with mmapped files as well.

This is sometimes causing problems for terraform for example, where it fails to install providers due to text file busy.

Change to remove existing files before creating them. This is the same behaviour as tar has unless given the --overwrite option.

Another alternative could be to write to a temporary file and rename over the old file when complete.

hashicorp-cla commented 1 year ago

CLA assistant check
All committers have signed the CLA.