Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-06 Thread Johannes Schindelin
Hi Peff, On Wed, 6 Jan 2016, Jeff King wrote: > I think fopen_for_writing() is fine, or fopen_truncate(). I like fopen_for_writing() better than fopen_truncate() because it states the intention more clearly. Thanks! Dscho -- To unsubscribe from this list: send the line "unsubscribe git" in the

Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-06 Thread Jeff King
On Wed, Jan 06, 2016 at 09:20:34AM +0100, Johannes Schindelin wrote: > Hi Junio, > > On Tue, 5 Jan 2016, Junio C Hamano wrote: > > > If we want to follow the X_or_Y() pattern, fopen_or_create() may > > describe what it does better. I do not have strong preference either > > way, but again I am

Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-06 Thread Johannes Schindelin
Hi Junio, On Tue, 5 Jan 2016, Junio C Hamano wrote: > If we want to follow the X_or_Y() pattern, fopen_or_create() may > describe what it does better. I do not have strong preference either > way, but again I am not good at naming things (and I suspect you aren't > either), so... Heh... You got

Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-05 Thread Junio C Hamano
Johannes Schindelin writes: > Hi Junio, > > On Mon, 4 Jan 2016, Junio C Hamano wrote: > >> Johannes Schindelin writes: >> >> >> I do not know fcreate_or_truncate() is a good name, though. >> > >> > So what would be a good name? >> >> Have been thinking about it, but I did not come up with anyt

Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-05 Thread Johannes Schindelin
Hi Junio, On Mon, 4 Jan 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > >> I do not know fcreate_or_truncate() is a good name, though. > > > > So what would be a good name? > > Have been thinking about it, but I did not come up with anything. I > just know fcreate_or_truncate()

Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-04 Thread Junio C Hamano
Johannes Schindelin writes: >> I do not know fcreate_or_truncate() is a good name, though. > > So what would be a good name? Have been thinking about it, but I did not come up with anything. I just know fcreate_or_truncate() is not a good name for multiple reasons I already explained X-<. sane

Re: [PATCH] commit: ensure correct permissions of the commit message

2016-01-01 Thread Johannes Schindelin
Hi Junio, On Wed, 30 Dec 2015, Junio C Hamano wrote: > Johannes Schindelin writes: > > > So maybe > > > > fcreate_or_truncate(const char *path) > > { > > FILE *ret = fopen(path, "w"); > > > > if (!ret && errno == EPERM) { > > if (!unlink(pa

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-30 Thread Junio C Hamano
Johannes Schindelin writes: > So maybe > > fcreate_or_truncate(const char *path) > { >FILE *ret = fopen(path, "w"); > >if (!ret && errno == EPERM) { >if (!unlink(path)) >ret = fopen(path, "w"); >

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-30 Thread Johannes Schindelin
Hi Torsten, On Sun, 20 Dec 2015, Torsten Bögershausen wrote: > On 2015-12-20 15.21, Johannes Schindelin wrote: > > > I have to point out that the adjust_shared_perm() call must come after > > the *fclose()* call, to avoid modifying files to which we currently > > have open file handles. > > I ha

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-30 Thread Johannes Schindelin
Hi, On Mon, 21 Dec 2015, Junio C Hamano wrote: > Jeff King writes: > > > On Sun, Dec 20, 2015 at 05:31:48PM -0800, Junio C Hamano wrote: > > > >> we could do something like this, perhaps? > >> > >> FILE *fopen_forcibly(const char *path, const char *mode) > >> { > >>

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-21 Thread Junio C Hamano
Jeff King writes: > On Sun, Dec 20, 2015 at 05:31:48PM -0800, Junio C Hamano wrote: > >> Actually, we do not even _need_ a sharedness for this ephemeral >> file. The additional "adjust-shared-perm" is merely a workaround >> for the fact the next person cannot write into it when it is left >> beh

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-20 Thread Jeff King
On Sun, Dec 20, 2015 at 05:31:48PM -0800, Junio C Hamano wrote: > Actually, we do not even _need_ a sharedness for this ephemeral > file. The additional "adjust-shared-perm" is merely a workaround > for the fact the next person cannot write into it when it is left > behind, and because we do not

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-20 Thread Junio C Hamano
Jeff King writes: > So I don't have any real problem with this, but I suspect it's just the > tip of the iceberg. We might want something like: > > FILE *fopen_shared(const char *path, const char *mode) > { > FILE *ret = fopen(path, mode); > if (!ret) > return NULL;

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-20 Thread Torsten Bögershausen
On 2015-12-20 15.21, Johannes Schindelin wrote: > Hi Peff, > > On Sun, 20 Dec 2015, Jeff King wrote: > >> On Sat, Dec 19, 2015 at 07:21:59PM +0100, Johannes Schindelin wrote: >> >>> It was pointed out by Yaroslav Halchenko that the file containing the >>> commit message had the wrong permissions

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-20 Thread Johannes Schindelin
Hi Peff, On Sun, 20 Dec 2015, Jeff King wrote: > On Sat, Dec 19, 2015 at 07:21:59PM +0100, Johannes Schindelin wrote: > > > It was pointed out by Yaroslav Halchenko that the file containing the > > commit message had the wrong permissions in a shared setting. > > > > Let's fix that. > > > > Si

Re: [PATCH] commit: ensure correct permissions of the commit message

2015-12-19 Thread Jeff King
On Sat, Dec 19, 2015 at 07:21:59PM +0100, Johannes Schindelin wrote: > It was pointed out by Yaroslav Halchenko that the file containing the > commit message had the wrong permissions in a shared setting. > > Let's fix that. > > Signed-off-by: Johannes Schindelin I think this is probably a ste

[PATCH] commit: ensure correct permissions of the commit message

2015-12-19 Thread Johannes Schindelin
It was pointed out by Yaroslav Halchenko that the file containing the commit message had the wrong permissions in a shared setting. Let's fix that. Signed-off-by: Johannes Schindelin --- builtin/commit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/commit.c b/builtin/commit.c ind