From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XW8Pd-0004Aj-1n for mharc-grub-devel@gnu.org; Mon, 22 Sep 2014 14:32:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW8PR-000442-TL for grub-devel@gnu.org; Mon, 22 Sep 2014 14:32:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XW8PI-0000XR-IR for grub-devel@gnu.org; Mon, 22 Sep 2014 14:32:25 -0400 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:40698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW8PI-0000WQ-BK for grub-devel@gnu.org; Mon, 22 Sep 2014 14:32:16 -0400 Received: by mail-la0-f53.google.com with SMTP id ge10so7393730lab.12 for ; Mon, 22 Sep 2014 11:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=HupxMGWPhbk22EZFHzGN5Ha0h3Y7X8QVTwfKaUesrcU=; b=FHLUUWu+SXOiET5hDgbYabiST3DZ6XVdOuxYD8/bTsGlyh7dZn10TRHu7I3MovMfum mLyUZM3NfihaBNYNZtU6v33yOBgFzaUr6EGU1+XSo56/gPQ5piJifaIjnp2IGxKS5JS/ +iM9dGpNuqrcZOyVByKtTw9C2r5GX8ax0QquzqP89SF0R8JZ29XGx/63rm7CjbFFUl0e YCOS11LvFmJVvbqXAq8SSeT9KhBE9Y2Akp3YQj6q5M2d+dVL98yU2xectHnbOAjXIXbA GpTTyunHHKs49QzXAyX6d/094mVz83gAwgyeY6CY4UVo9x16yzLHLtYG+9d5Bm2EihyX VoCQ== X-Received: by 10.112.28.8 with SMTP id x8mr4113046lbg.104.1411410730156; Mon, 22 Sep 2014 11:32:10 -0700 (PDT) Received: from opensuse.site (ppp94-29-94-89.pppoe.spdop.ru. [94.29.94.89]) by mx.google.com with ESMTPSA id ca5sm4002544lad.14.2014.09.22.11.32.08 for (version=SSLv3 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Sep 2014 11:32:09 -0700 (PDT) Date: Mon, 22 Sep 2014 22:32:07 +0400 From: Andrei Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH] grub-mkrescue: remove temporary load_cfg file Message-ID: <20140922223207.49730bcc@opensuse.site> In-Reply-To: <541F061D.9090409@gmail.com> References: <1398961019-29913-1-git-send-email-arvidjaar@gmail.com> <541F061D.9090409@gmail.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.23; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/ewFBjdmszCWjlw/4HzFKNAD"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::235 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, 22 Sep 2014 18:32:35 -0000 --Sig_/ewFBjdmszCWjlw/4HzFKNAD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Sun, 21 Sep 2014 19:08:45 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > I actually like to have load.cfg around: it helps with debugging in some > cases. Do you have a reason to remove it? On general principles that program has to cleanup after itself unless asked otherwise. load_cfg was already removed in one code path there so I considered it a cleanup. Also I have dozens of temporary files with cryptic names created by grub in /tmp, I'd have hard time matching them. What about patch below? It saves load.cfg in target directory on image. This matches what grub-install does and lets you see load.cfg even if image is copied elsewhere. diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index e719839..4121f61 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -270,7 +270,9 @@ make_image_abs (enum grub_install_plat plat, grub_util_info (N_("enabling %s support ..."), mkimage_target); =20 - load_cfg =3D grub_util_make_temporary_file (); + load_cfg =3D grub_util_path_concat (3, boot_grub, + grub_install_get_platform_name (plat), + "load.cfg"); =20 load_cfg_f =3D grub_util_fopen (load_cfg, "wb"); fprintf (load_cfg_f, "search --fs-uuid --set=3Droot %s\n", iso_uuid); @@ -286,7 +288,7 @@ make_image_abs (enum grub_install_plat plat, mkimage_target, 0); grub_install_pop_module (); grub_install_pop_module (); - grub_util_unlink (load_cfg); + free (load_cfg); } =20 static void @@ -313,7 +315,9 @@ make_image_fwdisk_abs (enum grub_install_plat plat, grub_util_info (N_("enabling %s support ..."), mkimage_target); =20 - load_cfg =3D grub_util_make_temporary_file (); + load_cfg =3D grub_util_path_concat (3, boot_grub, + grub_install_get_platform_name (plat), + "load.cfg"); =20 load_cfg_f =3D grub_util_fopen (load_cfg, "wb"); write_part (load_cfg_f, source_dirs[plat]); @@ -323,6 +327,7 @@ make_image_fwdisk_abs (enum grub_install_plat plat, grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output, 0, load_cfg, mkimage_target, 0); grub_install_pop_module (); + free (load_cfg); } =20 static int @@ -491,7 +496,7 @@ main (int argc, char *argv[]) char *load_cfg; FILE *load_cfg_f; char *output =3D grub_util_path_concat (3, boot_grub, "i386-pc", "el= torito.img"); - load_cfg =3D grub_util_make_temporary_file (); + load_cfg =3D grub_util_path_concat (3, boot_grub, "i386-pc", "load.c= fg"); =20 grub_util_info (N_("enabling %s support ..."), "BIOS"); load_cfg_f =3D grub_util_fopen (load_cfg, "wb"); @@ -566,6 +571,7 @@ main (int argc, char *argv[]) } grub_install_pop_module (); grub_install_pop_module (); + free (load_cfg); } =20 /** build multiboot core.img */ --Sig_/ewFBjdmszCWjlw/4HzFKNAD Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlQgaycACgkQR6LMutpd94zrfgCgm3MGESW/NaXpR/iqsqlz2QKd VYgAnRrTw8cAlejhm92qEeDFuPfQwjG4 =A48k -----END PGP SIGNATURE----- --Sig_/ewFBjdmszCWjlw/4HzFKNAD--