From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MhIie-00076k-Vs for mharc-grub-devel@gnu.org; Sat, 29 Aug 2009 03:51:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhIid-00074c-N8 for grub-devel@gnu.org; Sat, 29 Aug 2009 03:51:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhIiY-0006yO-RV for grub-devel@gnu.org; Sat, 29 Aug 2009 03:51:27 -0400 Received: from [199.232.76.173] (port=33331 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhIiY-0006y3-J9 for grub-devel@gnu.org; Sat, 29 Aug 2009 03:51:22 -0400 Received: from mx20.gnu.org ([199.232.41.8]:46532) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MhIiX-00021Q-2K for grub-devel@gnu.org; Sat, 29 Aug 2009 03:51:21 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MhIiV-0007o2-QR for grub-devel@gnu.org; Sat, 29 Aug 2009 03:51:20 -0400 Received: from [85.180.7.230] (e180007230.adsl.alicedsl.de [85.180.7.230]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MKt72-1MhIiS14Lf-000Bxf; Sat, 29 Aug 2009 09:51:16 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <20090828235514.GA17856@thorin> References: <1251463992.2547.24.camel@fz.local> <20090828162828.GB14976@thorin> <1251482319.2547.48.camel@fz.local> <20090828235514.GA17856@thorin> Content-Type: text/plain Date: Sat, 29 Aug 2009 09:51:15 +0200 Message-Id: <1251532275.2624.2.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.27.91 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1/G2tEeUa1hXxfr4MgYxnouAYcte5npS/9+NLA gmDcsMj7R4SHLvCXjvMj9XD++OaDlQVdChdKjX1FIP/83+nq3n v6SeRsZk48a10caDZsfvEf0hQec2MSF X-Detected-Operating-System: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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: Sat, 29 Aug 2009 07:51:27 -0000 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? > > + 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. -- Felix Zielcke Proud Debian Maintainer