From: Mathias Preiner Date: Fri, 4 Dec 2020 06:32:17 +0000 (-0800) Subject: update-copyright: Preserve file permissions. (#5597) X-Git-Tag: cvc5-1.0.0~2505 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b7ed19ab13a2bfa6278a0180768a9895aea9aff;p=cvc5.git update-copyright: Preserve file permissions. (#5597) When updating the copyright headers file permissions were not preserved. In some cases this results in losing the permission to execute scripts. This commit makes sure to preserve the file permissions for updated files. --- diff --git a/contrib/update-copyright.pl b/contrib/update-copyright.pl index 1f119d8e9..6a8482e76 100755 --- a/contrib/update-copyright.pl +++ b/contrib/update-copyright.pl @@ -257,6 +257,11 @@ sub handleFile { print $OUT $_; } close $OUT; + + # Preserve file permissions of $infile + my $perm = (stat($infile))[2] & 0777; + chmod $perm, $outfile; + rename($outfile, $infile) || die "can't rename working file \`$outfile' to \`$infile'"; }