Bug 199071

Summary: btrfs-progs: compilation fails with --enable-convert when e2fsprogs-1.44.0 is installed
Product: File System Reporter: Lars W. (polynomial-c)
Component: btrfsAssignee: Josef Bacik (josef)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alexander198961, devurandom, dsterba, sandalle
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.14.24 Subsystem:
Regression: No Bisected commit-id:

Description Lars W. 2018-03-09 17:38:05 UTC
x86_64-pc-linux-gnu-gcc -march=native -mtune=native -O2 -pipe -std=gnu90 -include config.h -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC
-I. -I./kernel-lib -I./libbtrfsutil    -c convert/source-ext2.c -o convert/source-ext2.o  \
        -DBTRFSCONVERT_EXT2=1 -DBTRFSCONVERT_REISERFS=0
convert/source-ext2.c: In function ‘ext2_xattr_check_entry’:
convert/source-ext2.c:425:13: error: ‘struct ext2_ext_attr_entry’ has no member
named ‘e_value_block’; did you mean ‘e_value_offs’?
  if (entry->e_value_block != 0 || value_size > size ||
             ^~~~~~~~~~~~~
             e_value_offs
make: *** [Makefile:300: convert/source-ext2.o] Error 1
Comment 1 Lars W. 2018-03-11 13:50:10 UTC
Might be related to this change in e2fsprogs:

https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=6a081f6d2a5cff0f5a077065aab39901d54bfb61
Comment 2 Oleksandr 2018-03-11 16:29:36 UTC
i will try to fix
Comment 3 Oleksandr 2018-03-11 17:13:56 UTC
There is change 
https://github.com/kdave/btrfs-progs/pull/105
Comment 4 Lars W. 2018-03-12 09:28:52 UTC
Is this still backwards compatible with older e2fsprogs?
Comment 5 Oleksandr 2018-03-12 19:59:48 UTC
i will try to fix this
Comment 6 Oleksandr 2018-03-15 06:00:42 UTC
to make it backwards I will try to calculate offset this code:
__u32 *ptr_e_value_block= (__u32*)((size_t)entry + offsetof(struct ext2_ext_attr_entry,e_value_size) - offsetof(struct ext2_ext_attr_entry,e_value_offs));

but still need add tests for this
Comment 7 David Sterba 2018-03-16 11:24:28 UTC
I've opened https://github.com/kdave/btrfs-progs/issues/110 as it's for btrfs-progs.

For a quick fix we might do a simple version check of e2fsprogs and slap an ifdef to the code.

The backward compatibility with older e2fsprogs is desired, as there are long term distros using btrfs-progs.
Comment 8 David Sterba 2018-03-19 12:59:05 UTC
Fix added to devel, will be in the next release. Closing.