Submitted By: Robert Connolly (ashes) Date: 2006-10-11 Initial Package Version: 2.5 Upstream Status: Submitted - http://sources.redhat.com/bugzilla/show_bug.cgi?id=3348 Origin: Openwall Owl Linux - glibc-2.3.2-owl-tmpfile.diff Description: This patch instructs mktemp(1) to use temporary file directory from the '-t' option. It also makes sure temporary files get removed after exiting the scripts. diff -Naur glibc-2.5.orig/debug/xtrace.sh glibc-2.5/debug/xtrace.sh --- glibc-2.5.orig/debug/xtrace.sh 2006-05-19 16:43:31.000000000 +0000 +++ glibc-2.5/debug/xtrace.sh 2006-10-11 20:54:11.000000000 +0000 @@ -161,32 +161,32 @@ while read fct; do read file if test "$fct" != '??' -a "$file" != '??:0'; then - format_line $fct $file + format_line "$fct" "$file" fi done else - fifo=$(mktemp -u ${TMPDIR:-/tmp}/xtrace.XXXXXX) + fifo="`mktemp -ut xtrace.XXXXXXXXXX`" || exit + trap 'rm -f -- "$fifo"' EXIT + trap 'trap - EXIT; rm -f -- "$fifo"; exit 1' HUP INT QUIT TERM PIPE mkfifo -m 0600 $fifo || exit 1 - trap 'rm $fifo; exit 1' SIGINT SIGTERM SIGPIPE # Now start the program and let it write to the FIFO. $TERMINAL_PROG -T "xtrace - $program $*" -e /bin/sh -c "LD_PRELOAD=$pcprofileso PCPROFILE_OUTPUT=$fifo $program $*; read < $fifo" & termpid=$! - $pcprofiledump -u $fifo | + $pcprofiledump -u "$fifo" | while read line; do - echo $line | + echo "$line" | sed 's/this = \([^,]*\).*/\1/' | - addr2line -fC -e $program + addr2line -fC -e "$program" done | while read fct; do read file if test "$fct" != '??' -a "$file" != '??:0'; then - format_line $fct $file + format_line "$fct" "$file" fi done read -p "Press return here to close $TERMINAL_PROG($program)." - echo > $fifo - rm $fifo + echo > "$fifo" fi exit 0 diff -Naur glibc-2.5.orig/malloc/memusage.sh glibc-2.5/malloc/memusage.sh --- glibc-2.5.orig/malloc/memusage.sh 2006-05-19 16:47:26.000000000 +0000 +++ glibc-2.5/malloc/memusage.sh 2006-10-11 21:02:37.000000000 +0000 @@ -77,6 +77,15 @@ exit 0 } +# These variables are local +buffer= +data= +memusagestat_args= +notimer= +png= +progname= +tracemmap= + # Process arguments. But stop as soon as the program name is found. while test $# -gt 0; do case "$1" in @@ -213,7 +222,9 @@ if test -n "$data"; then datafile="$data" elif test -n "$png"; then - datafile=$(mktemp ${TMPDIR:-/tmp}/memusage.XXXXXX 2> /dev/null) + datafile="`mktemp -t memusage.XXXXXXXXXX`" || exit + trap 'rm -f -- "$datafile"' EXIT + trap 'trap - EXIT; rm -f -- "$datafile"; exit 1' HUP INT QUIT TERM PIPE if test $? -ne 0; then # Lame, but if there is no `mktemp' program the user cannot expect more. if test "$RANDOM" != "$RANDOM"; then