Xref: utzoo news.software.b:8521 news.software.readers:137 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!olivea!uunet!mcsun!ukc!stl!robobar!ronald From: ronald@robobar.co.uk (Ronald S H Khoo) Newsgroups: news.software.b,news.software.readers Subject: Re: Two queries regarding C-News (one of which also hits rn) Message-ID: <1991Jun29.183756.26741@robobar.co.uk> Date: 29 Jun 91 18:37:56 GMT References: <1991Jun28.084515.29919@panix.uucp> <1991Jun28.170745.6774@zoo.toronto.edu> <1991Jun29.104655.11340@panix.uucp> Followup-To: news.software.b Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 38 alexis@panix.uucp (Alexis Rosen) writes, in reply to henry@zoo.toronto.edu (Henry Spencer) who is: henry> also unhappy at the thought of the sheer number henry> of files that would need to have such lines sprinkled into them. alex> Would you please explain this? I'm willing to be convinced but I don't alex> see how this can be. You already know about chown and chmod from the alex> build script And you already know what the name of the news ID is. alex> What more do you need? One major problem with chown()ing as a solution is that you have to remember to do it after creating just about any file at all. Yuk. Half of the volume of the news scripts would end up being devoted to this. Another thing is that it doesn't seem elegant to choose a solution with all these nasty races, when the real solution is simply to ensure that all maintenance scripts are run as news. This has other advantages anyway. However, "there is no portable way" in which a script can determine who it's run as. test "`whoami`" = news || die_with_error_message seems conceptually right, but can be confused by multiple entries in /etc/passwd for news, and the fact that System V would need a "whoami" shell script: #!/bin/sh expr "`id`" : 'uid=[0-9]*(\([^)]*\))' which will break the next time that USL decides to change the output format of /bin/id. However, I'd like to see some form of "whoami" emulation anyway, because it's useful. -- Ronald Khoo +44 81 991 1142 (O) +44 71 229 7741 (H)