Ubuntu で extundelete をビルドする際に insertionops.cc:36:36: error: ‘const struct ext2_inode’ has no member named ‘i_dir_acl’; did you mean ‘i_file_acl’? というエラーが出る場合

環境

以下の環境で標題のエラーが起きました。

  • Ubuntu 18.04 (x64)
  • $ sudo apt-get install gcc libc6-dev make libssl-dev zlib1g-dev e2fslibs-dev 済み
  • SourceForge より 0.2.4 をもってきて手元でビルドしました
  • 以下のようなエラーが出ました*1
$ ./configure --prefix=/tmp/a && make && make install
Configuring extundelete 0.2.4
Writing generated files to disk
make -s all-recursive
Making all in src
extundelete.cc: In function ‘int extundelete_test_inode_bitmap(ext2_filsys, ext2_ino_t)’:
extundelete.cc:196:5: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
  if(! EXT2_SB(fs->super)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extundelete.cc: In function ‘ext2_ino_t find_inode(ext2_filsys, ext2_filsys, ext2_inode*, std::__cxx11::string, int)’:
extundelete.cc:1272:29: warning: narrowing conversion of ‘search_flags’ from ‘int’ to ‘ext2_ino_t {aka unsigned int}’ inside { } [-Wnarrowing]
    buf, match_name2, priv, 0};
                             ^
extundelete.cc: In function ‘errcode_t restore_file(ext2_filsys, ext2_filsys, const string&)’:
extundelete.cc:1522:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if (LINUX_S_ISDIR(inode->i_mode) && inode->i_blocks > 0)
   ^~
extundelete.cc:1524:4: note: ...this statement, but the latter is misleadingly indented as if i  1 #ifndef EXT2_FLAT_INCLUDES
t were guarded by the ‘if’
    print_directory_inode(fs, inode, ino);
    ^~~~~~~~~~~~~~~~~~~~~
cli.cc: In function ‘errcode_t examine_fs(ext2_filsys)’:
cli.cc:337:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if(strlen(name) > 0)
     ^~
cli.cc:339:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      if(errcode)  com_err(Config::progname.c_str(), errcode, "while restoring file %s.", name);
      ^~
insertionops.cc: In function ‘std::ostream& operator<<(std::ostream&, const ext2_inode&)’:
insertionops.cc:36:36: error: ‘const struct ext2_inode’ has no member named ‘i_dir_acl’; did you mean ‘i_file_acl’?
   os << "Directory ACL: " << inode.i_dir_acl << std::endl;
                                    ^~~~~~~~~
                                    i_file_acl
Makefile:437: recipe for target 'extundelete-insertionops.o' failed
make[2]: *** [extundelete-insertionops.o] Error 1
Makefile:268: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
Makefile:208: recipe for target 'all' failed
make: *** [all] Error 2

エラーのポイント

エラーのポイントは以下の行です。この行以外はwarningかnoteです。

insertionops.cc:36:36: error: ‘const struct ext2_inode’ has no member named ‘i_dir_acl’; did you mean ‘i_file_acl’?
   os << "Directory ACL: " << inode.i_dir_acl << std::endl;
                                    ^~~~~~~~~
                                    i_file_acl

修正方法(結論)

src/insertionops.cc 内のコードを以下のとおりに一箇所書き換えます。

--- a/src/insertionops.cc    2012-12-30 18:23:32.000000000 +0100
+++ b/src/insertionops.cc   2018-05-07 22:58:13.065868723 +0200
@@ -33,7 +33,7 @@
   os << "File flags: " << inode.i_flags << std::endl;
   os << "File version (for NFS): " << inode.i_generation << std::endl;
   os << "File ACL: " << inode.i_file_acl << std::endl;
-  os << "Directory ACL: " << inode.i_dir_acl << std::endl;
+  os << "Directory ACL: " << inode.i_size_high << std::endl;
   os << "Fragment address: " << inode.i_faddr << std::endl;
   os << "Direct blocks: ";
   for (int n = 0; n < EXT2_NDIR_BLOCKS; n++)

参考ページ

これは Ticket としてすでに上がっていますが、まだ取り込まれていないようです。

sourceforge.net

正しくビルドできることを確認

上記の修正をした後に改めてビルドすると、無事通ることが確認できました。

Configuring extundelete 0.2.4
Writing generated files to disk
make -s all-recursive
Making all in src
Making install in src
  /usr/bin/install -c extundelete '/tmp/hoge/bin'

*1:色がついていないので分かりづらいです

Powered by はてなブログ