[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Redirections and noclobber



On Wed, Oct 06, 2004 at 06:19:35PM +0200, Bill Allombert wrote:
> On Wed, Oct 06, 2004 at 05:02:00PM +0200, Frank Küster wrote:
> > Hi,
> > 
> > in bug #275140, I was made aware of a problem with the handling of
> > tempfiles in tetex's maintainer scripts, and it seems to be a general
> > problem. Basically, we do
> > 
> > tempfile=`mktemp`
> > echo something > $tempfile
> > 
> > and this will fail if the noclobber option is set in the executing
> > shell, because after mktemp the $tempfile exists. 
> > 
> > It is easy to fix this:
> > 
> > echo something >| $tempfile
> > 
> > but both I and the bug submitter were puzzled that we didn't find any
> > previous discussions about the topic. Obviously, noclobber is only
> > rarely used (otherwise we would have gotten bugreports earlier), but I
> > see no reason, neither in Policy nor in "common sense", why root
> > shouldn't use it. On the other hand, this usage of mktemp has been
> > the result of discussions on debian-tetex-maint@l.d.o, and I'm quite
> > sure to have seen it elsewhere.
> 
> In my opinion, noclobber should only be set for interactive shell, or
> explicitely in a shell-script. The same for most others shell options.
> 
> Now, does POSIX sh support >|  ?

Yes.


Regards: David Weinehall
-- 
 /) David Weinehall <tao@acc.umu.se> /) Northern lights wander      (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/    (/   Full colour fire           (/



Reply to: