# HG changeset patch # User Javi Merino # Date 1274285195 -7200 # Node ID 2b440bb8a66b9f2983ccfcd330035dc314acb340 # Parent ffd85ab578be21fd952398607e5d6c86f1b1359e Fixed a bashism with the use of $RANDOM in hgeditor. The variable $RANDOM is not POSIX so a portable /bin/sh may not define it. When creating a directory with a random name it's better to use mktemp, which, even though is not POSIX, exists in common Unixes including Linux, OpenBSD, FreeBSD and MacOS X. diff -r ffd85ab578be -r 2b440bb8a66b hgeditor --- a/hgeditor Thu May 27 22:50:23 2010 +0300 +++ b/hgeditor Wed May 19 18:06:35 2010 +0200 @@ -27,10 +27,10 @@ trap "cleanup_exit" 0 # normal exit trap "exit 255" HUP INT QUIT ABRT TERM -HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$RANDOM.$RANDOM.$$" -(umask 077 && mkdir "$HGTMP") || { - echo "Could not create temporary directory! Exiting." 1>&2 - exit 1 +HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX) +[ x$HGTMP != x -a -d $HGTMP ] || { + echo "Could not create temporary directory! Exiting." 1>&2 + exit 1 } (