🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #158

Re: file locking in shell scripts

#158
From: Chet Ramey
Date: Mon, 27 Jul 1992 12:21
17 lines
1358 bytes
In article <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu> friedman@gnu.ai.mit.edu (Noah Friedman) writes:

>suggest a patch to bash that will make the noclobber feature a little more
>reliable (it presently does a stat and then an open, which results in a
>race condition), and then it will be possible to do the following safely:

Race condition or no, the call to stat has to be in there.  Noclobber works
only for regular files, and this has to be checked before an open is
attempted.  Were this check not in there, you'd find that after setting
-o noclobber you'd no longer be able to redirect anything to /dev/null.

Chet
-- 
``The use of history as therapy means the corruption of history as history.''
	-- Arthur Schlesinger

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu
Technical Details
Message-ID: <1992Jul27.122124.28325@usenet.ins.cwru.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!usenet.ins.cwru.edu!odin!chet
References: <1992Jul23.124327.20843@cv.ruu.nl> <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!usenet.ins.cwru.edu!odin!chet
From: chet@odin.INS.CWRU.Edu (Chet Ramey)
Subject: Re: file locking in shell scripts
Message-ID: <1992Jul27.122124.28325@usenet.ins.cwru.edu>
Sender: news@usenet.ins.cwru.edu
Nntp-Posting-Host: odin.ins.cwru.edu
Organization: Case Western Reserve University, Cleveland, OH (USA)
References: <1992Jul23.124327.20843@cv.ruu.nl> <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu>
Date: Mon, 27 Jul 92 12:21:24 GMT
Lines:       18