$NetBSD: patch-configure,v 1.2 2012/05/31 09:24:53 fhajny Exp $ Fix many temporary file handling issues, including in pdfroff (resolves CVE-2009-5044 / SA44999) Patches copied from: http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/groff/groff-1.20.1-owl-tmp.diff?rev=1.2 Modified for pkgsrc and excluded a documentaion change to doc/groff.texinfo that changes a `makeinfo' is too old warning into a fatal error. --- configure.orig 2009-01-09 14:25:52.000000000 +0000 +++ configure @@ -11598,18 +11598,6 @@ _ACEOF { $as_echo "$as_me:$LINENO: result: $PAGE" >&5 $as_echo "$PAGE" >&6; } -{ $as_echo "$as_me:$LINENO: checking for existing troff installation" >&5 -$as_echo_n "checking for existing troff installation... " >&6; } - if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - g=g - else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - g= - fi - { $as_echo "$as_me:$LINENO: checking for prefix of system macro packages" >&5 $as_echo_n "checking for prefix of system macro packages... " >&6; } sys_tmac_prefix= @@ -12937,33 +12925,12 @@ if $ac_need_defaults; then test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. +# Create a temporary directory, and hook for its removal unless debugging. +tmp="`mktemp -dt cs.XXXXXXXXXX`" || exit $debug || { - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } + trap 'exit_status=$?; rm -rf -- "$tmp" && exit $exit_status' EXIT + trap '{ (exit $?); exit $?; }' HUP INT QUIT PIPE TERM } # Set up the scripts for CONFIG_FILES section.