delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/04/16/07:47:29

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>, djgpp-workers AT delorie DOT com
Subject: Re: Fileutils 4.1 alpha 1 uploaded
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1020416090634 DOT 14169D AT is>
In-Reply-To: <Pine.SUN.3.91.1020416090634.14169D@is> (Eli Zaretskii's message of "Tue, 16 Apr 2002 09:11:44 +0300 (IDT)")
From: Jim Meyering <jim AT meyering DOT net>
Date: Tue, 16 Apr 2002 13:47:20 +0200
Message-ID: <87k7r7hnlj.fsf@pixie.eng.ascend.com>
Lines: 43
User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu)
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:

> On Mon, 15 Apr 2002, Richard Dawe wrote:
>
>> > How does my creation of a stem.$$ temporary _directory_ (in the current
>> > directory) cause trouble?  AFAICS (for the few tests I looked at), there
>> > is no risk that more than one of those little scripts will run at the
>> > same time, so there shouldn't be a problem on that front.
>>
>> Some of the tests do not delete the directories the create.
>
> That rings a bell: DOS and some versions of Windows won't let you delete
> the directory that's the current directory on some drive, even if you do
> that from another drive.  The trick to overcome that is to chdir to the
> root directory on that drive before removing the temporary directory.
>
> I'm not sure this problem is relevant to the case in point, since I
> understood from Jim's message that the test suite creates the temporary
> directories where you run the suite, not under $TMPDIR (which can
> typically be on a different drive).  But I thought I'd mention this
> caveat anyway, in case some of the tests do use $TMPDIR.
>
> Normally, the "trap ... rm ..." parts of many scripts are vulnerable to
> this problem.

Right.
That's why newer tests should all have code like this:

  pwd=`pwd`
  tmp=FIXME.$$
  trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
  trap '(exit $?); exit' 1 2 13 15

  framework_failure=0
  mkdir $tmp || framework_failure=1
  cd $tmp || framework_failure=1

  ...

  (exit $fail); exit

I'm sure some of the older test scripts don't do it right.
If you find some, please let me know.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019