From fa7b6a73997a495c71c11c92b9240198663bf944 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 15 Aug 2020 12:56:09 -0700 Subject: [PATCH] install.sh: test ulimit512 utility during install It's no use having and using a ulimit512 utility if it doesn't work. To that end, run a quick and dirty test during install to make sure that it works properly. At the same time, provide an expansion for @max_file_size512@ (to $Girocco::Config::max_file_size512) while installing shell scripts that have no other way to access the value (such as the git-shell-verify script). Signed-off-by: Kyle J. McKay --- install.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/install.sh b/install.sh index 191af07..238fa24 100755 --- a/install.sh +++ b/install.sh @@ -172,6 +172,24 @@ if ! [ -f src/ulimit512 ] || ! [ -x src/ulimit512 ]; then echo "ERROR: perhaps you forgot to run make?" >&2 exit 1 fi +ebin="/bin/echo" +if [ ! -x "$ebin" ] && [ -x "/usr/bin/echo" ]; then + ebin="/usr/bin/echo" +fi +if [ ! -x "$ebin" ]; then + echo "ERROR: neither /bin/echo nor /usr/bin/echo found" >&2 + echo "ERROR: at least one must be present for testing during install" >&2 + exit 1 +fi +ec=999 +tmpfile="$(mktemp "/tmp/ul512-$$-XXXXXX")" +{ src/ulimit512 -f 0 "$ebin" test >"$tmpfile" || ec=$?; } >/dev/null 2>&1 +rm -f "$tmpfile" +if [ "$ec" = "999" ] || [ "$ec" = "0" ]; then + echo "ERROR: src/ulimit512 is built, but broken!" >&2 + echo "ERROR: exceeding file size limit did not fail!" >&2 + exit 1 +fi if ! [ -f src/ltsha256 ] || ! [ -x src/ltsha256 ]; then echo "ERROR: src/ltsha256 is not built! Did you _REALLY_ read INSTALL?" >&2 echo "ERROR: perhaps you forgot to run make?" >&2 @@ -656,6 +674,7 @@ perl -I"$PWD" -M$GIROCCO_CONF -i -p \ -e 's/\@upload_pack_window\@/"'"$var_upload_window"'"/g;' \ -e 's/\@fetch_stash_refs\@/"$Girocco::Config::fetch_stash_refs"/g;' \ -e 's/\@suppress_git_ssh_logging\@/"$Girocco::Config::suppress_git_ssh_logging"/g;' \ + -e 's/\@max_file_size512\@/"$Girocco::Config::max_file_size512"/g;' \ -e 'close ARGV if eof;' \ "$basedir"/jobs/*.sh "$basedir"/jobd/*.sh \ "$basedir"/taskd/*.sh "$basedir"/gitweb/*.sh \ -- 2.11.4.GIT