From 12530cb155ec25295215853de80011f4a44e4e5b Mon Sep 17 00:00:00 2001 From: keni Date: Fri, 16 Feb 2018 12:07:37 -0500 Subject: [PATCH] infrastructure fixes: - fix bug in git hooks that loses file permissions when doing variable expansion - fix execute permissions on sys/unix/hints/macosx.sh - explicitly call out perl as required for hooks in Developer.txt --- DEVEL/Developer.txt | 11 +++++++---- DEVEL/hooksdir/nhsub | 5 ++++- sys/unix/hints/macosx.sh | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) mode change 100644 => 100755 sys/unix/hints/macosx.sh diff --git a/DEVEL/Developer.txt b/DEVEL/Developer.txt index b30fa06c9..1267ac073 100644 --- a/DEVEL/Developer.txt +++ b/DEVEL/Developer.txt @@ -4,7 +4,7 @@ |___/\___|\_/\___|_\___/ .__/\___|_| |_| -$NHDT-Date: 1447180052 2015/11/10 18:27:32 $ +$NHDT-Date: 1518800857 2018/02/16 17:07:37 $ Welcome to the NetHack Infrastructure Developer's Guide. @@ -43,12 +43,15 @@ us an email if that's more appropriate). ------------------------------------------------------------------------------ 4. git configuration -NOTE: These instructions assume you are on the default branch ("master"); - this _is_ where you want to be for setting things up. This may or may - not be the branch you want to use for your changes; see the appropriate +NOTE: These instructions assume you are on the default branch; this _is_ + where you want to be for setting things up. This may or may not be + the branch you want to use for your changes; see the appropriate project private documentation for more information (if you are working alone we suggest using branch names starting with "LOCAL-"). +NOTE: The following instructions require perl. If you do not have perl on + your system, please install it before proceeding. + A. If you have never set up git on this machine before: (This assumes you will only be using git for NetHack. If you are going to use it for other projects as well, think before you type.) diff --git a/DEVEL/hooksdir/nhsub b/DEVEL/hooksdir/nhsub index a1686bd24..f17322516 100644 --- a/DEVEL/hooksdir/nhsub +++ b/DEVEL/hooksdir/nhsub @@ -1,6 +1,6 @@ #!/usr/bin/perl # nhsub -# $NHDT-Date: 1427408239 2015/03/26 22:17:19 $ +# $NHDT-Date: 1518800857 2018/02/16 17:07:37 $ # Note: was originally called nhdate; the rename is not reflected in the code. @@ -245,6 +245,7 @@ my $count = s/\$$PREFIX-(([A-Za-z][A-Za-z0-9_]*)(: ([^\x24]+))?)\$/&handlevar($2 # XXX had o modifier, why? return unless($count>0); return if($opt{n}); + my $mode = 0777 & (stat($file))[2]; my $ofile = $file . ".nht"; open(TOUT, ">", $ofile) or die "Can't open $ofile"; @@ -263,6 +264,8 @@ my $count = s/\$$PREFIX-(([A-Za-z][A-Za-z0-9_]*)(: ([^\x24]+))?)\$/&handlevar($2 } close TOUT or die "Can't close $ofile"; + # Do the right thing for *nix and hope for the best elsewhere: + chmod($mode, $ofile)==1 or warn "Can't set filemode on $ofile"; rename $ofile, $file or die "Can't rename $ofile to $file"; } diff --git a/sys/unix/hints/macosx.sh b/sys/unix/hints/macosx.sh old mode 100644 new mode 100755 index 2bf2360d9..93e28ca51 --- a/sys/unix/hints/macosx.sh +++ b/sys/unix/hints/macosx.sh @@ -1,5 +1,5 @@ #!/bin/sh -# NetHack 3.6 macosx.sh $NHDT-Date: 1515549543 2018/01/10 01:59:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.18 $ +# NetHack 3.6 macosx.sh $NHDT-Date: 1518800856 2018/02/16 17:07:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.19 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # NetHack may be freely redistributed. See license for details. #