Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1BV8Cv-0006jA-UN for mharc-grub-devel@gnu.org; Tue, 01 Jun 2004 08:17:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BV8Cu-0006gc-3Y for grub-devel@gnu.org; Tue, 01 Jun 2004 08:17:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BV8Cs-0006eZ-67 for grub-devel@gnu.org; Tue, 01 Jun 2004 08:17:27 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BV8Cs-0006e6-3P for grub-devel@gnu.org; Tue, 01 Jun 2004 08:17:26 -0400 Received: from [195.113.31.125] (helo=artax.karlin.mff.cuni.cz) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BV8CY-0007Ny-UE for grub-devel@gnu.org; Tue, 01 Jun 2004 08:17:07 -0400 Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17122) id E8E664031; Tue, 1 Jun 2004 14:17:04 +0200 (CEST) Date: Tue, 1 Jun 2004 14:17:04 +0200 To: grub-devel@gnu.org Message-ID: <20040601121704.GA4680@artax.karlin.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i From: ebik@artax.karlin.mff.cuni.cz (Tomas Ebenlendr) Subject: ext2 find patch X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list Reply-To: ebik@ucw.cz, The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2004 12:17:28 -0000 I don't understand the ext2 fs very well, but when I tried to install grub2 on my computer, I had no access to files in subdirectories. I installed bochs and tried to find what happened. And I found a strange thing: newly created ext2 haven't this problem. So I use ext2resize to get from real filesystem smaller image (1.44M floppy). It is ext2, e2fsck tells it is clean, but dirent.filetype == 0 even for directories. So I moved the directory check to another place, and changed it to test inode.mode. Here is the patch (cvs diff -u): ---------------------------------------------------------------------------- Index: fs/ext2.c =================================================================== RCS file: /cvsroot/grub/grub2/fs/ext2.c,v retrieving revision 1.6 diff -u -r1.6 ext2.c --- fs/ext2.c 4 Apr 2004 13:46:00 -0000 1.6 +++ fs/ext2.c 1 Jun 2004 12:12:19 -0000 @@ -422,6 +422,15 @@ if (grub_errno) goto fail; + /* Check if it is directory */ + /* NOTE: dirent.filetype==FILETYPE_DIRECTORY check sometimes fails, + * (I don't know why,) but this will not */ + if (!(grub_le_to_cpu16 (inode->mode) & 040000)) + { + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); + goto fail; + } + /* Search the file. */ while (fpos < grub_le_to_cpu32 (inode->size)) { @@ -526,12 +535,6 @@ currinode = grub_le_to_cpu32 (dirent.inode); name = next; - if (dirent.filetype != FILETYPE_DIRECTORY) - { - grub_error (GRUB_ERR_BAD_FILE_TYPE, - "not a directory"); - goto fail; - } break; } else /* Found it! */ ---------------------------------------------------------------------------- -- Tomas 'ebi' Ebenlendr http://get.to/ebik PF 2004.41690175319