From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UEftD-0007aK-TL for mharc-grub-devel@gnu.org; Sun, 10 Mar 2013 09:02:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEftA-0007Zm-FF for grub-devel@gnu.org; Sun, 10 Mar 2013 09:02:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEft8-00054b-Ni for grub-devel@gnu.org; Sun, 10 Mar 2013 09:02:08 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:40939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEft8-00054P-I6 for grub-devel@gnu.org; Sun, 10 Mar 2013 09:02:06 -0400 Received: by mail-wi0-f173.google.com with SMTP id hq4so444142wib.6 for ; Sun, 10 Mar 2013 06:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type; bh=nYlF4LpE4bAy6v3XxLxZowsSNpeqxtEeeo8/yzsklno=; b=B3Ph90tUGqrCsRZx321QTPgIe5kwkfjPe/6cxDHMpYh/15KGFnnnoCuGwU3ywEpQT+ HxBHcbRT33inDdHwxDNb6L1cT1l5cIt6l50dNui5JptO0B+g9nqiscpE50Ay0rqjokqb 8KcVezsTYIlToPlWVE9GzhT+su355wjhRx6KVmaRG2FqIq/MpoblF7pCqUbRiNwEqmfR f+GoCGe/+uOT2E6WqJhUIKGFS62L+aWXB2szypPpLNunPyW0OstRRFYb8xCemmyVsapS qJLnaMO6luPBRUnHNjU87ZK2aG57++f9ph9hn3IYbgCvwLxUWSojl2HeNTiT14Rvp+yB wN6A== X-Received: by 10.195.12.133 with SMTP id eq5mr13626519wjd.52.1362920525210; Sun, 10 Mar 2013 06:02:05 -0700 (PDT) Received: from debian.x201.phnet (245-188.1-85.cust.bluewin.ch. [85.1.188.245]) by mx.google.com with ESMTPS id dm9sm9513023wib.3.2013.03.10.06.02.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 10 Mar 2013 06:02:04 -0700 (PDT) Message-ID: <513C8441.60106@gmail.com> Date: Sun, 10 Mar 2013 14:01:53 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] Ignore symlink traversal failures in grub-mount readdir References: <20121012160954.GH17188@riva.dynamic.greenend.org.uk> <20130309204726.5e70c448@opensuse.site> In-Reply-To: <20130309204726.5e70c448@opensuse.site> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigDB30CCF0FA9ED3888EEE767A" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22d X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 13:02:09 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDB30CCF0FA9ED3888EEE767A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09.03.2013 17:47, Andrey Borzenkov wrote: > =D0=92 Fri, 12 Oct 2012 17:09:54 +0100 > Colin Watson =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >=20 >> 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 simpl= e. >> >> r3036.1.15 introduced support for filling in the attributes of files i= n >> fuse_readdir. However, symlinks to directories are passed to call_fil= l >> 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 t= o >> 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 fair= ly >> 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? >> >=20 > The only reason to call grub_file_open() is to fetch file size, and fil= e > size is already available when hooks are called. So what about patch > below? It fixes problem for me, and it trivial enough. This allows > directory listing to work again. I can extend it with info.is_link to > return proper filetype to FUSE, but implementing full support needs > adding readlink that is a separate topic. >=20 > I tested it with ext4 and cpio and it works. Testing on more systems > (in particular, NTFS, which is the only one with non-trivial change) is= > appreciated. >=20 Some time ago I made a similar patch but for another motivation: current code is way too inefficient for large directories as you have to rescan directory for every file. The problem with this patch is 10 bytes increase of core.img. This may be acceptable given this problem (it happens in ls on runtime as well) and inefficency of scanning. --------------enigDB30CCF0FA9ED3888EEE767A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlE8hEEACgkQNak7dOguQgmpbQEAg7S2ecdcVCe2fXtDL+EnQjIv LAxKkyvR+v2Ws7Fijh0A/3I11q5gtW1CsMPhyCgtxVkoaWeNR+8ZNFA7yGjJI9Lj =WfPZ -----END PGP SIGNATURE----- --------------enigDB30CCF0FA9ED3888EEE767A--