rfjakob/gocryptfs

Some `gocryptfs.longname` in a path cannot be accessed.

galaxy001 opened this issue · 7 comments

I am using gocryptfs -reverse to mount. And my rsync says "file has vanished:" on 18 files, while others of the whole 1,089,966 files are OK.

I checked and find there file exists in the path, but cannot be listed individually.

# ls ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/ |grep QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDK
gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY
gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY.name

# ls -l ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY*
ls: cannot access ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY: No such file or directory
ls: cannot access ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY.name: No such file or directory

# ls -l ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/ |grep QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDK
ls: cannot access ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY: No such file or directory
ls: cannot access ./tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY.name: No such file or directory
-????????? ? ?     ?             ?            ? gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY
-????????? ? ?     ?             ?            ? gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY.name

.gocryptfs.reverse.conf

	"Creator": "gocryptfs v1.4.1",
	"ScryptObject": {
		"N": 65536,
		"R": 8,
		"P": 1,
		"KeyLen": 32
	},
	"Version": 2,
	"FeatureFlags": [
		"GCMIV128",
		"HKDF",
		"DirIV",
		"EMENames",
		"LongNames",
		"Raw64",
		"AESSIV"
	]
# uname -a
Linux 3.10.102 #15152 SMP Fri Sep 1 11:15:03 CST 2017 x86_64 GNU/Linux synology_cedarview_1813+

And there are about 9 files missing after mount.

Interesting. Can you post the plaintext name of UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY or is it sensitive? You can find the plaintext file using the inode number.

Question 2: Are all longname files broken like this? rsync says that 18 files are broken, I guess that makes nine gocryptfs.longname.XXX and nine gocryptfs.longname.XXX.name files. Do you have more than 9 files with long names that were copied correctly?

Yes, all of them are 'gocryptfs.longname' file pairs.

The filename is OK to show. How to show inode number and use the inode number to locate relevant plaintext file ? I am not familiar with this.

ls is totally failed on there files. So I find one by the inum of its dir.

# ls ./old/_tmp/baidu/*sm22198921*
./old/_tmp/baidu/【アイドルマスター シャイニーTV】◆水瀬伊織◆双海亜美◆双海真美◆高槻やよい◆我那覇響◆『SMOKY THRILL』Special MC - [sm22198921].mp4

# ls ./old/_tmp/baidu/*sm22198921*|hexdump -C
00000000  2e 2f 6f 6c 64 2f 5f 74  6d 70 2f 62 61 69 64 75  |./old/_tmp/baidu|
00000010  2f e3 80 90 e3 82 a2 e3  82 a4 e3 83 89 e3 83 ab  |/...............|
00000020  e3 83 9e e3 82 b9 e3 82  bf e3 83 bc 20 e3 82 b7  |............ ...|
00000030  e3 83 a3 e3 82 a4 e3 83  8b e3 83 bc 54 56 e3 80  |............TV..|
00000040  91 e2 97 86 e6 b0 b4 e7  80 ac e4 bc 8a e7 b9 94  |................|
00000050  e2 97 86 e5 8f 8c e6 b5  b7 e4 ba 9c e7 be 8e e2  |................|
00000060  97 86 e5 8f 8c e6 b5 b7  e7 9c 9f e7 be 8e e2 97  |................|
00000070  86 e9 ab 98 e6 a7 bb e3  82 84 e3 82 88 e3 81 84  |................|
00000080  e2 97 86 e6 88 91 e9 82  a3 e8 a6 87 e9 9f bf e2  |................|
00000090  97 86 e3 80 8e 53 4d 4f  4b 59 20 54 48 52 49 4c  |.....SMOKY THRIL|
000000a0  4c e3 80 8f 53 70 65 63  69 61 6c 20 4d 43 20 2d  |L...Special MC -|
000000b0  20 5b 73 6d 32 32 31 39  38 39 32 31 5d 2e 6d 70  | [sm22198921].mp|
000000c0  34 0a                                             |4.|
000000c2

The inode of the dir is 2328314. And the two missing files are /tmp/dsg/sXSGJLTuZuW1FarwIkJs0w/b6mGjdxIRpaeanTo0rbh0A/QjMRrQZC_4WLhmHI1UOBcA/gocryptfs.longname.QV-UipdDXeUVdl05WruoEzBNPrQCfpu6OzJL0_QnDKY.name and its pair.

That helps a lot, thanks! I can reproduce the problem. The file name is exactly 176 bytes long and this was handled incorrectly. I will push a fix in a second. I also added a test case for all file name lengths 1-255.

Thanks for the report!