manjaro [arch-like], Linux kernel 6.12, gcc 15.1.1, makepkg/pkgbuild dependencies:
depends=(util-linux-libs zlib bzip2 lzo readline ncurses e2fsprogs)
makedepends=(util-linux sqlite openssl)
ext2_inode_large is defined in:
and referenced in:
indexer_test.c
gcc offers suggestions as to the correct member name and, with a bit of sleuthing:
sqlite_indexer.c:384:17: error: 'struct ext2_inode_large' has no member named 'di_atime'; did you mean 'i_atime'?
sqlite_indexer.c:386:17: error: 'struct ext2_inode_large' has no member named 'di_mtime'; did you mean 'i_mtime'?
sqlite_indexer.c:388:17: error: 'struct ext2_inode_large' has no member named 'di_ctime'; did you mean 'i_ctime'?
sqlite_indexer.c:397:31: error: 'struct ext2_inode_large' has no member named 'di_mode'; did you mean 'i_mode'?
sqlite_indexer.c:397:42: error: 'struct ext2_inode_large' has no member named 'di_nlink' (indexer_test.c references dinode.i_links_count = buf->st_nlink; which suggests member name 'i_links_count' is equivalent to 'nlink')
sqlite_indexer.c:397:58: error: 'struct ext2_inode_large' has no member named 'di_uid'; did you mean 'i_uid'?
sqlite_indexer.c:397:70: error: 'struct ext2_inode_large' has no member named 'di_gid'; did you mean 'i_gid'?
sqlite_indexer.c:397:80: error: 'struct ext2_inode_large' has no member named 'di_rdev' (indexer_test.c references dinode.i_block[0] = buf->st_rdev; which suggests member name 'i_block' is equivalent to 'rdev')
sqlite_indexer.c:397:95: error: 'struct ext2_inode_large' has no member named 'di_size'; did you mean 'i_size'?
sqlite_indexer.c:397:124: error: 'struct ext2_inode_large' has no member named 'di_extraisize'; did you mean 'i_extra_isize'?
sqlite_indexer.c:397:162: error: 'struct ext2_inode_large' has no member named 'di_file_acl'; did you mean 'i_file_acl'?
diff a/common/sqlite_indexer.c b/common/sqlite_indexer.c
index 8ce80f8..10b77e8 100644
--- a/common/sqlite_indexer.c
+++ b/common/sqlite_indexer.c
@@ -381,20 +381,20 @@ sqlite_addInode(struct ext2_inode_large *dp, dump_ino_t ino, int metadata_only)
mts[0] = 0;
cts[0] = 0;
- t = dp->di_atime;
+ t = dp->i_atime;
strftime(ats, sizeof ats, "%FT%T", gmtime(&t));
- t = dp->di_mtime;
+ t = dp->i_mtime;
strftime(mts, sizeof ats, "%FT%T", gmtime(&t));
- t = dp->di_ctime;
+ t = dp->i_ctime;
strftime(cts, sizeof ats, "%FT%T", gmtime(&t));
- // xattr: dp->di_extraisize != 0
- // acl: dp->di_file_acl (inode?)
+ // xattr: dp->i_extra_isize != 0
+ // acl: dp->i_file_acl (inode?)
// se linux?...
snprintf(buffer, sizeof buffer,
"insert into inode(backup_id, ino, is_deleted, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, has_xattr, has_acl, volume, recno) values(1, %d, '%s', %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %lld)\n",
- ino, "N", dp->di_mode, dp->di_nlink, dp->di_uid, dp->di_gid, dp->di_rdev, dp->di_size, ats, mts, cts, (dp->di_extraisize == 0) ? "N" : "Y", (dp->di_file_acl != 0) ? "Y" : "N", spcl.c_volume, u_spcl_c_tapea());
+ ino, "N", dp->i_mode, dp->i_links_count, dp->i_uid, dp->i_gid, dp->i_block, dp->i_size, ats, mts, cts, (dp->i_extra_isize == 0) ? "N" : "Y", (dp->i_file_acl != 0) ? "Y" : "N", spcl.c_volume, u_spcl_c_tapea());
EXEC(db, buffer);
OpenAi chatGPT offered, and gave me permission, to post its analysis:
Yep — with just the link and the compiler output, that’s enough to fix it.
Your file is using old UFS-style di_ member names on an ext2_inode_large. In e2fsprogs’ headers the members are i_ (and one of them changes name entirely: links → i_links_count). Here’s the authoritative struct so you can see the field names you actually have: i_atime, i_mtime, i_ctime, i_mode, i_uid, i_gid, i_links_count, i_size, i_file_acl, i_extra_isize, etc.
git.osdyson.ru
Also: ext2/3/4 inodes don’t have an rdev field. For character/block device nodes, the device number is stored in the inode’s first direct block pointer (i_block[0]); otherwise it’s just 0.
tldp.org f.osdev.org
Below is a minimal, working patch against your current sqlite_indexer.c that:
I used your raw file to anchor line numbers/surrounding code.
SourceForge
Why this is correct:
Thanks. The easiest thing is just to build with
--disable-sqliteI'm not sure how useful this sql indexer stuff is, there's absolutely nothing to use what gets written to the db! I've just pushed my wip branch so you can get my fix here:https://sourceforge.net/p/dump/code/ci/6e1ec6d65c3dc7d57640fa55b4d541d262ae6aca/
My branch needs some minor cleanups, and removing some of the commits that drag in some large binary images for my testing but addresses a number of open bugs and feature requests.
My goal with the 0.4b53 release was to move to having tests that don't require root. However, I'm waiting on upstream to review/import a patch that supports
SEEK_DATA/SEEK_HOLEfor the ext4 fuse implementation as most of the tests can't work without that so it's been stalled for a while.Fixed in v0.4b53