rfjakob / gocryptfs

Encrypted overlay filesystem written in Go

Home Page:https://nuetzlich.net/gocryptfs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

file size incorrect briefly after hard link creation

joeyh opened this issue · comments

If a file is hard linked and statted immediately afterwards, it always appears 50 bytes larger than the actual file size. Within 1 second whatever is causing this corrects itself.

joey@darkstar:~/mnt>echo hi > a
joey@darkstar:~/mnt>ln a b ; stat b ; sleep 1; stat b
  File: b
  Size: 53        	Blocks: 8          IO Block: 4096   regular file
Device: 0,57	Inode: 13244313    Links: 2
Access: (0644/-rw-r--r--)  Uid: ( 1000/    joey)   Gid: ( 1000/    joey)
Access: 2023-03-28 13:59:26.326414785 -0400
Modify: 2023-03-28 13:59:26.326414785 -0400
Change: 2023-03-28 13:59:28.890424359 -0400
 Birth: -
  File: b
  Size: 3         	Blocks: 8          IO Block: 4096   regular file
Device: 0,57	Inode: 13244313    Links: 2
Access: (0644/-rw-r--r--)  Uid: ( 1000/    joey)   Gid: ( 1000/    joey)
Access: 2023-03-28 13:59:26.326414785 -0400
Modify: 2023-03-28 13:59:26.326414785 -0400
Change: 2023-03-28 13:59:28.890424359 -0400
 Birth: -
joey@darkstar:~/mnt>mount | grep /mnt
/home/joey/tmp/goc on /home/joey/mnt type fuse.gocryptfs (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,max_read=131072)

I am testing on Debian, kernel 6.0.0-6-amd64. Using gocryptfs version 2.3-1+b3 installed from Debian unstable.

An example of this breaking a program is at https://git-annex.branchable.com/forum/Can_you_use_git_annex_on_gocryptfs__63__/

Note that according to the user on that page, version 1.8.0 does not have this problem.

@rfjakob Hi, I am excited about this filing! As your former Debian maintainer, I feel obligated to point out that @joeyh is (or perhaps was) Debian royalty. He (or perhaps they) made many significant and lasting contributions to free software, including Ikiwiki. You can read more here.

Thanks for the report. Looks like I broke this in the v2.0 rewrite.

Fixed now, and test added so this cannot regress again.

Hi @rfjakob! Thank you very much for developing gocryptfs, it is really useful. As you fixed this bug, would you mind releasing a new version?

Sorry to bother you if your release planning follows some rules I am not aware of.

As the person who reported the git-annex issue, I can confirm that git-annex now seems to work perfectly when using gocryptfs built from master. Tested just now with:

gocryptfs v2.3.1-3-g24b3978; go-fuse v2.1.1-0.20221117175120-915cf5413cde; 2023-04-24 go1.19.3 linux/amd64

(Apologies for the delayed response; I forgot to circle back and re-test.)