Re: [PATCH] commit: ensure correct permissions of the commit message
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 20, 2015, 14:21 UTC
- Message-ID
- <alpine.DEB.2.20.1512201519590.6483@virtualbox>
- In-Reply-To
- <20151220074559.GF30662@sigill.intra.peff.net>
Hi Peff,
On Sun, 20 Dec 2015, Jeff King wrote:
Show 11 quoted lines
> 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 <johannes.schindelin@gmx.de> > > I think this is probably a step forward, but I have to wonder how many > other files are in a similar situation (e.g., git-am state files, etc).
True.
Show 21 quoted lines
> I think people generally haven't noticed because shared repositories are
> generally about a shared bare rendezvous repo. So refs and objects are
> important, but we don't expect people to commit.
>
> 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;
> if (adjust_shared_perm(path)) {
> fclose(ret);
> return NULL;
> }
> return ret;
> }
>
> but of course the hard part is auditing all of the existing fopen()
> calls to see who needs to use it. :)In principle, I agree, but 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.
Ciao, Dscho