Article View: news.software.nntp
Article #42104Re: Question regarding INN's use of the newsgroups file...
From: bill davidsen
Date: Mon, 13 Dec 1999 00:00
Date: Mon, 13 Dec 1999 00:00
43 lines
2474 bytes
2474 bytes
In article <87iu26kdcu.fsf@erlenstar.demon.co.uk>, Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: | >>>>> "Brad" == Brad Knowles <brad@shub-internet.org> writes: | | Brad> ln -f newsgroups.new newsgroups | | Brad> You can do this with processes that re-open the file each | Brad> time they need to access it, because the ln is an atomic | Brad> operation, | | no, actually, it's not. (ln -f uses separate unlink() and link() calls) | | The right way to do this is: | | ln -f newsgroups newsgroups.old | mv newsgroups.new newsgroups This may be implementation dependent. Looking at several UNIX implementations, I didn't see and statements that this is atomic, and only Linux promised (in the rename() system call) that the destination name would always be valid if it existed before the rename().\ On newer UNIX versions which have a rename() system call, I would bet the target is always valid, but I bet there's a moment where the old name is also valid. And on older versions, I'm pretty sure that mv would have to do an unlink of the 'newsgroups' file, a link of 'newsgroups.new' to 'newsgroups,' and then an unlink of 'newsgroups.new.' Reality is what the o/s does, not what POSIX or X/OPEN say should happen. BTW: I'm not disagreeing about mv being a good way to do the operation from a command line. I just don't think it's a foolproof as it might seem. -- bill davidsen <davidsen@tmr.com> CTO, TMR Associates, Inc When taking small children to a carnival, always have them go potty *before* you let them go on the rides, and let them eat all the junk food and candy *after*.
Technical Details
Message-ID:
<833gln$hn$1@newssvr02.news.prodigy.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<brad-80D295.16155910121999@news.skynet.be> <87iu26kdcu.fsf@erlenstar.demon.co.uk>Show Full Headers
Complete Article Headers
Message-ID: <833gln$hn$1@newssvr02.news.prodigy.com> Subject: Re: Question regarding INN's use of the newsgroups file... Date: Mon, 13 Dec 1999 00:00:00 +0000 From: davidsen@tmr.com (bill davidsen) References: <brad-80D295.16155910121999@news.skynet.be> <87iu26kdcu.fsf@erlenstar.demon.co.uk> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 560197753 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr02.news.prodigy.com 945112567 567 199.4.137.118 (13 Dec 1999 19:16:07 GMT) Organization: TMR Associates, Schenectady NY Newsgroups: news.software.nntp Originator: davidsen@darkstar.prodigy.com