From: Stefan Sperling Subject: Re: got patch: keep file permissions and create missing directories To: Omar Polo Cc: gameoftrees@openbsd.org Date: Wed, 16 Mar 2022 19:10:11 +0100 On Wed, Mar 16, 2022 at 06:55:07PM +0100, Omar Polo wrote: > Two great omissions that got patch has is that is does not preserve file > permissions and doesn't create missing directories. > > File permissions are not preserved because it creates a temp file that is > then rename(2)d, so we loose all the info. The following patch solves > this by inspecting the permissions of the file and restoring them just > before the rename. > > The second diff handles ENOENT from rename and tries to create the > missing directory tree (got_path_mkdir creates the full directory > structure.) > > ok for both? Yes, looking good. ok stsp@