Please describe the problem.

Can't find an approach to file permissions mode to get thin v6 annex repo to hold no second copies.

I realize that hardlinks work in such a way that all links have same permissions mode. The issue is, which mode for files I should set to always get hardlinks? git-annex seems to prefer 555 for .git/annex/objects/ files, but appears it can create e.g. 644 when copying from remote. git remembers file modes as either 755 or 644, so after git annex lock; git annex unlock cycle or git annex fix no file is hardlinked if .git/annex/objects/ file mode is 555.

What steps will reproduce the problem?

  • Create a new git-annex repo. v6, thin.
  • Create few files with same content but different perms (e.g. 555, 755, 644).
  • Add and commit these files to annex.
  • Observe that in this repo, 0555-mode file is hardlinked.
  • Clone this repo
  • Init annex in the second repo to also be v6 thin.
  • Fetch the annex files to second repo.
  • Observe that in the new repo, 0644-mode file is hardlinked.
  • Try to figure out which permissions to use across the repo to always have hardlinks.

What version of git-annex are you using? On what operating system?

6.20180926. Gentoo Linux. Manually corrected ebuild based on the one in haskell overlay.

Please provide any additional information below.

 $ git init annex_perm_issue
Initialized empty Git repository in /home/j/annex_perm_issue/.git/
[OK]
21:44:11 Wed 17 Oct j@undo-autkin ~
 $ cd annex_perm_issue
[OK]
21:44:13 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ git annex init --version=6
init  ok
(recording state in git...)
[OK]
21:45:09 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls
[OK]
21:45:12 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ v 755
[OK]
21:45:25 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ cp 755 644
[OK]
21:45:32 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ cp 755 555
[OK]
21:45:36 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ chmod 755 755
[OK]
21:45:42 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ chmod 555 555
[OK]
21:45:45 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ chmod 644 644
[OK]
21:45:50 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-r-xr-xr-x. 1 j j 5 Oct 17 21:45 555
-rw-r--r--. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:45:52 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ md5sum *
d8e8fca2dc0f896fd7cb4cb0031ba249  555
d8e8fca2dc0f896fd7cb4cb0031ba249  644
d8e8fca2dc0f896fd7cb4cb0031ba249  755
[OK]
21:46:00 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ git config annex.thin true
[OK]
21:47:08 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ g add *
[OK]
21:47:17 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-r-xr-xr-x. 2 j j 5 Oct 17 21:45 555
-rw-r--r--. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:47:20 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ g su
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   555
        new file:   644
        new file:   755

Untracked files not listed (use -u option to show untracked files)
[OK]
21:47:23 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ g ci -m 'adding all'
(recording state in git...)
[master (root-commit) d03ede4] adding all
 3 files changed, 3 insertions(+)
 create mode 100755 555
 create mode 100644 644
 create mode 100755 755
[OK]
21:48:16 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-r-xr-xr-x. 2 j j 5 Oct 17 21:45 555
-rw-r--r--. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:48:20 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l .git/annex/objects/
total 4
drwxr-xr-x. 3 j j 4096 Oct 17 21:47 w8
[OK]
21:48:33 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l .git/annex/objects/w8/
total 4
drwxr-xr-x. 3 j j 4096 Oct 17 21:47 pv
[OK]
21:48:34 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l .git/annex/objects/w8/pv/
total 4
dr-xr-xr-x. 2 j j 4096 Oct 17 21:47 SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
21:48:35 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-r-xr-xr-x. 2 j j 5 Oct 17 21:45 555
-rw-r--r--. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:49:41 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ git annex lock .
lock 555 ok
lock 644 ok
lock 755 ok
(recording state in git...)
[OK]
21:49:45 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
lrwxrwxrwx. 1 j j 178 Oct 17 21:45 555 -> .git/annex/objects/w8/pv/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
lrwxrwxrwx. 1 j j 178 Oct 17 21:45 644 -> .git/annex/objects/w8/pv/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
lrwxrwxrwx. 1 j j 178 Oct 17 21:45 755 -> .git/annex/objects/w8/pv/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
21:49:47 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ git annex unlock .
unlock 555 ok
unlock 644 ok
unlock 755 ok
(recording state in git...)
[OK]
21:49:52 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:49:53 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ git annex fix .
fix 555 ok
fix 644 ok
fix 755 ok
[OK]
21:50:01 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:50:02 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l .git/annex/objects/w8/pv/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2/
total 4
-r-xr-xr-x. 1 j j 5 Oct 17 21:45 SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
21:50:08 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ git show | cat
commit d03ede4f1a8b2ba3967a9aae005030cea408e3a5
Author: Andrey Utkin <andrey_utkin@fastmail.com>
Date:   Wed Oct 17 21:48:16 2018 +0100

    adding all

diff --git a/555 b/555
new file mode 100755
index 0000000..db80da6
--- /dev/null
+++ b/555
@@ -0,0 +1 @@
+/annex/objects/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
diff --git a/644 b/644
new file mode 100644
index 0000000..db80da6
--- /dev/null
+++ b/644
@@ -0,0 +1 @@
+/annex/objects/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
diff --git a/755 b/755
new file mode 100755
index 0000000..db80da6
--- /dev/null
+++ b/755
@@ -0,0 +1 @@
+/annex/objects/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
21:50:30 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ cd ..
[OK]
21:55:23 Wed 17 Oct j@undo-autkin ~
 $ g clone ~/annex_perm_issue/ ~/annex_perm_issue.clone
Cloning into '/home/j/annex_perm_issue.clone'...
done.
[OK]
21:55:35 Wed 17 Oct j@undo-autkin ~
 $ cd ~/annex_perm_issue.clone
[OK]
21:55:37 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex status
[OK]
21:55:53 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 555
-rw-r--r--. 1 j j 92 Oct 17 21:55 644
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 755
[OK]
21:55:55 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex init
init  ok
(recording state in git...)
[OK]
21:56:07 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 555
-rw-r--r--. 1 j j 92 Oct 17 21:55 644
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 755
[OK]
21:56:10 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex copy --to=here --all
copy SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2 (from origin...) (checksum...) ok
(recording state in git...)
[OK]
21:56:40 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 555
-rw-r--r--. 1 j j 92 Oct 17 21:55 644
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 755
[OK]
21:56:43 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex fix .
[OK]
21:56:48 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 555
-rw-r--r--. 1 j j 92 Oct 17 21:55 644
-rwxr-xr-x. 1 j j 92 Oct 17 21:55 755
[OK]
21:56:49 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ cat 555
/annex/objects/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
21:56:56 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex version
git-annex version: 6.20180926
build flags: Assistant Webapp Pairing WebDAV Inotify DBus DesktopNotify ConcurrentOutput TorrentParser MagicMime Feeds Testsuite
dependency versions: bloomfilter-2.0.1.0 cryptonite-0.25 DAV-1.3.2 feed-0.3.12.0 ghc-8.0.2 http-client-0.5.7.0 persistent-sqlite-2.6.0.1 torrent-10000.1.1 uuid-1.3.13 yesod-1.4.4
key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL
remote types: git gcrypt p2p bup directory rsync web bittorrent webdav adb tahoe glacier ddar hook external
operating system: linux x86_64
supported repository versions: 3 5 6
upgrade supported from repository versions: 0 1 2 3 4 5
local repository version: 5
[OK]
21:57:42 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex upgrade
upgrade (v5 to v6...) (scanning for unlocked files...)
ok
[OK]
21:57:47 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rw-r--r--. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:57:50 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git config annex.thin true
[OK]
21:57:57 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rw-r--r--. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:58:03 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ git annex fix .
fix 555 ok
fix 644 ok
[OK]
21:58:06 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rw-r--r--. 2 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
21:58:07 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ ls -l .git/annex/objects/w8/pv/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2/
total 4
-rw-r--r--. 2 j j 5 Oct 17 21:45 SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
21:58:24 Wed 17 Oct j@undo-autkin ~/annex_perm_issue.clone
 $ cd ../annex_perm_issue
[OK]
22:00:07 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
22:00:11 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l .git/annex/objects/w8/pv/SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2/
total 4
-r-xr-xr-x. 1 j j 5 Oct 17 21:45 SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
[OK]
22:00:18 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ chmod 555 *
[OK]
22:00:43 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-r-xr-xr-x. 1 j j 5 Oct 17 21:45 555
-r-xr-xr-x. 1 j j 5 Oct 17 21:45 644
-r-xr-xr-x. 1 j j 5 Oct 17 21:45 755
[OK]
22:00:44 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ g su
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   644

Untracked files not listed (use -u option to show untracked files)
[OK]
22:00:46 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ g annex fix .
fix 555 ok
fix 644 ok
fix 755 ok
[OK]
22:01:06 Wed 17 Oct j@undo-autkin ~/annex_perm_issue
 $ ls -l
total 12
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 555
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 644
-rwxr-xr-x. 1 j j 5 Oct 17 21:45 755

Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)

lil' positive end note mode on:

git-annex is the only thing to which I trust my archive of most valuable documents and memories!

done; see comments --Joey