{"thread":{"id":"46242","subject":"[PATCH v2 1/3] read-cache: use shared perms when writing shared index","startedAt":"2017-06-23T15:16:58Z","lastAt":"2017-06-25T04:42:35Z","messageCount":8,"participants":["Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"323101","messageId":"20170623151640.24082-1-chriscool@tuxfamily.org","threadId":"46242","inReplyTo":null,"subject":"[PATCH v2 1/3] read-cache: use shared perms when writing shared index","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-06-23T15:16:38Z","receivedAt":"2017-06-23T15:16:58Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Since f6ecc62dbf (write_shared_index(): use tempfile module, 2015-08-10)\nwrite_shared_index() has been using mks_tempfile() to create the\ntemporary file that will become the shared index.\n\nBut even before that, it looks like the functions used to create this\nfile didn't call adjust_shared_perm(), which means that the shared\nindex file has always been created with 600 permissions regardless\nof the shared permission settings.\n\nBecause of that, on repositories created with `git init --shared=all`\nand using the split index feature, one gets an error like:\n\nfatal: .git/sharedindex.a52f910b489bc462f187ab572ba0086f7b5157de: index file open failed: Permission denied\n\nwhen another user performs any operation that reads the shared index.\n\nWe could use create_tempfile() that calls adjust_shared_perm(), but\nunfortunately create_tempfile() doesn't replace the XXXXXX at the end\nof the path it is passed. So let's just call adjust_shared_perm() by\nourselves.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n read-cache.c | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex bc156a133e..66f85f8d58 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2425,6 +2425,14 @@ static int write_shared_index(struct index_state *istate,\n \t\tdelete_tempfile(&temporary_sharedindex);\n \t\treturn ret;\n \t}\n+\tret = adjust_shared_perm(temporary_sharedindex.filename.buf);\n+\tif (ret) {\n+\t\tint save_errno = errno;\n+\t\terror(\"cannot fix permission bits on %s\", temporary_sharedindex.filename.buf);\n+\t\tdelete_tempfile(&temporary_sharedindex);\n+\t\terrno = save_errno;\n+\t\treturn ret;\n+\t}\n \tret = rename_tempfile(&temporary_sharedindex,\n \t\t\t      git_path(\"sharedindex.%s\", sha1_to_hex(si->base->sha1)));\n \tif (!ret) {\n-- \n2.13.1.519.g0a0746bea4\n\n"},{"id":"323102","messageId":"20170623151640.24082-2-chriscool@tuxfamily.org","threadId":"46242","inReplyTo":"20170623151640.24082-1-chriscool@tuxfamily.org","subject":"[PATCH v2 2/3] t1301: move modebits() to test-lib-functions.sh","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-06-23T15:16:39Z","receivedAt":"2017-06-23T15:17:00Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"As the modebits() function can be useful outside t1301,\nlet's move it into test-lib-functions.sh, and while at\nit let's rename it test_modebits().\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/t1301-shared-repo.sh  | 18 +++++++-----------\n t/test-lib-functions.sh |  5 +++++\n 2 files changed, 12 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh\nindex 1312004f8c..dfece751b5 100755\n--- a/t/t1301-shared-repo.sh\n+++ b/t/t1301-shared-repo.sh\n@@ -19,10 +19,6 @@ test_expect_success 'shared = 0400 (faulty permission u-w)' '\n \t)\n '\n \n-modebits () {\n-\tls -l \"$1\" | sed -e 's|^\\(..........\\).*|\\1|'\n-}\n-\n for u in 002 022\n do\n \ttest_expect_success POSIXPERM \"shared=1 does not clear bits preset by umask $u\" '\n@@ -88,7 +84,7 @@ do\n \n \t\trm -f .git/info/refs &&\n \t\tgit update-server-info &&\n-\t\tactual=\"$(modebits .git/info/refs)\" &&\n+\t\tactual=\"$(test_modebits .git/info/refs)\" &&\n \t\tverbose test \"x$actual\" = \"x-$y\"\n \n \t'\n@@ -98,7 +94,7 @@ do\n \n \t\trm -f .git/info/refs &&\n \t\tgit update-server-info &&\n-\t\tactual=\"$(modebits .git/info/refs)\" &&\n+\t\tactual=\"$(test_modebits .git/info/refs)\" &&\n \t\tverbose test \"x$actual\" = \"x-$x\"\n \n \t'\n@@ -111,7 +107,7 @@ test_expect_success POSIXPERM 'info/refs respects umask in unshared repo' '\n \tumask 002 &&\n \tgit update-server-info &&\n \techo \"-rw-rw-r--\" >expect &&\n-\tmodebits .git/info/refs >actual &&\n+\ttest_modebits .git/info/refs >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -177,7 +173,7 @@ test_expect_success POSIXPERM 'remote init does not use config from cwd' '\n \tumask 0022 &&\n \tgit init --bare child.git &&\n \techo \"-rw-r--r--\" >expect &&\n-\tmodebits child.git/config >actual &&\n+\ttest_modebits child.git/config >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -187,7 +183,7 @@ test_expect_success POSIXPERM 're-init respects core.sharedrepository (local)' '\n \techo whatever >templates/foo &&\n \tgit init --template=templates &&\n \techo \"-rw-rw-rw-\" >expect &&\n-\tmodebits .git/foo >actual &&\n+\ttest_modebits .git/foo >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -198,7 +194,7 @@ test_expect_success POSIXPERM 're-init respects core.sharedrepository (remote)'\n \ttest_path_is_missing child.git/foo &&\n \tgit init --bare --template=../templates child.git &&\n \techo \"-rw-rw-rw-\" >expect &&\n-\tmodebits child.git/foo >actual &&\n+\ttest_modebits child.git/foo >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -209,7 +205,7 @@ test_expect_success POSIXPERM 'template can set core.sharedrepository' '\n \tcp .git/config templates/config &&\n \tgit init --bare --template=../templates child.git &&\n \techo \"-rw-rw-rw-\" >expect &&\n-\tmodebits child.git/HEAD >actual &&\n+\ttest_modebits child.git/HEAD >actual &&\n \ttest_cmp expect actual\n '\n \ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 5ee124332a..db622c3555 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -216,6 +216,11 @@ test_chmod () {\n \tgit update-index --add \"--chmod=$@\"\n }\n \n+# Get the modebits from a file.\n+test_modebits () {\n+\tls -l \"$1\" | sed -e 's|^\\(..........\\).*|\\1|'\n+}\n+\n # Unset a configuration variable, but don't fail if it doesn't exist.\n test_unconfig () {\n \tconfig_dir=\n-- \n2.13.1.519.g0a0746bea4\n\n"},{"id":"323103","messageId":"20170623151640.24082-3-chriscool@tuxfamily.org","threadId":"46242","inReplyTo":"20170623151640.24082-1-chriscool@tuxfamily.org","subject":"[PATCH v2 3/3] t1700: make sure split-index respects core.sharedrepository","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-06-23T15:16:40Z","receivedAt":"2017-06-23T15:17:02Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Add a few tests to check that both the split-index file and the\nshared-index file are created using the right permissions when\ncore.sharedrepository is set.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/t1700-split-index.sh | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)\n\ndiff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh\nindex af3ec0da5a..2c5be732e4 100755\n--- a/t/t1700-split-index.sh\n+++ b/t/t1700-split-index.sh\n@@ -370,4 +370,21 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to \"never\" and \"now\"\n \ttest $(ls .git/sharedindex.* | wc -l) -le 2\n '\n \n+while read -r mode modebits filename; do\n+\ttest_expect_success POSIXPERM \"split index respects core.sharedrepository $mode\" '\n+\t\tgit config core.sharedrepository \"$mode\" &&\n+\t\t: >\"$filename\" &&\n+\t\tgit update-index --add \"$filename\" &&\n+\t\techo \"$modebits\" >expect &&\n+\t\ttest_modebits .git/index >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\tnewest_shared_index=$(ls -t .git/sharedindex.* | head -1) &&\n+\t\ttest_modebits \"$newest_shared_index\" >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+done <<\\EOF\n+0666 -rw-rw-rw- seventeen\n+0642 -rw-r---w- eightteen\n+EOF\n+\n test_done\n-- \n2.13.1.519.g0a0746bea4\n\n"},{"id":"323160","messageId":"xmqqa84ycqtf.fsf@gitster.mtv.corp.google.com","threadId":"46242","inReplyTo":"20170623151640.24082-1-chriscool@tuxfamily.org","subject":"Re: [PATCH v2 1/3] read-cache: use shared perms when writing shared index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-23T21:55:08Z","receivedAt":"2017-06-23T21:55:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> Since f6ecc62dbf (write_shared_index(): use tempfile module, 2015-08-10)\n> write_shared_index() has been using mks_tempfile() to create the\n> temporary file that will become the shared index.\n>\n> But even before that, it looks like the functions used to create this\n> file didn't call adjust_shared_perm(), which means that the shared\n> index file has always been created with 600 permissions regardless\n> of the shared permission settings.\n>\n> Because of that, on repositories created with `git init --shared=all`\n> and using the split index feature, one gets an error like:\n>\n> fatal: .git/sharedindex.a52f910b489bc462f187ab572ba0086f7b5157de: index file open failed: Permission denied\n>\n> when another user performs any operation that reads the shared index.\n>\n> We could use create_tempfile() that calls adjust_shared_perm(), but\n> unfortunately create_tempfile() doesn't replace the XXXXXX at the end\n> of the path it is passed. So let's just call adjust_shared_perm() by\n> ourselves.\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n>  read-cache.c | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n>\n> diff --git a/read-cache.c b/read-cache.c\n> index bc156a133e..66f85f8d58 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -2425,6 +2425,14 @@ static int write_shared_index(struct index_state *istate,\n>  \t\tdelete_tempfile(&temporary_sharedindex);\n>  \t\treturn ret;\n>  \t}\n> +\tret = adjust_shared_perm(temporary_sharedindex.filename.buf);\n\nShouldn't we be using the API function get_tempfile_path() for this\ninstead of reaching into its implementation detail?\n\n> +\tif (ret) {\n> +\t\tint save_errno = errno;\n> +\t\terror(\"cannot fix permission bits on %s\", temporary_sharedindex.filename.buf);\n> +\t\tdelete_tempfile(&temporary_sharedindex);\n> +\t\terrno = save_errno;\n> +\t\treturn ret;\n> +\t}\n>  \tret = rename_tempfile(&temporary_sharedindex,\n>  \t\t\t      git_path(\"sharedindex.%s\", sha1_to_hex(si->base->sha1)));\n>  \tif (!ret) {\n"},{"id":"323162","messageId":"xmqq60fmcqgm.fsf@gitster.mtv.corp.google.com","threadId":"46242","inReplyTo":"20170623151640.24082-1-chriscool@tuxfamily.org","subject":"Re: [PATCH v2 1/3] read-cache: use shared perms when writing shared index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-23T22:02:49Z","receivedAt":"2017-06-23T22:02:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> Since f6ecc62dbf (write_shared_index(): use tempfile module, 2015-08-10)\n> write_shared_index() has been using mks_tempfile() to create the\n> temporary file that will become the shared index.\n>\n> But even before that, it looks like the functions used to create this\n> file didn't call adjust_shared_perm(), which means that the shared\n> index file has always been created with 600 permissions regardless\n> of the shared permission settings.\n>\n> Because of that, on repositories created with `git init --shared=all`\n> and using the split index feature, one gets an error like:\n>\n> fatal: .git/sharedindex.a52f910b489bc462f187ab572ba0086f7b5157de: index file open failed: Permission denied\n>\n> when another user performs any operation that reads the shared index.\n>\n> We could use create_tempfile() that calls adjust_shared_perm(), but\n> unfortunately create_tempfile() doesn't replace the XXXXXX at the end\n> of the path it is passed. So let's just call adjust_shared_perm() by\n> ourselves.\n\nBecause create_tempfile() is not even a viable alternative, the\nabove sounds just as silly as saying \"We could use X, but\nunfortunately that X doesn't create a temporary file and return its\nfile descriptor\" with X replaced with any one of about a dozen\nfunctions that happen to call adjust_shared_perm().\n\n\tCall adjust_shared_perm() on the temporary file created by\n\tmks_tempfile() ourselves to adjust the permission bits.\n\nshould be sufficient.\n\nThanks.\n\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n>  read-cache.c | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n>\n> diff --git a/read-cache.c b/read-cache.c\n> index bc156a133e..66f85f8d58 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -2425,6 +2425,14 @@ static int write_shared_index(struct index_state *istate,\n>  \t\tdelete_tempfile(&temporary_sharedindex);\n>  \t\treturn ret;\n>  \t}\n> +\tret = adjust_shared_perm(temporary_sharedindex.filename.buf);\n> +\tif (ret) {\n> +\t\tint save_errno = errno;\n> +\t\terror(\"cannot fix permission bits on %s\", temporary_sharedindex.filename.buf);\n> +\t\tdelete_tempfile(&temporary_sharedindex);\n> +\t\terrno = save_errno;\n> +\t\treturn ret;\n> +\t}\n>  \tret = rename_tempfile(&temporary_sharedindex,\n>  \t\t\t      git_path(\"sharedindex.%s\", sha1_to_hex(si->base->sha1)));\n>  \tif (!ret) {\n"},{"id":"323163","messageId":"xmqqwp82bb39.fsf@gitster.mtv.corp.google.com","threadId":"46242","inReplyTo":"20170623151640.24082-3-chriscool@tuxfamily.org","subject":"Re: [PATCH v2 3/3] t1700: make sure split-index respects core.sharedrepository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-23T22:20:10Z","receivedAt":"2017-06-23T22:20:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> Add a few tests to check that both the split-index file and the\n> shared-index file are created using the right permissions when\n> core.sharedrepository is set.\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n>  t/t1700-split-index.sh | 17 +++++++++++++++++\n>  1 file changed, 17 insertions(+)\n>\n> diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh\n> index af3ec0da5a..2c5be732e4 100755\n> --- a/t/t1700-split-index.sh\n> +++ b/t/t1700-split-index.sh\n> @@ -370,4 +370,21 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to \"never\" and \"now\"\n>  \ttest $(ls .git/sharedindex.* | wc -l) -le 2\n>  '\n>  \n> +while read -r mode modebits filename; do\n\nStyle.\n\n\twhile read -r mode modebits filename\n\tdo\n\n> +\ttest_expect_success POSIXPERM \"split index respects core.sharedrepository $mode\" '\n> +\t\tgit config core.sharedrepository \"$mode\" &&\n> +\t\t: >\"$filename\" &&\n> +\t\tgit update-index --add \"$filename\" &&\n> +\t\techo \"$modebits\" >expect &&\n> +\t\ttest_modebits .git/index >actual &&\n> +\t\ttest_cmp expect actual &&\n> +\t\tnewest_shared_index=$(ls -t .git/sharedindex.* | head -1) &&\n> +\t\ttest_modebits \"$newest_shared_index\" >actual &&\n> +\t\ttest_cmp expect actual\n> +\t'\n\nRunning this twice in a loop would create two .git/sharedindex.*\nfiles in quick succession.  I do not think we want to assume that\nthe filesystem timestamp can keep up with us to allow \"ls -t\" to\nwork reliably in the second round (if there is a leftover shared\nindex from previous test, even the first round may not catch the\nlatest one).\n\nHow about doing each iteration this way instead?  Which might be a\nbetter solution to work around that.\n\n    - with core.sharedrepository set to false, force the index to be\n      unsplit; \"index\" will have the default unshared permission\n      bits (but we do not care what it is and no need to check it).\n\n    - remove any leftover sharedindex.*, if any.\n\n    - with core.sharedrepository set to whatever mode being tested,\n      do the adding to force split.\n\n    - test the permission of index file.\n\n    - test the permission of sharedindex.* file; there should be\n      only one instance, so erroring out when we see two or more is\n      also a good test.\n\nThe last two steps may look like:\n\n\ttest_modebits .git/index >actual && test_cmp expect actual &&\n\tshared=$(ls .git/sharedindex.*) &&\n\tcase \"$shared\" in\n\t*\" \"*)\n\t\t# we have more than one???\n\t\tfalse ;;\n\t*)\t\n\t\ttest_modebits \"shared\" >actual &&\n\t\ttest_cmp expect actual ;;\n\tesac\n\n> +done <<\\EOF\n> +0666 -rw-rw-rw- seventeen\n> +0642 -rw-r---w- eightteen\n> +EOF\n> +\n>  test_done\n"},{"id":"323232","messageId":"CAP8UFD2QV-HkL+nwq+gvwE9V6TbuacioJwmcztNqGmF913Bo2A@mail.gmail.com","threadId":"46242","inReplyTo":"xmqqwp82bb39.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 3/3] t1700: make sure split-index respects core.sharedrepository","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-06-25T04:39:39Z","receivedAt":"2017-06-25T04:39:54Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sat, Jun 24, 2017 at 12:20 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Christian Couder <christian.couder@gmail.com> writes:\n>\n>> Add a few tests to check that both the split-index file and the\n>> shared-index file are created using the right permissions when\n>> core.sharedrepository is set.\n>>\n>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n>> ---\n>>  t/t1700-split-index.sh | 17 +++++++++++++++++\n>>  1 file changed, 17 insertions(+)\n>>\n>> diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh\n>> index af3ec0da5a..2c5be732e4 100755\n>> --- a/t/t1700-split-index.sh\n>> +++ b/t/t1700-split-index.sh\n>> @@ -370,4 +370,21 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to \"never\" and \"now\"\n>>       test $(ls .git/sharedindex.* | wc -l) -le 2\n>>  '\n>>\n>> +while read -r mode modebits filename; do\n>\n> Style.\n\nFixed in the version (v3) I just sent.\n\n> Running this twice in a loop would create two .git/sharedindex.*\n> files in quick succession.  I do not think we want to assume that\n> the filesystem timestamp can keep up with us to allow \"ls -t\" to\n> work reliably in the second round (if there is a leftover shared\n> index from previous test, even the first round may not catch the\n> latest one).\n\nYeah, it might be a problem on some systems.\n\n> How about doing each iteration this way instead?  Which might be a\n> better solution to work around that.\n>\n>     - with core.sharedrepository set to false, force the index to be\n>       unsplit; \"index\" will have the default unshared permission\n>       bits (but we do not care what it is and no need to check it).\n>\n>     - remove any leftover sharedindex.*, if any.\n>\n>     - with core.sharedrepository set to whatever mode being tested,\n>       do the adding to force split.\n>\n>     - test the permission of index file.\n>\n>     - test the permission of sharedindex.* file; there should be\n>       only one instance, so erroring out when we see two or more is\n>       also a good test.\n>\n> The last two steps may look like:\n>\n>         test_modebits .git/index >actual && test_cmp expect actual &&\n>         shared=$(ls .git/sharedindex.*) &&\n>         case \"$shared\" in\n>         *\" \"*)\n>                 # we have more than one???\n>                 false ;;\n>         *)\n>                 test_modebits \"shared\" >actual &&\n>                 test_cmp expect actual ;;\n>         esac\n\nOk, it does what you suggest in v3.\n\nThanks.\n"},{"id":"323233","messageId":"CAP8UFD24RMxjWzowP7-LD5ZA+usNaHzr=1tzP4BNTUziqYF4_w@mail.gmail.com","threadId":"46242","inReplyTo":"xmqq60fmcqgm.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 1/3] read-cache: use shared perms when writing shared index","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-06-25T04:42:22Z","receivedAt":"2017-06-25T04:42:35Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sat, Jun 24, 2017 at 12:02 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Christian Couder <christian.couder@gmail.com> writes:\n\n>> Because of that, on repositories created with `git init --shared=all`\n>> and using the split index feature, one gets an error like:\n>>\n>> fatal: .git/sharedindex.a52f910b489bc462f187ab572ba0086f7b5157de: index file open failed: Permission denied\n>>\n>> when another user performs any operation that reads the shared index.\n>>\n>> We could use create_tempfile() that calls adjust_shared_perm(), but\n>> unfortunately create_tempfile() doesn't replace the XXXXXX at the end\n>> of the path it is passed. So let's just call adjust_shared_perm() by\n>> ourselves.\n>\n> Because create_tempfile() is not even a viable alternative, the\n> above sounds just as silly as saying \"We could use X, but\n> unfortunately that X doesn't create a temporary file and return its\n> file descriptor\" with X replaced with any one of about a dozen\n> functions that happen to call adjust_shared_perm().\n>\n>         Call adjust_shared_perm() on the temporary file created by\n>         mks_tempfile() ourselves to adjust the permission bits.\n>\n> should be sufficient.\n\nOk, the v3 has the above in the commit message and also uses\nget_tempfile_path().\n"}]}