google / fuse-archive

FUSE file system for archives and compressed files (ZIP, RAR, 7Z, ISO, TGZ, XZ...)
Apache License 2.0
150 stars 14 forks source link

Empty folders not mounted #17

Open mattmart3 opened 1 year ago

mattmart3 commented 1 year ago

I am noticing that if a tar.gz archive contains empty folders, these are not mounted. Is this behavior intended or am I missing something?

Here how to reproduce:

  1. Create test archive
    
    $ mkdir test-fuse-archive
    $ mkdir -p test-fuse-archive/dir1/dir1.1
    $ mkdir -p test-fuse-archive/dir2/dir2.1
    $ echo "existing file" > test-fuse-archive/dir2/dir2.1/file

$ find test-fuse-archive test-fuse-archive test-fuse-archive/dir2 test-fuse-archive/dir2/dir2.1 test-fuse-archive/dir2/dir2.1/file test-fuse-archive/dir1 test-fuse-archive/dir1/dir1.1


2. The empty folder is properly extracted by tar

$ mkdir out_tgz && tar xvaf test_fuse_archive.tgz -C out_tgz $ find out_tgz out_tgz out_tgz/test-fuse-archive out_tgz/test-fuse-archive/dir2 out_tgz/test-fuse-archive/dir2/dir2.1 out_tgz/test-fuse-archive/dir2/dir2.1/file out_tgz/test-fuse-archive/dir1 out_tgz/test-fuse-archive/dir1/dir1.1


3. `fuse-archive` doesn't mount neither the empty folder `dir1.1` nor its parent folder `dir1`:

git clone https://github.com/google/fuse-archive.git -b v0.1.14 cd fuse-archive make ./out/fuse-archive ~/test_fuse_archive.tgz /mnt/tmp find /mnt/tmp /mnt/tmp /mnt/tmp/test-fuse-archive /mnt/tmp/test-fuse-archive/dir2 /mnt/tmp/test-fuse-archive/dir2/dir2.1 /mnt/tmp/test-fuse-archive/dir2/dir2.1/file



Feel free to close the issue if this is the intended behavior.
fdegros commented 1 year ago

Thanks Matteo for the detailed bug report.

I confirm that I can reproduce the issue. Indeed, empty folders, or even folder trees that don't contain any file, are not visible in the mounted archive.

fdegros commented 1 year ago

Assigning to Nigel, who has a more in-depth knowledge of how fuse-archive works.