Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1CAFck-0000g0-N9 for mharc-grub-devel@gnu.org; Wed, 22 Sep 2004 18:30:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CAFcf-0000cO-W0 for grub-devel@gnu.org; Wed, 22 Sep 2004 18:30:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CAFcd-0000bT-Vd for grub-devel@gnu.org; Wed, 22 Sep 2004 18:30:01 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAFcd-0000b1-Qw for grub-devel@gnu.org; Wed, 22 Sep 2004 18:29:59 -0400 Received: from [195.113.31.125] (helo=artax.karlin.mff.cuni.cz) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CAFWc-0002Lh-CK for grub-devel@gnu.org; Wed, 22 Sep 2004 18:23:46 -0400 Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17122) id 2BFE54152; Thu, 23 Sep 2004 00:22:19 +0200 (CEST) Date: Thu, 23 Sep 2004 00:22:19 +0200 From: Tomas Ebenlendr To: The development of GRUB 2 Message-ID: <20040922222219.GB20249@artax.karlin.mff.cuni.cz> Mail-Followup-To: The development of GRUB 2 References: <20040922204335.GA13571@artax.karlin.mff.cuni.cz> <87u0tqm1wb.fsf@marco.marco-g.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87u0tqm1wb.fsf@marco.marco-g.com> User-Agent: Mutt/1.5.6i Subject: Re: hostfs patch X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: 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: Wed, 22 Sep 2004 22:30:05 -0000 > I don't see this change in the changelog. Please put every change you > make in the changelog and please make sure everything you describe in > the changelog entry can be found in that patch. Ok. > > diff -rupN -x CVS -x '*.mk' grub2_savannah/kern/dl.c grub2_wodiff/kern/dl.c > > --- grub2_savannah/kern/dl.c 2004-08-12 23:39:00.000000000 +0200 > > +++ grub2_wodiff/kern/dl.c 2004-08-12 23:48:50.000000000 +0200 > > @@ -548,7 +548,8 @@ grub_dl_load_file (const char *filename) > > goto failed; > > > > mod = grub_dl_load_core (core, size); > > - mod->ref_count = 0; > > + if (mod) > > + mod->ref_count = 0; > > Perhaps an error code should be returned as well, no? > I think that error code and return value is correct, there was only segfault in error case (in grub-emu). > > + if (hook (d->name)) > > + return 1; > > This looks funny... Is my mailclient or brain screwing things up or is > this a tab? > Yes there is ascii 9 character, should there be spaces? > > + disk->total_sectors = 1234; > > Why 1234? Can't it be set to 0? If I fill in a bogus value, I > usually use -1 because it is so obvious it is bogus... > Hmm, I probably forgot comment there. Some other fs considers disk bad, if it is too small and cannot read some sectors at beginning of it. This will stop fs autodetection too early to probe hostfs. This may be a bug, but that you will know better than me. (If other error than GRUB_ERR_BAD_FS is returned by fs, autodetection stops, So i implemented grub_util_fakedisk_read, to return GRUB_ERR_BAD_FS. grub_disk_read() or how is the correct name, will first look if sector is in range and then runs grub__read(), otherwise returns some error different form BAD_FS and filesystem will only propagate it.) > > +/* FIXME grub consider the fs in utf-8 => use only ascii (0-127) chars. */ > > GRUB uses UTF-8 for filesystems. So in that case everything can be > used (0-255), no? > One must have utf-8 locale, or something similar set. Otherwise (as in my case) file names are in iso-8859-2, or other charset. That is very incompatible with utf-8, because 128-255 means that it is not one-byte character in utf-8. So such character can mangle next charactes as well. I didn't tried to fix this, because grub is not considered to access files with non ascii characters. > > + /* Maybe loop to get as most as possible should be here, may be not. */ > > + rv = read ((int) file->data, buf, len); > > I think you should loop when using read because it can return with not > all requested data read. But I am not a POSIX expert so I can be > wrong here. > Okay, I will fix it. This was just first implementation, and it worked. (I guess that every file is regular file on local filesystem, then this works perfectly. I will probably choose to return error on EAGAIN, because we don't need to support this. (anyway, POSIX should not return EAGAIN if O_NONBLOCK is not set). > > + while ((dent = readdir (dir)) != 0) > > [...] > > > + lstat (pathbuf, &stent); > > Can these functions fail? Don't know. I will read manpages, and try to figure it out. I agree all other comments, and I will fix the patch in that way. -- Tomas 'ebi' Ebenlendr http://get.to/ebik PF 2004.72675739349