From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,80b3e504140e89fd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-24 10:13:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Config_Files proposal Date: 24 Jun 2002 13:09:15 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3D0FAC67.A4861809@san.rr.com> <3D10B6B1.AFE9D4E8@san.rr.com> <3D10E046.E604231D@san.rr.com> <3D1204B5.4620F160@san.rr.com> <3D1215A8.719D39C5@nbi.dk> <3D123852.1040508@san.rr.com> <3D1289D2.9090107@telepath.com> <3D134669.5070000@san.rr.com> <3D173599.C515EE53@san.rr.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1024938993 604 128.183.220.71 (24 Jun 2002 17:16:33 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 24 Jun 2002 17:16:33 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:26659 Date: 2002-06-24T17:16:33+00:00 List-Id: Darren New writes: > Stephen Leake wrote: > > That's what happens when you run two copies of the text editor, change > > the same source file in both, and save from both. One set of changes > > is lost. > > Well, maybe in *your* editors, based on file systems as horrificly bad as > UNIX. ;-) > > > Why should config files be different? > > Because reading a config file and writing a config file are both invisible > operations, as far as the user is concerned. > > > Hmm, one answer is "because the config file is hidden". That makes > > sense; we can expect the user to be aware of loading the same source > > file into to copies of the text editor, but not immediately aware of > > sharing one config file between the two copies of the text editor. > > Exactly. And there are commands to save the files and to load the files. > > > But I still think the right answer in this case is one of: > > "use a better (multi-document) text editor". > > "use the registry for resources shared by multiple processes". > > "use separate config files for separate instances of applications" > > What's wrong with #4 - merge changes into the most recent config file, > rather than just overwriting it? Because you need "real locks", and you need to guard against all the possible race conditions. The registry already does that. When _any_ other process may write to the config file at _any_ time, it is not possible to define "the most recent config file". You have to lock it to get exclusive access, then merge your changes. What's wrong with the answers I gave (besides "I don't like them" :)? > How about when you go to save the new config file, you check the > size/date/checksum/contents/whatever against what it was when you > loaded it, and you throw an exception if it's different, *unless* > the overwrite flag is set? Then those who want to merge the changes > can do so "manually" in their code? If we want to support this scenario (multiple processes reading and writing to shared config file), we need "real locks". We also need "real notification" so apps know when the config files have changed. "real locks" is doable on most reasonable OSes, it's just complicated. "real notification" is much harder. The registry already does both. In light of Robert Eachus's post, I need to play with implementing at least an exclusive read/write lock on a config file. When I do that, I'll see how hard it would be to do the "merge changes when write" approach. Maybe that will be easy to add. -- -- Stephe