From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N4cX4-0006VH-1v for mharc-grub-devel@gnu.org; Sun, 01 Nov 2009 10:39:54 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N4cX2-0006V4-Ok for grub-devel@gnu.org; Sun, 01 Nov 2009 10:39:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N4cWy-0006Q1-7f for grub-devel@gnu.org; Sun, 01 Nov 2009 10:39:52 -0500 Received: from [199.232.76.173] (port=58501 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4cWy-0006Pr-4q for grub-devel@gnu.org; Sun, 01 Nov 2009 10:39:48 -0500 Received: from moutng.kundenserver.de ([212.227.126.188]:61187) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N4cWx-0000p9-JF for grub-devel@gnu.org; Sun, 01 Nov 2009 10:39:47 -0500 Received: from [85.180.12.171] (e180012171.adsl.alicedsl.de [85.180.12.171]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MKdiF-1N3nRo24Gd-0027sI; Sun, 01 Nov 2009 16:39:44 +0100 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <1251532275.2624.2.camel@fz.local> References: <1251463992.2547.24.camel@fz.local> <20090828162828.GB14976@thorin> <1251482319.2547.48.camel@fz.local> <20090828235514.GA17856@thorin> <1251532275.2624.2.camel@fz.local> Content-Type: text/plain; charset="UTF-8" Date: Sun, 01 Nov 2009 16:39:42 +0100 Message-ID: <1257089982.3407.1.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+Kfxu81cnKIxjE0dvbemg5UI0Uaj/BLLLSscS PL7sHEw8nKUUWX0Pe4LPJb+y7VTHvK6XrsY5Cad14PcwL7ooRq L/IpkFojDI+rZ7zgk4XPw== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATH] grub-mkrelpath 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: Sun, 01 Nov 2009 15:39:52 -0000 Am Samstag, den 29.08.2009, 09:51 +0200 schrieb Felix Zielcke: > Am Samstag, den 29.08.2009, 01:55 +0200 schrieb Robert Millan: > > On Fri, Aug 28, 2009 at 07:58:39PM +0200, Felix Zielcke wrote: > > > +#else /* ! HAVE_REALPATH */ > > > + grub_util_warn ("grub-mkrelpath might not work on your OS correctly."); > > > + /* make relative path absolute. */ > > > + if (*path != '/') > > > + { > > > + len = 1024; > > > + buf2 = xmalloc (len); > > > + do > > > + { > > > + buf2 = getcwd (buf2, len); > > > + if (buf2 == NULL) > > > + { > > > + if (errno != ERANGE) > > > + grub_util_error ("can not get current working directory"); > > > + else > > > + len *= 2; > > > + buf2 = xrealloc (buf2, len); > > > + } > > > + } while (buf2 == NULL); > > > + buf = xmalloc (strlen (path) + strlen (buf2) + 1); > > > + strcpy (buf, buf2); > > > + strcat (buf, "/"); > > > + strcat (buf, path); > > > + } > > > + else > > > + buf = strdup (path); > > > +#endif /* ! HAVE_REALPATH */ > > > > Please can you leave this part out? realpath() is POSIX, so it should be > > present in all systems we support, and if it isn't, we should be using a > > complete implementation from Gnulib instead, but we don't need to worry > > about this untill/unless someone reports it as a problem. > > Ok, but should I then check in configure.ac that realpath is required or > something else? > Or should I just assume that realpath is always avaible? For now I assume that realpath is avaible. > > > + p = strrchr (buf, '/'); > > > + if (p == NULL) > > > + grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)"); > > > > Does this ever happen? > > As Vladimir said, it shouldn't ever happen, but I thought it would be > better to check for this explicitly instead of core dumping in that > case. I added now a comment that this shouldn't ever happen. New version avaible at bzr+ssh://bzr.savannah.gnu.org/grub/people/fzielcke/mkrelpath -- Felix Zielcke Proud Debian Maintainer and GNU GRUB developer