This is very much a temporary hack, so I'm sending it here for discussion rather than just committing it even though it's quite simple.
r3036.1.15 introduced support for filling in the attributes of files in fuse_readdir. However, symlinks to directories are passed to call_fill with info.dir unset; call_fill will then try to open them with grub_file_open, and get GRUB_ERR_BAD_FILE_TYPE because it's ultimately a directory not a regular file. It then causes the whole readdir call to fail. The net effect is that if you, for example, have a symlink anywhere in the top level of a filesystem, then the entire filesystem appears empty in grub-mount. This is the root cause of https://bugs.launchpad.net/bugs/1051306. I think that the proper solution is to pass the full grub_fshelp_filetype to dirhook functions, which would permit implementing true symlink support in grub-mount. That would be a fairly large change that I don't have time for at the moment. As a stopgap, I suggest that we ignore errors from individual grub_file_open calls during fuse_readdir. How does this patch look? 2012-10-12 Colin Watson <cjwat...@ubuntu.com> === modified file 'util/grub-mount.c' --- util/grub-mount.c 2012-03-08 18:09:05 +0000 +++ util/grub-mount.c 2012-10-12 16:08:39 +0000 @@ -292,7 +292,20 @@ fuse_readdir (const char *path, void *bu file = grub_file_open (tmp); free (tmp); if (! file) - return translate_error (); + { + /* We cannot handle symlinks properly yet, and symlinks to + directories will cause us to reach here. Symlink loops or + dangling symlinks will also cause an error. For the + meantime, while treating these as zero-length files is wrong, + it's better than failing the whole readdir call by returning + translate_error (). + + Ultimately, we should be able to tell from the + grub_dirhook_info that this is a symlink, and fill in the + attributes of the symlink rather than its target. */ + grub_errno = GRUB_ERR_NONE; + return 0; + } st.st_size = file->size; grub_file_close (file); } Thanks, -- Colin Watson [cjwat...@ubuntu.com] _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel