Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MhCHF-0000E7-8d for mharc-grub-devel@gnu.org; Fri, 28 Aug 2009 20:58:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhCHC-00007x-6s for grub-devel@gnu.org; Fri, 28 Aug 2009 20:58:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhCH6-0008KZ-8h for grub-devel@gnu.org; Fri, 28 Aug 2009 20:58:41 -0400 Received: from [199.232.76.173] (port=53424 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhCH6-0008KE-5F for grub-devel@gnu.org; Fri, 28 Aug 2009 20:58:36 -0400 Received: from mail-fx0-f226.google.com ([209.85.220.226]:41949) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MhCH5-0007IL-J7 for grub-devel@gnu.org; Fri, 28 Aug 2009 20:58:35 -0400 Received: by fxm26 with SMTP id 26so2275091fxm.42 for ; Fri, 28 Aug 2009 17:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=d5M8NUrpZic1GeKYuU8ka3bbfjIdaT4SEb4PI6Dd7BU=; b=Qhl1nH0SK8zzaSJ3ulzsDLELN/Xq0VnCPG9HikyG7j6q0u+7Xpm+GpxXNs2HUzygL7 mY08P8eqJCSQSIhv2DlsmreRDV0za7hQnbh6wH5Ov+BblfZxI66umgSLIMu9Nv/FPCI6 wuJVFyaEd2c7hS3ypiDKO2epA0XV9VuNO2I/I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=JII3UCGWSXwBAuyUi/30LTiVBb17/qFXnD6c+qxdVfZSx60pN2G6/WjS3cWDThiEXO u9r+e1eI5iCMizbuN3fC/KBLiqB/6o25xDntsoa5PyynxyZVm9yQIxmk9SkEXSPI1nr2 wdgUXoTZIu/mghFSXBljn5lQna6e/yByjeeDc= MIME-Version: 1.0 Received: by 10.204.26.134 with SMTP id e6mr1505944bkc.87.1251507509335; Fri, 28 Aug 2009 17:58:29 -0700 (PDT) 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> Date: Sat, 29 Aug 2009 02:58:29 +0200 Message-ID: From: "Vladimir 'phcoder' Serbinenko" To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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 00:58:42 -0000 On Sat, Aug 29, 2009 at 1:55 AM, Robert Millan wrote: > On Fri, Aug 28, 2009 at 07:58:39PM +0200, Felix Zielcke wrote: >> +#else /* ! HAVE_REALPATH */ >> + =A0grub_util_warn ("grub-mkrelpath might not work on your OS correctly= ."); >> + =A0/* make relative path absolute. =A0*/ >> + =A0if (*path !=3D '/') >> + =A0 =A0{ >> + =A0 =A0 =A0len =3D 1024; >> + =A0 =A0 =A0buf2 =3D xmalloc (len); >> + =A0 =A0 =A0do >> + =A0 =A0 { >> + =A0 =A0 =A0 buf2 =3D getcwd (buf2, len); >> + =A0 =A0 =A0 if (buf2 =3D=3D NULL) >> + =A0 =A0 =A0 =A0 { >> + =A0 =A0 =A0 =A0 =A0 if (errno !=3D ERANGE) >> + =A0 =A0 =A0 =A0 =A0 =A0 grub_util_error ("can not get current working = directory"); >> + =A0 =A0 =A0 =A0 =A0 else >> + =A0 =A0 =A0 =A0 =A0 =A0 len *=3D 2; >> + =A0 =A0 =A0 =A0 =A0 buf2 =3D xrealloc (buf2, len); >> + =A0 =A0 =A0 =A0 } >> + =A0 =A0 } while (buf2 =3D=3D NULL); >> + =A0 =A0 =A0buf =3D xmalloc (strlen (path) + strlen (buf2) + 1); >> + =A0 =A0 =A0strcpy (buf, buf2); >> + =A0 =A0 =A0strcat (buf, "/"); >> + =A0 =A0 =A0strcat (buf, path); >> + =A0 =A0} >> + =A0else >> + =A0 =A0 =A0buf =3D strdup (path); >> +#endif /* ! HAVE_REALPATH */ > > Please can you leave this part out? =A0realpath() 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. > >> + =A0 =A0 =A0p =3D strrchr (buf, '/'); >> + =A0 =A0 =A0if (p =3D=3D NULL) >> + =A0 =A0 grub_util_error ("FIXME: no / in buf. (make_system_path_relati= ve_to_its_root)"); > > Does this ever happen? Difficult to say but this check makes grub give a useful error message instead of silent crash. IMO former is preferable for long-term maintainance. I'll test the patch on FreeBSD as soon as I get it back online. > > -- > Robert Millan > > =A0The DRM opt-in fallacy: "Your data belongs to us. We will decide when = (and > =A0how) you may access your data; but nobody's threatening your freedom: = we > =A0still allow you to remove your data and not access it at all." > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > --=20 Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git