linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Benno Schulenberg <bensberg@justemail.net>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] tests: for mktemp the exes must be the final characters of the name
Date: Wed, 4 Jun 2014 23:28:11 -0400	[thread overview]
Message-ID: <20140605032811.GC21061@thunk.org> (raw)
In-Reply-To: <850D72EC-599B-458C-BBE1-22E6A0F74E92@dilger.ca>

On Wed, Jun 04, 2014 at 04:31:21PM -0600, Andreas Dilger wrote:
> On Jun 4, 2014, at 6:28 AM, Benno Schulenberg <bensberg@justemail.net> wrote:
> > Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
> > ---
> > tests/scripts/resize_test |    2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/tests/scripts/resize_test b/tests/scripts/resize_test
> > index c9a7a1c..1e5756c 100755
> > --- a/tests/scripts/resize_test
> > +++ b/tests/scripts/resize_test
> > @@ -21,7 +21,7 @@ if truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
> > 	echo "using $TMPFILE" >> $LOG
> > else
> > 	rm $TMPFILE
> > -	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.XXXXXX.tmp)
> > +	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.tmp.XXXXXX)
> 
> The goal was that the temporary file ended with ".tmp" so that it would
> be removed by "make clean" in case the test fails or is interrupted, so
> it would be good to update the "make clean" rules to find these files.

The problem is that using a template where the XXXXXX is in the middle
of the file name is a GNU coreutils extension.  It's not supported by
Mac OSX, *BSD's, and Ubuntu 10.04 and before (and presumably similar
vintage enterprise distros).

With older coreutils, "mktemp /tmp/foo.XXXXXX.bar" will out and out
fail.  That's what Benno noticed.  On OSX, "mktemp
/tmp/foo.XXXXXX.bar" will return /tmp/foo.XXXXXX.bar, unless that file
already exists, in which case it will bomb out.

If the goal is to make sure we remove temporary files, what we can do
is to use a template of "/tmp/e2fs-$test_name-tmp.XXXXXX", and then
include "rm /tmp/e2fs-*-tmp.???????" in the "make clean" rule.

Cheers,

						- Ted


  reply	other threads:[~2014-06-05  3:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 12:28 [PATCH] tests: for mktemp the exes must be the final characters of the name Benno Schulenberg
2014-06-04 22:31 ` Andreas Dilger
2014-06-05  3:28   ` Theodore Ts'o [this message]
2014-06-09 14:49   ` Theodore Ts'o
2014-06-09 14:50     ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Theodore Ts'o
2014-06-09 14:50       ` [PATCH 2/2] tests: clean up the temp file if test_one is interrupted Theodore Ts'o
2014-06-09 20:34       ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Andreas Dilger
2014-06-09 23:45         ` Theodore Ts'o
2014-06-10  0:47           ` Andreas Dilger
2014-06-10  1:41             ` Theodore Ts'o

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=20140605032811.GC21061@thunk.org \
    --to=tytso@mit.edu \
    --cc=adilger@dilger.ca \
    --cc=bensberg@justemail.net \
    --cc=linux-ext4@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).