alperakcan / fuse-ext2

Fuse-ext2 is a multi OS FUSE module to mount ext2, ext3 and ext4 file system devices and/or images with read write support.
GNU General Public License v2.0
800 stars 127 forks source link

Broken readdir() implementation #52

Open anestisb opened 7 years ago

anestisb commented 7 years ago

Description

readdir() appears to be missing some entries when mounting ext4 filesystem (from Android factory images if that matters). It appears that problematic behavior is consistent across different runs of the same image file (same files are missing).

To be honest I don't have the time at the moment to get to the bottom of it, so not sure which component introduces the bug (might be a combination with e2fsprogs deps). You can find some additional info around the case that surfaced the bug here.

Temp workaround

Change default to walk_dir() / ext2fs_dir_iterate().

$ git diff
diff --git a/fuse-ext2/op_readdir.c b/fuse-ext2/op_readdir.c
index 60e1890..203d60f 100644
--- a/fuse-ext2/op_readdir.c
+++ b/fuse-ext2/op_readdir.c
@@ -25,7 +25,7 @@ struct dir_walk_data {
        fuse_fill_dir_t filler;
 };

-#define _USE_DIR_ITERATE2 1
+//#define _USE_DIR_ITERATE2 1
 #if defined(_USE_DIR_ITERATE2) && (_USE_DIR_ITERATE2 == 1)
 static int walk_dir2 (ext2_ino_t dir, int   entry, struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *vpsid)
 {

System info

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.2
BuildVersion:   16C67

$ xcode-select -v
xcode-select version 2347.

$ cat /Library/Filesystems/osxfuse.fs/Contents/version.plist | grep 'CFBundleVersion' -A1
    <key>CFBundleVersion</key>
    <string>3.5.4</string>

$ cat e2fsprogs-1.43.3/version.h | grep E2FSPROGS_VERSION
#define E2FSPROGS_VERSION "1.43.3"
alperakcan commented 7 years ago

i will check dir_iterate as soon as possible, for now dir_iterete_2 is disabled 48cc22e05768514d2617f8e52de331426882a2e7