From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VqAEp-0003Av-Ex for mharc-grub-devel@gnu.org; Mon, 09 Dec 2013 18:27:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqAEf-00038Y-Qs for grub-devel@gnu.org; Mon, 09 Dec 2013 18:27:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqAEX-00056M-Ck for grub-devel@gnu.org; Mon, 09 Dec 2013 18:27:33 -0500 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:51201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqAEX-000569-5o for grub-devel@gnu.org; Mon, 09 Dec 2013 18:27:25 -0500 Received: by mail-ea0-f176.google.com with SMTP id h14so1875956eaj.35 for ; Mon, 09 Dec 2013 15:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=H7ZYPsF3cuKR63bWBYLDwUmqbo4qqpTH3YpTE2JIn/U=; b=1E+w5dDHTa4U4S6ji7kvGSk+e+fqnMQZqcTKrV1iHI0cE0e/Kuk3jVxlmTrxq+GHSz qfGvXkggFKQ2wjfhcuOZvcL//Umfyc7+FKts8Q9N6bVozVTmUtdCVLi1GVyBVyqE70Tw 3EGlP/QtHZ7mnzc/iGacREbRbyRFC/EGcpxmUtJ1Mv0u+4XNsYVTmkobwBBCLPHa8IwQ 9KUjU/IYt320VCBC+Tj2uxPSohg2TMGVLBPGqQ3+LItTSb1VLhGJB2NInoEN7ZSf273v 1aW/MYnKxTm6E8yESjU8sbO+xREBaFxpEdZ9vKbYnXXvRkt1bKn7r2fTSSFfoCtKUtcm t6eg== X-Received: by 10.14.37.131 with SMTP id y3mr13784691eea.1.1386631644357; Mon, 09 Dec 2013 15:27:24 -0800 (PST) Received: from [192.168.1.16] (85-188.196-178.cust.bluewin.ch. [178.196.188.85]) by mx.google.com with ESMTPSA id o1sm34205689eea.10.2013.12.09.15.27.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 15:27:21 -0800 (PST) Message-ID: <52A651D8.2010900@gmail.com> Date: Tue, 10 Dec 2013 00:27:20 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] always define config_directory and config_file as full pathname References: <52A37FDD.3040304@gmail.com> <1386536710-30180-1-git-send-email-arvidjaar@gmail.com> In-Reply-To: <1386536710-30180-1-git-send-email-arvidjaar@gmail.com> X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WADF0dn5N96q9hiC4cD8nGcAk3FVfwVo7" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::230 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 23:27:42 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WADF0dn5N96q9hiC4cD8nGcAk3FVfwVo7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Go ahead. On 08.12.2013 22:05, Andrey Borzenkov wrote: >> Adding ($root) to config_file/config_directory if none present would b= e >> good. >=20 > Like this? >=20 > If configfile is relative pathname, extend it with current ($root) so i= ts > interpretation does not change if $root is changed later. >=20 > Suggested by Vladimir Serbienko. >=20 > --- > grub-core/normal/main.c | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) >=20 > diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c > index 991a595..84df360 100644 > --- a/grub-core/normal/main.c > +++ b/grub-core/normal/main.c > @@ -190,14 +190,26 @@ read_config_file (const char *config) > ctmp =3D grub_env_get ("config_directory"); > if (ctmp) > old_dir =3D grub_strdup (ctmp); > - grub_env_set ("config_file", config); > - config_dir =3D grub_strdup (config); > + if (*config =3D=3D '(') > + { > + grub_env_set ("config_file", config); > + config_dir =3D grub_strdup (config); > + } > + else > + { > + /* $root is guranteed to be defined, otherwise open above would = fail */ > + config_dir =3D grub_xasprintf ("(%s)%s", grub_env_get ("root"), = config); > + if (config_dir) > + grub_env_set ("config_file", config_dir); > + } > if (config_dir) > - ptr =3D grub_strrchr (config_dir, '/'); > - if (ptr) > - *ptr =3D 0; > - grub_env_set ("config_directory", config_dir); > - grub_free (config_dir); > + { > + ptr =3D grub_strrchr (config_dir, '/'); > + if (ptr) > + *ptr =3D 0; > + grub_env_set ("config_directory", config_dir); > + grub_free (config_dir); > + } > =20 > grub_env_export ("config_file"); > grub_env_export ("config_directory"); >=20 --WADF0dn5N96q9hiC4cD8nGcAk3FVfwVo7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKmUdgACgkQmBXlbbo5nOvflAD/dMWhV8Xl8n/mWEWMgdhwB3lG tuzOJg0PMYizUyhdE/kA/A2d95aGep8mSwONuuURrHU338+QxXX5CTPUD+W243FV =zTvL -----END PGP SIGNATURE----- --WADF0dn5N96q9hiC4cD8nGcAk3FVfwVo7--