ratarmount icon indicating copy to clipboard operation
ratarmount copied to clipboard

Can't create indexes for .7z archives

Open cheebusjeebus opened this issue 2 months ago • 4 comments

He mounts ok, But his index location always is :memory: Is he a bug? Kindly see below behaviors (long messages!):

$ ratarmount --debug 3 --recreate-index --index-file ~/test-archive.index.sqlite test-archive.7z
[Info]     ratarmount.actions: No mount point specified. Automatically inferred:      actions.py:168
           /file-testings/test-archive
[Debug]    ratarmountcore.mountsource.factory: Try to open with: libarchive           factory.py:334
[Info]     ratarmountcore.mountsource.archives: Trying to open archive with           archives.py:46
           libarchive backend.
Creating new SQLite index database at :memory:
Creating offset dictionary for /file-testings/test-archive.7z ...
[Info]     ratarmountcore.mountsource.formats.libarchive: Successfully opened type libarchive.py:308
           '7-Zip' with libarchive. Using filters: []
[Info]     ratarmountcore.SQLiteIndex: Resorting files by path ...                SQLiteIndex.py:817
Creating offset dictionary for /file-testings/test-archive.7z took 0.01s
[Info]     ratarmountcore.mountsource.factory: Opened archive with libarchive         factory.py:337
           backend.
Created mount point at: /file-testings/test-archive
[Debug]    fuse: Set libFUSE callback for 'getattr' to wrapped <bound method         mfusepy.py:1214
           FUSE.getattr_fuse_2 of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping
           <bound method FuseMount.getattr of <ratarmount.FuseMount.FuseMount object
           at 0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'readlink' to wrapped <bound method        mfusepy.py:1214
           FUSE.readlink of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.readlink of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE value for 'getdir' uninitialized.                     mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'mknod' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'mkdir' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'unlink' uninitialized.                  mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'rmdir' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'symlink' uninitialized.                 mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'rename' uninitialized.                  mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'link' uninitialized.                    mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'chmod' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'chown' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Set libFUSE callback for 'truncate' to wrapped <bound method        mfusepy.py:1214
           FUSE.truncate_fuse_2 of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping
           <bound method FuseMount.truncate of <ratarmount.FuseMount.FuseMount
           object at 0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE value for 'utime' uninitialized.                      mfusepy.py:1192
[Debug]    fuse: Set libFUSE callback for 'open' to wrapped <bound method FUSE.open  mfusepy.py:1214
           of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound method
           FuseMount.open of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'read' to wrapped <bound method FUSE.read  mfusepy.py:1214
           of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound method
           FuseMount.read of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'write' to wrapped <bound method           mfusepy.py:1214
           FUSE.write of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.write of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'statfs' to wrapped <bound method          mfusepy.py:1214
           FUSE.statfs of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.statfs of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'flush' to wrapped <bound method           mfusepy.py:1214
           FUSE.flush of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.flush of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'release' to wrapped <bound method         mfusepy.py:1214
           FUSE.release of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.release of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'fsync' to wrapped <bound method           mfusepy.py:1214
           FUSE.fsync of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.fsync of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE callback for 'setxattr' uninitialized.                mfusepy.py:1192
[Debug]    fuse: Set libFUSE callback for 'getxattr' to wrapped <bound method        mfusepy.py:1214
           FUSE.getxattr of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.getxattr of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'listxattr' to wrapped <bound method       mfusepy.py:1214
           FUSE.listxattr of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping
           <bound method FuseMount.listxattr of <ratarmount.FuseMount.FuseMount
           object at 0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE callback for 'removexattr' uninitialized.             mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'opendir' uninitialized.                 mfusepy.py:1192
[Debug]    fuse: Set libFUSE callback for 'readdir' to wrapped <bound method         mfusepy.py:1214
           FUSE.readdir_fuse_2 of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping
           <bound method FuseMount.readdir of <ratarmount.FuseMount.FuseMount object
           at 0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE callback for 'releasedir' uninitialized.              mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'fsyncdir' uninitialized.                mfusepy.py:1192
[Debug]    fuse: Set libFUSE callback for 'init' to wrapped <bound method            mfusepy.py:1214
           FUSE.init_fuse_2 of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping
           <bound method FuseMount.init of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE callback for 'destroy' uninitialized.                 mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'access' uninitialized.                  mfusepy.py:1192
[Debug]    fuse: Set libFUSE callback for 'create' to wrapped <bound method          mfusepy.py:1214
           FUSE.create of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.create of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'ftruncate' to wrapped <bound method       mfusepy.py:1214
           FUSE.ftruncate of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping
           <bound method FuseMount.truncate of <ratarmount.FuseMount.FuseMount
           object at 0x7f4757d62510>>
[Debug]    fuse: Set libFUSE callback for 'fgetattr' to wrapped <bound method        mfusepy.py:1214
           FUSE.fgetattr of <mfusepy.FUSE object at 0x7f4757c78d70>> wrapping <bound
           method FuseMount.getattr of <ratarmount.FuseMount.FuseMount object at
           0x7f4757d62510>>
[Debug]    fuse: Leave libFUSE callback for 'lock' uninitialized.                    mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'utimens' uninitialized.                 mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'bmap' uninitialized.                    mfusepy.py:1192
[Debug]    fuse: Leave libFUSE value for 'flag_nullpath_ok' uninitialized.           mfusepy.py:1192
[Debug]    fuse: Leave libFUSE value for 'flag_nopath' uninitialized.                mfusepy.py:1192
[Debug]    fuse: Leave libFUSE value for 'flag_utime_omit_ok' uninitialized.         mfusepy.py:1192
[Debug]    fuse: Leave libFUSE value for 'flag_reserved' uninitialized.              mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'ioctl' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'poll' uninitialized.                    mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'write_buf' uninitialized.               mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'read_buf' uninitialized.                mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'flock' uninitialized.                   mfusepy.py:1192
[Debug]    fuse: Leave libFUSE callback for 'fallocate' uninitialized.               mfusepy.py:1192
$ ratarmount --version
ratarmount 1.2.0

Level 2 Dependencies:

mfusepy 3.0.0
ratarmountcore 0.10.0
rich 14.1.0
rich-argparse 1.7.1

Level 3 Dependencies:

indexed_gzip 1.8.8
indexed_zstd 1.6.0
libarchive-c 5.1
markdown-it-py 4.0.0
Pygments 2.19.2
python-xz 0.5.0
rapidgzip 0.15.2
rarfile 4.2
requests 2.32.5

Level 4 Dependencies:

charset-normalizer 3.4.3
idna 3.10
mdurl 0.1.2
typing_extensions 4.15.0
urllib3 2.5.0

System Software:

cpython 3.13.7
libsqlite3 3.50.4
libfuse 2.9
fusermount 2.9.9

Versioned Loaded Shared Libraries:

ld-linux-x86-64 2
libacl 1.1.2302
libarchive 13.8.1
libbz2 1.0.8
libc 6
libcap 2.76
libcrypto 3
libffi 8.2.0
libfuse 2.9.9
libgcc_s 1
libicudata 76.1
libicuuc 76.1
liblz4 1.10.0
liblzma 5.8.1
libm 6
libmpdec 4.0.1
libnss_mymachines 2
libnss_resolve 2
libpython3.13 1.0
libsqlite3 3.50.4
libssl 3
libstdc++ 6.0.34
libxml2 16.1.0
libz 1.3.1
libzstd 1.5.7

cheebusjeebus avatar Nov 16 '25 06:11 cheebusjeebus

Please try with --index-minimum-file-count 0. At some point, I decided that indexes are not necessary for small archives, e.g., archives with 1000 or fewer files, and I decided to set the default to avoid polluting everything with index files for such small archives. That option overrides that default.

mxmlnkn avatar Nov 17 '25 16:11 mxmlnkn

Thanks @mxmlnkn sir, however he still writes to :memory:? A test of one file inside .7z has the result of:

$ ratarmount --index-minimum-file-count 0 --recreate-index --index-file ~/test2-archive.index.sqlite test2-archive.7z
Creating new SQLite index database at :memory:
Creating offset dictionary for /file-testings/test2-archive.7z ...
Creating offset dictionary for /file-testings/test2-archive.7z took 0.00s
Created mount point at: /file-testings/test2-archive

cheebusjeebus avatar Nov 18 '25 00:11 cheebusjeebus

My bad. I did notice that you are not using py7zr. But then I skimmed the code and found that the libarchive backend uses my SQLiteIndex class and thought that it should work. It does not. Because of this:

https://github.com/mxmlnkn/ratarmount/blob/3e079a3f5e817a9c4ec012bee547cf407003ae52/core/ratarmountcore/mountsource/formats/libarchive.py#L541-L546

Even the py7zr backend, which you could use by installing it with pip install py7zr, does not support indexes because of:

https://github.com/mxmlnkn/ratarmount/blob/3e079a3f5e817a9c4ec012bee547cf407003ae52/core/ratarmountcore/mountsource/formats/py7zr.py#L120-L124

So, it's not a bug per se, but a missing feature, which will be hard to add because of insufficiencies with the 7z backends. (The code comments include multiple spelling errors. Sorry about that.)

mxmlnkn avatar Nov 18 '25 09:11 mxmlnkn

Sir please don't worry, I make spelling errors too (I haven't english as mother language). He appears a long bug to resolve, It's ok, I can patiently waiting. There is no rush presently for this features. :)

cheebusjeebus avatar Nov 23 '25 04:11 cheebusjeebus