From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] tst_test.sh: Remove possible double/trailing slashes from TMPDIR
Date: Thu, 13 Apr 2023 10:02:10 +0200 [thread overview]
Message-ID: <20230413080210.GB2072620@pevik> (raw)
In-Reply-To: <CAEemH2eGHMkUCZXJRmPBXM=qqVFA37eyEecNb8cn6j_F3dSO2g@mail.gmail.com>
> On Wed, Apr 12, 2023 at 3:40 PM Petr Vorel <pvorel@suse.cz> wrote:
> > NFS tests have problem when TMPDIR path contains double slashes,
> > because they grep exportfs output which is normalized.
> I'm ok to remove redundant slashes, I just wondering where
> is the second slash comes from?
> Is that added by accident when env variable definition?
Yes, that's the last slash in TMPDIR=/var/tmp/.
TMPDIR=/var/tmp would work.
Kind regards,
Petr
> > Problem is either trailing slash:
> > $ TMPDIR=/var/tmp/ nfs01.sh -t tcp
> > ...
> > nfs01 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=3 10.0.0.2:/var/tmp//LTP_nfs01.sIqm4LLS4u/3/tcp
> > /var/tmp//LTP_nfs01.sIqm4LLS4u/3/0
> > nfs01 1 TINFO: starting 'nfs01_open_files 1000'
> > nfs01 1 TPASS: test finished successfully
> > nfs01 2 TINFO: Cleaning up testcase
> > nfs01 2 TINFO: remote_dir: '/var/tmp//LTP_nfs01.sIqm4LLS4u/3/tcp'
> > exportfs: Could not find '*:/var/tmp//LTP_nfs01.sIqm4LLS4u/3/tcp' to
> > unexport.
> > rm: cannot remove '/var/tmp//LTP_nfs01.sIqm4LLS4u/3/0': Device or resource
> > busy
> > rm: cannot remove '/var/tmp//LTP_nfs01.sIqm4LLS4u/3/0': Is a directory
> > or double (or more) slashes (anywhere in $TMPDIR):
> > $ TMPDIR=/var//tmp nfs01.sh -t tcp
> > nfs01 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=3 10.0.0.2:/var//tmp/LTP_nfs01.qNjSsopVbY/3/tcp
> > /var//tmp/LTP_nfs01.qNjSsopVbY/3/0
> > nfs01 1 TINFO: starting 'nfs01_open_files 1000'
> > nfs01 1 TPASS: test finished successfully
> > nfs01 2 TINFO: Cleaning up testcase
> > nfs01 2 TINFO: remote_dir: '/var//tmp/LTP_nfs01.qNjSsopVbY/3/tcp'
> > exportfs: Could not find '*:/var//tmp/LTP_nfs01.qNjSsopVbY/3/tcp' to
> > unexport.
> > rm: cannot remove '/var//tmp/LTP_nfs01.qNjSsopVbY/3/0': Device or resource
> > busy
> > rm: cannot remove '/var//tmp/LTP_nfs01.qNjSsopVbY/3/0': Is a directory
> > While this could be handled in nfs_lib.sh, it's better to save it for
> > all tests. It's easier to modify $TST_TMPDIR, because the problem
> > narrows down to double slash.
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > testcases/lib/tst_test.sh | 2 ++
> > 1 file changed, 2 insertions(+)
> > diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> > index c817eec77..42f60ab58 100644
> > --- a/testcases/lib/tst_test.sh
> > +++ b/testcases/lib/tst_test.sh
> > @@ -722,6 +722,8 @@ tst_run()
> > fi
> > TST_TMPDIR=$(mktemp -d "$TMPDIR/LTP_$TST_ID.XXXXXXXXXX")
> > + # remove possible trailing slash or double slashes from
> > TMPDIR
> > + TST_TMPDIR=$(echo "$TST_TMPDIR" | sed 's~/\+~/~g')
> > chmod 777 "$TST_TMPDIR"
> > --
> > 2.40.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-04-13 8:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 7:39 [LTP] [PATCH 1/1] tst_test.sh: Remove possible double/trailing slashes from TMPDIR Petr Vorel
2023-04-12 7:41 ` Petr Vorel
2023-04-13 7:57 ` Li Wang
2023-04-13 8:02 ` Petr Vorel [this message]
2023-04-13 8:20 ` Li Wang
2023-04-26 17:29 ` Petr Vorel
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=20230413080210.GB2072620@pevik \
--to=pvorel@suse.cz \
--cc=liwang@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox