<div class="gmail_quote">On Sat, Oct 30, 2010 at 12:43 AM, Paul Menzel <span dir="ltr"><<a href="mailto:paulepanter@users.sourceforge.net">paulepanter@users.sourceforge.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Am Samstag, den 30.10.2010, 02:16 +0200 schrieb Carl-Daniel Hailfinger:<br>
<div class="im">> Use mktemp unconditionally for security reasons.<br>
> Avoid non-portable seq.<br>
><br>
> Signed-off-by: Carl-Daniel Hailfinger <<a href="mailto:c-d.hailfinger.devel.2006@gmx.net">c-d.hailfinger.devel.2006@gmx.net</a>><br>
><br>
> Index: flashrom-torturescript_portability/util/flashrom_partial_write_test.sh<br>
> ===================================================================<br>
> --- flashrom-torturescript_portability/util/flashrom_partial_write_test.sh    (Revision 1219)<br>
> +++ flashrom-torturescript_portability/util/flashrom_partial_write_test.sh    (Arbeitskopie)<br>
> @@ -34,8 +34,12 @@<br>
>  echo "testing flashrom binary: ${FLASHROM}"<br>
><br>
>  OLDDIR=$(pwd)<br>
> -if [ -z "$TMPDIR" ]; then<br>
> -     TMPDIR=$(mktemp -d)     # test data location<br>
> +<br>
> +# test data location<br>
> +TMPDIR=$(mktemp -d -t flashrom_test.XXXXXXXXXX)<br>
> +if [ "$?" != "0" ] ; then<br>
> +     echo "Could not create temporary directory"<br>
<br>
</div>Full stop at the end.<br>
<br>
Is `mktemp` always installed? If not will there be an error message –<br>
passed down from Bash – indicating that it needs to be installed?<br></blockquote><div><br></div><div>No... it will simply tell the user "Could not create temporary directory."</div><div><br></div><div>How about we re-factor the mktemp check as such:</div>

<div><div><font class="Apple-style-span" face="'courier new', monospace"># create location to store temporary data for test usage</font></div><div><font class="Apple-style-span" face="'courier new', monospace">TMPDIR=$(mktemp -d -t flashrom_test.XXXXXXXXXX)</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">if [ "$?" != "0" ] ; then</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">   </font></span><font class="Apple-style-span" face="'courier new', monospace">echo "Could not create temporary directory"</font></div>

<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">     </font></span><font class="Apple-style-span" face="'courier new', monospace">which mktemp > /dev/null</font></div>

<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">     </font></span><font class="Apple-style-span" face="'courier new', monospace">if [ "$?" != "0" ] ; then</font></div>

<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">             </font></span><font class="Apple-style-span" face="'courier new', monospace">echo "mktemp not found"</font></div>

<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">     </font></span><font class="Apple-style-span" face="'courier new', monospace">fi</font></div>

<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">     </font></span><font class="Apple-style-span" face="'courier new', monospace">exit $EXIT_FAILURE</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">fi</font></div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
> +     exit $EXIT_FAILURE<br>
>  fi<br>
><br>
>  ZERO_4K="00_4k.bin"<br>
> @@ -65,8 +69,10 @@<br>
><br>
>  # Make 4k worth of 0xff bytes<br>
>  echo "begin 640 $FF_4K" > "$FF_4K_TEXT"<br>
> -for i in `seq 0 90` ; do<br>
> +i=0<br>
> +while [ $i -le 90 ] ; do<br>
>       echo "M____________________________________________________________" >> "$FF_4K_TEXT"<br>
> +     i=$((${i} + 1))<br>
>  done<br>
>  echo "!_P``" >> "$FF_4K_TEXT"<br>
>  echo "\`" >> "$FF_4K_TEXT"<br>
<br>
<br>
</div>Thanks,<br>
<font color="#888888"><br>
Paul<br>
</font><br>_______________________________________________<br>
flashrom mailing list<br>
<a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a><br>
<a href="http://www.flashrom.org/mailman/listinfo/flashrom" target="_blank">http://www.flashrom.org/mailman/listinfo/flashrom</a><br></blockquote></div><br><br clear="all"><br>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.<br>