🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #42126

Re: Question regarding INN's use of the newsgroups file...

#42126
From: Andrew Gierth
Date: Mon, 13 Dec 1999 00:00
48 lines
2635 bytes
>>>>> "bill" == bill davidsen <davidsen@tmr.com> writes:

 > | The right way to do this is:
 > | 
 > | ln -f newsgroups newsgroups.old
 > | mv newsgroups.new newsgroups

 bill>   This may be implementation dependent.

Only in the sense that _very_ old implementations may not provide
the necessary guarantee.

The single unix spec says this:

    If the link named by the new argument exists, it is removed and
    old renamed to new. In this case, a link named new will remain
    visible to other processes throughout the renaming operation and
    will refer either to the file referred to by new or old before the
    operation began

which I believe it adopted directly from the POSIX spec.

(That guarantee, and the ability to rename directories, are the only
reasons for the rename() syscall to exist at all.)

 bill> Looking at several UNIX implementations, I didn't see and
 bill> statements that this is atomic, and only Linux promised (in the
 bill> rename() system call) that the destination name would always be
 bill> valid if it existed before the rename().\

You'll find that same promise in the rename() docs of virtually every
system (it's there in FreeBSD and Solaris, for example, and I remember
it from older systems like SCO 3.2v4, HP-UX 9, and AIX 3.2).

 bill>   On newer UNIX versions which have a rename() system call,

(where "newer" means "less than 12 years old")

 bill> I would bet the target is always valid, but I bet there's a
 bill> moment where the old name is also valid.

I don't think it's possible to tell. (i.e. see if you can find a code
path that would produce different results)

-- 
Andrew.

Technical Details
Message-ID: <87emcq7cvm.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
References: <brad-80D295.16155910121999@news.skynet.be> <87iu26kdcu.fsf@erlenstar.demon.co.uk> <833gln$hn$1@newssvr02.news.prodigy.com>

Show Full Headers
Complete Article Headers
Message-ID: <87emcq7cvm.fsf@erlenstar.demon.co.uk>
Subject: Re: Question regarding INN's use of the newsgroups file...
Date: Mon, 13 Dec 1999 00:00:00 +0000
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
References: <brad-80D295.16155910121999@news.skynet.be> <87iu26kdcu.fsf@erlenstar.demon.co.uk> <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-mail
X-Deja-AN: 560251497
X-Mayan-Date: Long count = 12.19.6.14.1; tzolkin = 3 Imix; haab = 9 Mac
X-Complaints-To: andrew@erlenstar.demon.co.uk
Organization: disorganised
X-Attribution: AG
X-Pgp-0x0E9FFBE9: 87 25 7F 14 41 24 B3 51 E0 19 8B DE 49 74 0C 29
X-P-Persistent-Headers: are a bad idea.
Newsgroups: news.software.nntp
X-Post-Filter: postfilter v0.6 alpha