With core.sharedRepository=0666, some lock files get created mode 644 (with umask 0022).

With core.sharedRepository=group, some lock files get created mode 660, rather than 664 (with umask 0022).

Root of the problem is uses of annexFileMode.

Some callers use noUmask with it, which works in cases other than these (at least with umask 0022). But in the core.sharedRepository=group case, the umask is cleared by noUmask, which is why the o+r bit is not set.

Some callers don't use noUmask with it, and when core.sharedRepository=0666, that results in the umask being applied to the mode. Which it's not supposed to with an octal mode configured.

The affected files are all lock files.

Fix will probably involve getting rid of annexFileMode, and noUmask, and creating the lock file with default umask, then fixing up the mode if necessary, before using it. Ie, the same pattern used everywhere else in git-annex. --Joey

fixed --Joey