Bug 6026 - umask unsoundness on creating .hg/cache/checklink?
Summary: umask unsoundness on creating .hg/cache/checklink?
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: stable branch
Hardware: All Mac OS
: wish feature
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-27 10:28 UTC by Augie Fackler
Modified: 2018-12-10 00:00 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Augie Fackler 2018-11-27 10:28 UTC
The BSD and Mac builders are currently sad like this:

--- /usr/home/hg/buildslave/FreeBSD_hg_tests/build/tests/test-inherit-mode.t
+++ /usr/home/hg/buildslave/FreeBSD_hg_tests/build/tests/test-inherit-mode.t.err
@@ -70,7 +70,7 @@
   00770 ./.hg/cache/
   00660 ./.hg/cache/branch2-served
   00711 ./.hg/cache/checkisexec
-  00777 ./.hg/cache/checklink
+  00700 ./.hg/cache/checklink
   00600 ./.hg/cache/checklink-target
   00660 ./.hg/cache/manifestfulltextcache (reporevlogstore !)
   00660 ./.hg/cache/rbc-names-v1

The commentary in the test suggests to me that the permissions on the symlink should be 0770 or more permissive, not 0700. I can't quite figure out what's going on to make other directories etc have writable permissions for the group, but it seems like we should make it consistent?

Caveat: I remember that permissions are weird for symlinks, but can't dredge up details and I need to work on other things right now.
Comment 1 Augie Fackler 2018-11-27 10:30 UTC
This was broken by bd0874977a5e5921f7f8615f2eb96d267f641c2e, which introduced the test on the checkexec stuff. CC'ing Boris in case an obvious fix springs to mind...
Comment 2 Augie Fackler 2018-11-27 10:43 UTC
https://superuser.com/questions/303040/how-do-file-permissions-apply-to-symlinks suggests this only matters on macOS, where we should probably set the link to 0744?
Comment 3 Yuya Nishihara 2018-11-28 07:18 UTC
Maybe we can just glob out the symlink permission?

I don't think the permission of symlink matters, and it just inherits
umask on BSD.
Comment 4 Augie Fackler 2018-11-28 14:01 UTC
Did you follow that superuser link? It looks like the shared-repo case will be broken-ish with mode 0700 because non-owners won't be able to see the symlink destination.

(Technically this is non-POSIX, but it's reality. Sigh.)
Comment 5 Yuya Nishihara 2018-11-29 06:39 UTC
WAT? Apple?

But anyway, this "checklink" case should be fine so long as the symlink
can be stat()-ed.
Comment 6 HG Bot 2018-12-02 17:05 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/90e26ef4cbb1
Augie Fackler <augie@google.com>
tests: stabilize test-inherit-mode.t on FreeBSD and macOS (issue6026)

Symbolic links are funny permissions-wise, but on the linked issue
Yuya has convinced me that we can ignore this permissions issue on
macOS (FreeBSD allows setting permissions bits but ignores them) and
we'll be in fine shape.

(please test the fix)
Comment 7 Bugzilla 2018-12-10 00:00 UTC
Bug was set to TESTING for 7 days, resolving