7 messages in com.perforce.perforce-user[p4] Preserving file permissions
FromSent OnAttachments
Richard Brooksby26 May 2000 03:23 
Jeff A. Bowles26 May 2000 07:29 
Richard Brooksby26 May 2000 07:40 
Scott Blachowicz26 May 2000 08:29 
John Metzger26 May 2000 08:43 
Fredric Fredricson26 May 2000 09:25 
Steve Cogorno26 May 2000 10:17 
Subject:[p4] Preserving file permissions
From:Jeff A. Bowles (ja@pobox.com)
Date:05/26/2000 07:29:06 AM
List:com.perforce.perforce-user

At 11:24 AM +0100 5/26/00, Richard Brooksby wrote:

We'd like to store some of our system configurations (files in /etc, /usr/local/etc, etc.) in Perforce so that we can:

- record changes and the reasons for them,

- restore after failure,

- move configuration from one piece of hardware to another, and

- compare configurations and share parts of them by branching.

We'd really like root to simply be able to do "p4 edit" to work on these files. The problem is that some of the files need special permissions. For example, /etc/master.passwd must be og-rwx. (Before anyone says anything, I'm well aware of the security implications of storing things like /etc/master.passwd in Perforce.)

There was a thread about this a while back which didn't come up with any really good solutiuons <http://maillist.perforce.com/pipermail/perforce-user/1998-September/001364.html>. Has anything changed since then, or has anyone come up with a better method?

I can't see a way to do this directly in Perforce, but...

There's a standard utility that was present for a long while (might still be there) on many Unix machines: "vipw" (and "edpw") for editing the password file. Its job was to put a "lock file" in place, change permissions, make backup files, etc.

Why not swipe that idea: "editsysfile passwd" would edit the password file, making its permissions appropriate for a "p4 edit" operation, doing "p4 edit", then dumping you into $EDITOR on the file, then checking in the change and setting the permissions back. (It could use its argument to know which file you're touching, so 'editsysfile motd' would do the appropriate thing, for example.)

Just a thought.

-Jeff Bowles Perforce Consulting Partner