Re: Bug: git config does not respect read-only .gitconfig file

2016-11-09 Thread Jonathan Word
> It is unreasonable to drop the write-enable bit of > a file in a writable directory and expect it to stay unmodified. The > W-bit on the file is not usable as a security measure, and we do not > use it as such. The point here is not a matter of security - it is of expectations. When a user drop

Re: Bug: git config does not respect read-only .gitconfig file

2016-11-08 Thread Jeff King
On Tue, Nov 08, 2016 at 05:22:52PM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Probably converting "rename(from, to)" to first check "access(to, > > W_OK)". That's racy, but it's the best we could do. > > Hmph, if these (possibly problematic) callers are all following the > usual "lo

Re: Bug: git config does not respect read-only .gitconfig file

2016-11-08 Thread Junio C Hamano
Jeff King writes: > Probably converting "rename(from, to)" to first check "access(to, > W_OK)". That's racy, but it's the best we could do. Hmph, if these (possibly problematic) callers are all following the usual "lock, write to temp, rename" pattern, perhaps the lock_file() function can have a

Re: Bug: git config does not respect read-only .gitconfig file

2016-11-08 Thread Jeff King
On Tue, Nov 08, 2016 at 12:18:22PM -0500, Jonathan Word wrote: > The point of confusion to users ( / my team) is that `git config` > gives the appearance of editing / modifying the .gitconfig file > in-place (where file permissions would be respected) however the > actual implementation performs t

Re: Bug: git config does not respect read-only .gitconfig file

2016-11-08 Thread Jonathan Word
I proposed a variant that would be fully backwards-compatible (don't know who might rely on the functionality http://xkcd.com/1172/ ) however I'd be happy to see the change without additional config +1 ... that's a call for this list as maintainers. The root of the issue is that tempfile::rename_t

Re: Bug: git config does not respect read-only .gitconfig file

2016-11-08 Thread Markus Hitter
Am 08.11.2016 um 16:22 schrieb Jonathan Word: > Proposal: > > Part 1) Add a .gitconfig variable to respect a read-only gitconfig > file and optional "--force" override option for the `git config` > command > > Such a gitconfig variable could be defined as: > config.respectFileMode: [ "never", "al

Bug: git config does not respect read-only .gitconfig file

2016-11-08 Thread Jonathan Word
All, I recently discovered that `git config` does not respect read-only files. This caused unexpected difficulty in managing the global .gitconfig for a system account shared by a large team. A team member was able to execute a `git config --global` command without any notice or warning that the