All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] runltp - error when using another tmp folder
Date: Wed, 16 May 2018 11:10:07 +0200	[thread overview]
Message-ID: <20180516091007.GB7222@rei> (raw)
In-Reply-To: <20180502174621.6087aaea@windsurf>

Hi!
> Hum, I think the situation is a bit more complicated than that. The
> runltp code goes like this:
> 
>             export TMPBASE=$(readlink -f ${OPTARG}) ;;
> [...]
> 
>     # Added -m 777 for tests that call tst_tmpdir() and try to
>     #  write to it as user nobody
>     mkdir -m 777 -p $TMPBASE || \
>     {
>         echo "FATAL: Unable to make temporary directory $TMPBASE"
>         exit 1
>     }
>     # use mktemp to create "safe" temporary directories
>     export TMPTEMPLATE="${TMPBASE}/ltp-XXXXXXXXXX"
>     TMP=`mktemp -d $TMPTEMPLATE` || \
>     {
>         echo "FATAL: Unable to make temporary directory: $TMP"
>         exit 1
>     }
>     export TMP
>     # To be invoked by tst_tmpdir()
>     # write to it as user nobody
>     export TMPDIR=$TMP
> 
>     chmod 777 $TMP || \
>     {
>       echo "unable to chmod 777 $TMP ... aborting"
>       exit 1
>     }
> 
> So you've got two possible situations:
> 
>  (1) TMPBASE is an already existing directory. In this case, the "-m
>      777" argument in mkdir -m 777 -p $TMPBASE is useless because it is
>      only used by mkdir when the directory to be created doesn't exist
>      yet.
> 
>  (2) TMPBASE is not an existing directory. In this case, readlink will
>      return an empty string, and mkdir will fail because TMPBASE is
>      empty.

Actually you may pass a path with last nonexisting component and the
readlink -f will still work fine. Hence if you pass -d /tmp/nonexistent/
it will create the nonexistent directory with the mkdir there.

But that does not change the fact that runltp is user unfriendly with
it's options...

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2018-05-16  9:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 14:22 [LTP] runltp - error when using another tmp folder =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-05-02 15:46 ` Thomas Petazzoni
2018-05-16  9:10   ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180516091007.GB7222@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.