Ticket #57134: patch-autogen-mktemp.diff

File patch-autogen-mktemp.diff, 5.6 KB (added by kencu (Ken), 6 years ago)

patch to replace mktemp with gmktemp

  • agen5/ag-text.c

    diff --git agen5/ag-text.c agen5/ag-text.c
    index 47cfca5..9a5e1fc 100644
    char const ag_text_strtable[16331] = 
    289289/*  5125 */ "malloc of %zd bytes failed\n\0"
    290290/*  5153 */ "gperf --version > /dev/null 2>&1 || die 'no gperf program'\n"
    291291            "test -z ${gpdir} && {\n"
    292             "  gpdir=`mktemp -d ./.gperf.XXXXXX` 2>/dev/null\n"
     292            "  gpdir=`gmktemp -d ./.gperf.XXXXXX` 2>/dev/null\n"
    293293            "  test -z \"${gpdir}\" && gpdir=.gperf.$$\n"
    294294            "  test -d ${gpdir} || mkdir ${gpdir} || die \"cannot mkdir ${gpdir}\"\n"
    295295            "}\n"
    char const ag_text_strtable[16331] = 
    616616            "mk_tmp_dir() {\n"
    617617            "  test -d \"${tmp_dir}\" && return 0\n"
    618618            "  tmp_dir=`\n"
    619             "    t=\\`mktemp -d ${TMPDIR}/.ag-XXXXXX\\`\n"
     619            "    t=\\`gmktemp -d ${TMPDIR}/.ag-XXXXXX\\`\n"
    620620            "    test -d \"${t}\" || {\n"
    621621            "      t=${TMPDIR}/.ag-$$\n"
    622622            "      rm -rf ${t}\n"
  • agen5/ag-text.def

    diff --git agen5/ag-text.def agen5/ag-text.def
    index a8a3c0b..4477a0d 100644
    string = { nm = MK_GPERF_SCRIPT; 
    450450   str = <<- _GP_Script_
    451451        gperf --version > /dev/null 2>&1 || die 'no gperf program'
    452452        test -z ${gpdir} && {
    453           gpdir=`mktemp -d ./.gperf.XXXXXX` 2>/dev/null
     453          gpdir=`gmktemp -d ./.gperf.XXXXXX` 2>/dev/null
    454454          test -z "${gpdir}" && gpdir=.gperf.$$
    455455          test -d ${gpdir} || mkdir ${gpdir} || die "cannot mkdir ${gpdir}"
    456456        }
    string = { nm = SHELL_INIT_STR; 
    743743        mk_tmp_dir() {
    744744          test -d "${tmp_dir}" && return 0
    745745          tmp_dir=`
    746             t=\`mktemp -d ${TMPDIR}/.ag-XXXXXX\`
     746            t=\`gmktemp -d ${TMPDIR}/.ag-XXXXXX\`
    747747            test -d "${t}" || {
    748748              t=${TMPDIR}/.ag-$$
    749749              rm -rf ${t}
  • agen5/mk-stamps.sh

    diff --git agen5/mk-stamps.sh agen5/mk-stamps.sh
    index 49269cf..846a024 100644
     
    2828#  because some of the rules are complex and we don't want to
    2929#  deal with the dual update problem.
    3030
    31 STAMP_TEMP_DIR=$(mktemp --suffix=.tdir -d /tmp/mk-stamps-XXXXXXXX)
     31STAMP_TEMP_DIR=$(gmktemp --suffix=.tdir -d /tmp/mk-stamps-XXXXXXXX)
    3232exec 9>&2 2>> ${STAMP_TEMP_DIR}/mk-stamps.log
    3333stop_tracing=:
    3434if (shopt -qo xtrace)
    conf_time_make_dep_file() { 
    310310#
    311311export PS4='+stmp=${FUNCNAME:-=}-$LINENO> '
    312312set_defaults ${1+"$@"}
    313 rmlist=`mktemp ${TMPDIR:-/tmp}/rmlist-XXXXXX`
     313rmlist=`gmktemp ${TMPDIR:-/tmp}/rmlist-XXXXXX`
    314314test -f "$rmlist" || {
    315315    rmlist=${TMPDIR:-/tmp}/rmlist-$$
    316316    rm -f $rmlist
  • agen5/test/daemon.test

    diff --git agen5/test/daemon.test agen5/test/daemon.test
    index 68dce8e..6b4d93d 100755
     
    2323#
    2424# ----------------------------------------------------------------------
    2525
    26 tdir=$( (mktemp -d $PWD/.daemon-XXXXXX.d) 2>/dev/null)
     26tdir=$( (gmktemp -d $PWD/.daemon-XXXXXX.d) 2>/dev/null)
    2727test -z "${tdir}" && {
    2828  tdir=$PWD/.daemon-$$.d
    2929  rm -rf ${tdir}
  • build-aux/run-ag.sh

    diff --git build-aux/run-ag.sh build-aux/run-ag.sh
    index 6ee7b85..127ed2c 100644
    find_exe() { 
    4545  return 0
    4646}
    4747
    48 STAMP_TEMP_DIR=$(mktemp --suffix=.tdir -d /tmp/run-ag-XXXXXXXX)
     48STAMP_TEMP_DIR=$(gmktemp --suffix=.tdir -d /tmp/run-ag-XXXXXXXX)
    4949exec 9>&2 2>> ${STAMP_TEMP_DIR}/mk-stamps.log
    5050VERBOSE=1
    5151
  • config/bootstrap

    diff --git config/bootstrap config/bootstrap
    index 793579a..ebecb42 100755
    config_tools() 
    9595        i_made_temp_dir=false
    9696
    9797    else
    98         TEMP_DIR=`mktemp -d ${TMPDIR:-/tmp}/bs-XXXXXX`
     98        TEMP_DIR=`gmktemp -d ${TMPDIR:-/tmp}/bs-XXXXXX`
    9999        i_made_temp_dir=true
    100100        export TEMP_DIR
    101101    fi
  • config/config.guess

    diff --git config/config.guess config/config.guess
    index 256083a..8657e26 100755
    set_cc_for_build=' 
    100100trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
    101101trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
    102102: ${TMPDIR=/tmp} ;
    103  { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
     103 { tmp=`(umask 077 && gmktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
    104104 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
    105105 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
    106106 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
  • config/ltmain.sh

    diff --git config/ltmain.sh config/ltmain.sh
    index 0f0a2da..504429e 100644
    func_mktempdir () 
    899899    else
    900900
    901901      # If mktemp works, use that first and foremost
    902       _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
     902      _G_tmpdir=`gmktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
    903903
    904904      if test ! -d "$_G_tmpdir"; then
    905905        # Failing that, at least try and use $RANDOM to avoid a race
  • config/mk-shdefs.in

    diff --git config/mk-shdefs.in config/mk-shdefs.in
    index 68aed2a..b38a121 100644
    configure() { 
    130130
    131131set -x
    132132exec 9>&2
    133 tmp=$(mktemp --suffix=.tdir -d /tmp/shdefs-XXXXXXXXX)
     133tmp=$(gmktemp --suffix=.tdir -d /tmp/shdefs-XXXXXXXXX)
    134134exec 2>> $tmp/mk-shdef.log
    135135init $0 $1
    136136mk_config
  • configure

    diff --git configure configure
    index 41873b2..3ba78a9 100755
    $debug || 
    2006020060# Create a (secure) tmp directory for tmp files.
    2006120061
    2006220062{
    20063   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
     20063  tmp=`(umask 077 && gmktemp -d "./confXXXXXX") 2>/dev/null` &&
    2006420064  test -d "$tmp"
    2006520065}  ||
    2006620066{