Skip to contentSkip to conversation

mktemp command in runltp version issue

PATCH In review lina.zhao 2 participants 5 messages Sep 9, 2010 – Sep 13, 2010

lore
Share & tools
lore

lina.zhao

author
#0 lore raw

PATCH 1/1 mktemp command in runltp version issue

Hi,

In runltp:

if [ -n "$DEVICE" ]; then

      mnt_pnt=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. The valid option to specify a directory for version 1.5 is -p directory.

Regards,

Lina Zhao

From 5e5ff93aa2a9d7ae7325b2813092efdb7d19a043 Mon Sep 17 00:00:00 2001
From: Lina Zhao <[email protected]>
Date: Thu, 9 Sep 2010 14:12:14 +0800
Subject: [PATCH] mktemp version issue in runltp

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. The valid option to specify a directory for version 1.5 is
-p directory.

---
 runltp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
runltp +1 -1
index b385984..ddfd666 100755
@@ -716,7 +716,7 @@ main()
     fi
 
     if [ -n "$DEVICE" ]; then
-        mnt_pnt=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`
+        mnt_pnt=`mktemp -d -p ${TMP} mnt_pnt.XXXXXX`
         if [ -n "$DEVICE_FS_TYPE" ]; then
             mount -t $DEVICE_FS_TYPE $DEVICE $mnt_pnt
         else
Signature · 1 line
1.6.3.1

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 10 lines · lina.zhao

Hi,

In runltp:

if [ -n "$DEVICE" ]; then

     mnt_pnt=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. The valid option to specify a directory for version 1.5 is -p directory.

Or just remove --tmpdir=<blah> altogether? If $TMPDIR is defined in the environment, then it is the fallback if --tmpdir / -p isn't specified (please see the manpage for more details)... OR... just do:

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX

The same change will probably need to be applied to the runltp lite script.

Cheers,
-Garrett

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw

but $TMPDIR may not be defined in the environment, so we need --tmpdir / -p to specify the directory
-p is support on most of versions.

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX doesn't work well

lina@lina-desktop:~$  export TMP=/home/lina/tmp/
lina@lina-desktop:~$ mktemp -d $TMP/mnt_pnt.XXXXXX
/home/lina/tmp//mnt_pnt.i12144
lina@lina-desktop:~$ mktemp -d -p $TMP mnt_pnt.XXXXXX
/home/lina/tmp/mnt_pnt.Q12146

if $TMP include / in end, then there will be 2 // for the temp file

Quoted 17 lines · lina.zhao
Quoted 11 lines

Hi,

In runltp:

if [ -n "$DEVICE" ]; then

     mnt_pnt=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. The valid option to specify a directory for version 1.5 is -p directory.

Or just remove --tmpdir=<blah> altogether? If $TMPDIR is defined in the environment, then it is the fallback if --tmpdir / -p isn't specified (please see the manpage for more details)... OR... just do:

Quoted 8 lines

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX

The same change will probably need to be applied to the runltp lite script.

Cheers,
-Garrett

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 2 lines · lina.zhao

but $TMPDIR may not be defined in the environment, so we need --tmpdir / -p to specify the directory

export TMPDIR=$TMP

Done.

Quoted 1 line

-p is support on most of versions.

The key word you used there is `most'. We need to support all logical versions of mktemp, which means that it needs to work for about all of them (I don't care about package versions from back in the kernel 2.4.x days too terribly much, and the other earlier versions, i.e. 2.2, etc, are a non-issue).

Quoted 9 lines

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX doesn't work well

lina@lina-desktop:~$  export TMP=/home/lina/tmp/
lina@lina-desktop:~$ mktemp -d $TMP/mnt_pnt.XXXXXX
/home/lina/tmp//mnt_pnt.i12144
lina@lina-desktop:~$ mktemp -d -p $TMP mnt_pnt.XXXXXX
/home/lina/tmp/mnt_pnt.Q12146

if $TMP include / in end, then there will be 2 // for the temp file

So... what's the issue if there are 2 or more slashes? FWIW that issue is extremely easy to work around anyhow...

TMP=dirname $TMP/GARBAGE

(GARBAGE is required so that it maintains the desired contents in $TMP)

Quoted 13 lines
Quoted 13 lines · lina.zhao
Quoted 11 lines

Hi,

In runltp:

if [ -n "$DEVICE" ]; then
    mnt_pnt=mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. The valid option to specify a directory for version 1.5 is -p directory.

Quoted 8 lines
Quoted 8 lines

Or just remove --tmpdir=<blah> altogether? If $TMPDIR is defined in the environment, then it is the fallback if --tmpdir / -p isn't specified (please see the manpage for more details)... OR... just do:

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX

The same change will probably need to be applied to the runltp lite script.

Simple universal solutions are what I seek :). See if either of the two suggestions I provided above meets your approval (and FWIW if we change TMP to TMPDIR, stuff might start working a lot better in LTP because TMPDIR is the standard variable used for mktemp, not $TMP, etc that we define in the environment).

Cheers,
-Garrett

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#4 lore raw

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX works well.

please check the patch.

Quoted 64 lines · lina.zhao
Quoted 4 lines

but $TMPDIR may not be defined in the environment, so we need --tmpdir / -p to specify the directory

export TMPDIR=$TMP

Done.

Quoted 2 lines

-p is support on most of versions.

The key word you used there is `most'. We need to support all logical versions of mktemp, which means that it needs to work for about all of them (I don't care about package versions from back in the kernel 2.4.x days too terribly much, and the other earlier versions, i.e. 2.2, etc, are a non-issue).

Quoted 10 lines

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX doesn't work well

lina@lina-desktop:~$  export TMP=/home/lina/tmp/
lina@lina-desktop:~$ mktemp -d $TMP/mnt_pnt.XXXXXX
/home/lina/tmp//mnt_pnt.i12144
lina@lina-desktop:~$ mktemp -d -p $TMP mnt_pnt.XXXXXX
/home/lina/tmp/mnt_pnt.Q12146

if $TMP include / in end, then there will be 2 // for the temp file

So... what's the issue if there are 2 or more slashes? FWIW that issue is extremely easy to work around anyhow...

TMP=dirname $TMP/GARBAGE

(GARBAGE is required so that it maintains the desired contents in $TMP)

Quoted 18 lines
Quoted 18 lines · lina.zhao
Quoted 4 lines

Hi,

Quoted 9 lines

In runltp:

if [ -n "$DEVICE" ]; then

    mnt_pnt=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. The valid option to specify a directory for version 1.5 is -p directory.

Or just remove --tmpdir=<blah> altogether? If $TMPDIR is defined in the environment, then it is the fallback if --tmpdir / -p isn't specified (please see the manpage for more details)... OR... just do:

Quoted 5 lines
Quoted 5 lines

mnt_pnt=mktemp -d $TMP/mnt_pnt.XXXXXX

The same change will probably need to be applied to the runltp lite script.

Quoted 10 lines

Simple universal solutions are what I seek :). See if either of the two suggestions I provided above meets your approval (and FWIW if we change TMP to TMPDIR, stuff might start working a lot better in LTP because TMPDIR is the standard variable used for mktemp, not $TMP, etc that we define in the environment).

Cheers,
-Garrett

From 08de712ef1ada48353c2c0b782e2089a3fdb7263 Mon Sep 17 00:00:00 2001
From: Lina Zhao <[email protected]>
Date: Mon, 13 Sep 2010 15:59:55 +0800
Subject: [PATCH] mktemp version issue in runltp

--tmpdir is a invalid option for mktemp version 1.5, which is used widely. mktemp with no special directory argument works well.

---
 runltp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
runltp +1 -1
index b385984..04c16af 100755
@@ -716,7 +716,7 @@ main()
     fi
 
     if [ -n "$DEVICE" ]; then
-        mnt_pnt=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`
+        mnt_pnt=`mktemp -d $TMP/mnt_pnt.XXXXXX`
         if [ -n "$DEVICE_FS_TYPE" ]; then
             mount -t $DEVICE_FS_TYPE $DEVICE $mnt_pnt
         else
Signature · 1 line
1.6.3.1

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list