From: "Torsten Bögershausen" <tboegi@web.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Jeff King <peff@peff.net>
Cc: "Junio C Hamano" <gitster@pobox.com>,
git@vger.kernel.org, "Yaroslav Halchenko" <yoh@onerussian.com>,
"SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [PATCH] commit: ensure correct permissions of the commit message
Date: Sun, 20 Dec 2015 23:57:40 +0100 [thread overview]
Message-ID: <56773264.2050806@web.de> (raw)
In-Reply-To: <alpine.DEB.2.20.1512201519590.6483@virtualbox>
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 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.
>
>> 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.
I had the same concern, but couldn't find anything that gives a hint that we
can't adjust
the permissions on an open file.
(In opposite: We can't rename an open file (under Windows))
In fact we have this in tempfile.c
int create_tempfile(struct tempfile *tempfile, const char *path)
{
prepare_tempfile_object(tempfile);
strbuf_add_absolute_path(&tempfile->filename, path);
tempfile->fd = open(tempfile->filename.buf, O_RDWR | O_CREAT | O_EXCL, 0666);
if (tempfile->fd < 0) {
strbuf_reset(&tempfile->filename);
return -1;
}
tempfile->owner = getpid();
tempfile->active = 1;
if (adjust_shared_perm(tempfile->filename.buf)) {
[snip] Error out
(And this seems to be the same in git.git and git-for-windows)
next prev parent reply other threads:[~2015-12-20 22:58 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-19 18:21 [PATCH] commit: ensure correct permissions of the commit message Johannes Schindelin
2015-12-20 7:45 ` Jeff King
2015-12-20 14:21 ` Johannes Schindelin
2015-12-20 22:57 ` Torsten Bögershausen [this message]
2015-12-30 14:57 ` Johannes Schindelin
2015-12-21 1:31 ` Junio C Hamano
2015-12-21 6:59 ` Jeff King
2015-12-21 17:22 ` Junio C Hamano
2015-12-30 14:50 ` Johannes Schindelin
2015-12-30 22:56 ` Junio C Hamano
2016-01-01 15:04 ` Johannes Schindelin
2016-01-04 18:34 ` Junio C Hamano
2016-01-05 12:52 ` Johannes Schindelin
2016-01-05 19:39 ` Junio C Hamano
2016-01-06 8:20 ` Johannes Schindelin
2016-01-06 8:23 ` Jeff King
2016-01-06 8:50 ` Johannes Schindelin
2016-01-15 1:12 ` SZEDER Gábor
2016-01-15 1:29 ` Junio C Hamano
2016-01-15 6:51 ` Johannes Schindelin
2016-01-15 10:51 ` SZEDER Gábor
2016-01-15 12:18 ` Johannes Schindelin
2016-01-06 13:09 ` [PATCH v2 0/2] Correctly handle transient files in shared repositories Johannes Schindelin
2016-01-06 13:09 ` [PATCH v2 1/2] commit: allow editing the commit message even in shared repos Johannes Schindelin
2016-01-07 12:41 ` Jeff King
2016-01-07 21:35 ` Junio C Hamano
2016-01-06 13:09 ` [PATCH v2 2/2] Handle more file writes correctly " Johannes Schindelin
2016-01-07 12:46 ` Jeff King
2016-01-08 16:04 ` Johannes Schindelin
2016-01-07 21:52 ` Junio C Hamano
2016-01-08 16:05 ` Johannes Schindelin
2016-01-08 17:59 ` Junio C Hamano
2016-01-11 9:28 ` Johannes Schindelin
2016-01-11 15:57 ` Junio C Hamano
2016-01-11 17:06 ` Junio C Hamano
2016-01-11 18:35 ` [PATCH v3 0/2] Correctly handle transient files in shared repositories Johannes Schindelin
2016-01-11 18:35 ` [PATCH v3 1/2] commit: allow editing the commit message even in shared repos Johannes Schindelin
2016-01-11 18:35 ` [PATCH v3 2/2] Handle more file writes correctly " Johannes Schindelin
2016-01-11 20:22 ` [PATCH v3 0/2] Correctly handle transient files in shared repositories Jeff King
2016-01-11 21:12 ` Junio C Hamano
2016-01-11 21:22 ` Junio C Hamano
2016-01-11 21:38 ` Jeff King
2016-01-11 21:54 ` Junio C Hamano
2016-01-11 22:06 ` Jeff King
2016-01-12 8:05 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56773264.2050806@web.de \
--to=tboegi@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=szeder@ira.uka.de \
--cc=yoh@onerussian.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).