andrew-grechkin / fuse3-p7zip

fuse3 file system that uses the p7zip library to mount archives
GNU General Public License v3.0
20 stars 1 forks source link

folder permission problem #11

Closed tsankuanglee closed 1 day ago

tsankuanglee commented 2 days ago

I'm on Arch, using this package, which builds on this comment.

I'm getting 644 on the mount point (directory).

$ mkdir /tmp/bug-report
$ cd /tmp/bug-report
$ mkdir source
$ echo 12345 > source/test.txt
$ 7z a source.7z source

7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Scanning the drive:
1 folder, 1 file, 6 bytes (1 KiB)

Creating archive: source.7z

Items to compress: 2

Files read from disk: 1
Archive size: 178 bytes (1 KiB)
Everything is Ok
$ mkdir p7z-mnt
$ fuse3-p7zip -o allow_other source.7z p7z-mnt
$ ls -al
total 8
drwxr-xr-x  4 user user 100 Nov 10 02:08 .
drwxrwxrwt 23 root  root  540 Nov 10 02:08 ..
drw-r--r--  1 user user 178 Nov 10 02:07 p7z-mnt
drwxr-xr-x  2 user user  60 Nov 10 02:07 source
-rw-r--r--  1 user user 178 Nov 10 02:07 source.7z
$ cd p7z-mnt/source/
$ ls
test.txt
$ cat test.txt
12345

Although I can still enter the directory and read its contents, the directory's lacking "x" permission becomes a problem when I use a layer fs, e.g. unionfs:

$ cd /tmp/bug-report
$ mkdir single-layer-mnt
$ unionfs p7z-mnt=RO single-layer-mnt
$ ls -al
total 12
drwxr-xr-x  6 user user 140 Nov 10 02:23 .
drwxrwxrwt 23 root  root  540 Nov 10 02:24 ..
drw-r--r--  1 user user 178 Nov 10 02:07 p7z-mnt
drw-r--r--  1 user user 178 Nov 10 02:07 single-layer-mnt
drwxr-xr-x  2 user user  60 Nov 10 02:07 source
drwxr-xr-x  2 user user  60 Nov 10 02:23 source2
-rw-r--r--  1 user user 178 Nov 10 02:07 source.7z
$ cd single-layer-mnt/
sh: cd: single-layer-mnt/: Permission denied

Yes, there are workarounds like this one:

$ cd /tmp/bug-report/
$ umount single-layer-mnt/
$ mkdir multilayer-mnt
$ mkdir source2
$ touch source2/test2.txt
$ unionfs source2=RW:p7z-mnt=RO multilayer-mnt/
$ ls -al
total 8
drwxr-xr-x  7 user user 160 Nov 10 02:26 .
drwxrwxrwt 23 root  root  540 Nov 10 02:27 ..
drwxr-xr-x  1 user user  60 Nov 10 02:23 multilayer-mnt
drw-r--r--  1 user user 178 Nov 10 02:07 p7z-mnt
drwxr-xr-x  2 user user  40 Nov 10 02:23 single-layer-mnt
drwxr-xr-x  2 user user  60 Nov 10 02:07 source
drwxr-xr-x  2 user user  60 Nov 10 02:23 source2
-rw-r--r--  1 user user 178 Nov 10 02:07 source.7z
$ ls multilayer-mnt/
source  test2.txt

However, I wonder whether it's possible to fix the mount point directory permisison so it behaves like fuseiso (555), since the write action is not implemented in fuse3-p7zip anyway.

$ mkdir /tmp/fuseiso-example
$ cd /tmp/fuseiso-example
$ mkdir source; echo 12345 > source/test.txt
$ mkisofs -o test.iso source
Setting input-charset to 'UTF-8' from locale.
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
175 extents written (0 MB)
$ mkdir iso-mnt
$ fuseiso test.iso iso-mnt/
$ ls -al
total 353
drwxr-xr-x  4 user user    100 Nov 10 02:38 .
drwxrwxrwt 24 root  root     560 Nov 10 02:38 ..
dr-xr-xr-x  1 root  root    2048 Nov 10 02:37 iso-mnt
drwxr-xr-x  2 user user     60 Nov 10 02:37 source
-rw-r--r--  1 user user 358400 Nov 10 02:37 test.iso
$ cat iso-mnt/test.txt
12345
$ touch iso-mnt/another.txt
touch: cannot touch 'iso-mnt/another.txt': Function not implemented

Thanks in advance! I use this utility heavily in my project and am very grateful for your excellent work!

andrew-grechkin commented 2 days ago

Hi @tsankuanglee, can you please check that branch agrechkin/fix-11 is actually fixes issues you have

tsankuanglee commented 2 days ago

@andrew-grechkin

Hi @tsankuanglee, can you please check that branch agrechkin/fix-11 is actually fixes issues you have

That did it! Thank you so much!