All of lore.kernel.org
 help / color / mirror / Atom feed
From: The Gluglug <info@gluglug.org.uk>
To: lunar@torproject.org
Cc: grub-devel@gnu.org
Subject: Re: [bug #44238] Add support for menu.c32 and vesamenu.c32 in	lib/syslinux_parse
Date: Tue, 17 Mar 2015 17:40:32 +0000	[thread overview]
Message-ID: <55086710.8080506@gluglug.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This is a new rebased version of the patch that Lunar linked me to:
https://people.torproject.org/~lunar/volatile/2015-03-17-e3Yp1d7FifQ/0001-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch

I also attached it.

Debian ISOLINUX menu is still broken (syslinux_configfile -i just
puts you back to the main screen but with the Debian background).
(same issue on gnewsense)
^ this also happens without the patch

Tails ISOLINUX menu now works. (without the patch, it would show the
same behaviour as with Debian, mentioned above)

I also tested Trisquel, Trisquel Mini and Parabola - these all still
work (they also worked before the patch).

Tested on a ThinkPad X60 running libreboot (deblobbed coreboot), with
the GRUB payload.

Regards,
Francis Rowe.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVCGcPAAoJEP9Ft0z50c+UjAcH/Ru66PfB/1VojyWXAWpFwTK/
j2cSXKZvAnca9mZPILAGX+YPTK64u9hhTnVbLmD6xEPtuNUrYJ0bOJMx3soOluhS
uKxkFpjJaLVQLT/xUyg3qyblkRzGhBmLks11RirVMPiQoD2B5CTjSFxVwOMEuWtp
QJOuE/PFq6kb7BitEE6a8u57G9sM/VsY3rZCHF/DsqNdlCcul0pnbfELHApF+xYo
As4TkwvwoxVc5OuWVVReGMKv7Kg6ysnM/KotAcmTSTaKL7Z9h1fcnNuCNs6EpTxC
p+KqWFayGFGXQBXuzt2UYdicvsd9Ot1jDZlq3rrxbPAVV5ak3MBSayxbxLJMNK0=
=1x6O
-----END PGP SIGNATURE-----

[-- Attachment #2: 0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch --]
[-- Type: text/x-diff, Size: 5685 bytes --]

From 191aeee1b67ff30d6c868320a51cb9fb766874be Mon Sep 17 00:00:00 2001
From: Lunar <lunar@torproject.org>
Date: Fri, 13 Feb 2015 22:08:11 +0100
Subject: [PATCH] lib/syslinux_parse: add support for (vesa)menu.c32

Fixes Savannah bug #44238.
---
 grub-core/lib/syslinux_parse.c | 165 ++++++++++++++++++++++++++---------------
 1 file changed, 107 insertions(+), 58 deletions(-)

diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
index 22389eb..153260b 100644
--- a/grub-core/lib/syslinux_parse.c
+++ b/grub-core/lib/syslinux_parse.c
@@ -840,6 +840,82 @@ simplify_filename (char *str)
 }
 
 static grub_err_t
+print_config (struct output_buffer *outbuf,
+	      struct syslinux_menu *menu,
+              const char *filename, const char *basedir)
+{
+  struct syslinux_menu *menuptr;
+  grub_err_t err = GRUB_ERR_NONE;
+  char *new_cwd = NULL;
+  char *new_target_cwd = NULL;
+  char *newname = NULL;
+  int depth = 0;
+
+  new_cwd = get_read_filename (menu, basedir);
+  if (!new_cwd)
+    {
+      err = grub_errno;
+      goto out;
+    }
+  new_target_cwd = get_target_filename (menu, basedir);
+  if (!new_target_cwd)
+    {
+      err = grub_errno;
+      goto out;
+    }
+  newname = get_read_filename (menu, filename);
+  if (!newname)
+    {
+      err = grub_errno;
+      goto out;
+    }
+  simplify_filename (newname);
+
+  print_string ("#");
+  print_file (outbuf, menu, filename, NULL);
+  print_string (" ");
+  print (outbuf, newname, grub_strlen (newname));
+  print_string (":\n");
+
+  for (menuptr = menu; menuptr; menuptr = menuptr->parent, depth++)
+    if (grub_strcmp (menuptr->filename, newname) == 0
+        || depth > 20)
+      break;
+  if (menuptr)
+    {
+      print_string ("  syslinux_configfile -r ");
+      print_file (outbuf, menu, "/", NULL);
+      print_string (" -c ");
+      print_file (outbuf, menu, basedir, NULL);
+      print_string (" ");
+      print_file (outbuf, menu, filename, NULL);
+      print_string ("\n");
+    }
+  else
+    {
+      err = config_file (outbuf, menu->root_read_directory,
+                         menu->root_target_directory, new_cwd, new_target_cwd,
+                         newname, menu, menu->flavour);
+      if (err == GRUB_ERR_FILE_NOT_FOUND
+          || err == GRUB_ERR_BAD_FILENAME)
+        {
+          grub_errno = err = GRUB_ERR_NONE;
+          print_string ("# File ");
+          err = print (outbuf, newname, grub_strlen (newname));
+          if (err)
+            goto out;
+          print_string (" not found\n");
+        }
+    }
+
+ out:
+  grub_free (newname);
+  grub_free (new_cwd);
+  grub_free (new_target_cwd);
+  return err;
+}
+
+static grub_err_t
 write_entry (struct output_buffer *outbuf,
 	     struct syslinux_menu *menu,
 	     struct syslinux_menuentry *curentry)
@@ -1227,6 +1303,36 @@ write_entry (struct output_buffer *outbuf,
 	    break;
 	  }
 
+	if (grub_strcasecmp (basename, "menu.c32") == 0 ||
+	    grub_strcasecmp (basename, "vesamenu.c32") == 0)
+	  {
+	    char *ptr;
+	    char *end;
+
+	    ptr = curentry->append;
+	    if (!ptr)
+	      return grub_errno;
+
+	    while (*ptr)
+	      {
+		end = ptr;
+		for (end = ptr; *end && !grub_isspace (*end); end++);
+		if (*end)
+		  *end++ = '\0';
+
+		/* "~" is supposed to be current file, so let's skip it */
+		if (grub_strcmp (ptr, "~") != 0)
+		  {
+		    err = print_config (outbuf, menu, ptr, "");
+		    if (err != GRUB_ERR_NONE)
+		      break;
+                  }
+		for (ptr = end; *ptr && grub_isspace (*ptr); ptr++);
+	      }
+	    err = GRUB_ERR_NONE;
+	    break;
+	  }
+
 	/* FIXME: gdb, GFXBoot, Hdt, Ifcpu, Ifplop, Kbdmap,
 	   FIXME: Linux, Lua, Meminfo, rosh, Sanbboot  */
 
@@ -1239,70 +1345,13 @@ write_entry (struct output_buffer *outbuf,
       }
     case KERNEL_CONFIG:
       {
-	char *new_cwd, *new_target_cwd;
 	const char *ap;
 	ap = curentry->append;
 	if (!ap)
 	  ap = curentry->argument;
 	if (!ap)
 	  ap = "";
-	new_cwd = get_read_filename (menu, ap);
-	if (!new_cwd)
-	  return grub_errno;
-	new_target_cwd = get_target_filename (menu, ap);
-	if (!new_target_cwd)
-	  return grub_errno;
-
-	struct syslinux_menu *menuptr;
-	char *newname;
-	int depth = 0;
-	
-	newname = get_read_filename (menu, curentry->kernel_file);
-	if (!newname)
-	  return grub_errno;
-	simplify_filename (newname);
-
-	print_string ("#");
-	print_file (outbuf, menu, curentry->kernel_file, NULL);
-	print_string (" ");
-	print (outbuf, newname, grub_strlen (newname));
-	print_string (":\n");
-
-	for (menuptr = menu; menuptr; menuptr = menuptr->parent, depth++)
-	  if (grub_strcmp (menuptr->filename, newname) == 0
-	      || depth > 20)
-	    break;
-	if (menuptr)
-	  {
-	    print_string ("  syslinux_configfile -r ");
-	    print_file (outbuf, menu, "/", NULL);
-	    print_string (" -c ");
-	    print_file (outbuf, menu, ap, NULL);
-	    print_string (" ");
-	    print_file (outbuf, menu, curentry->kernel_file, NULL);
-	    print_string ("\n");
-	  }
-	else
-	  {
-	    err = config_file (outbuf, menu->root_read_directory,
-			       menu->root_target_directory, new_cwd, new_target_cwd,
-			       newname, menu, menu->flavour);
-	    if (err == GRUB_ERR_FILE_NOT_FOUND
-		|| err == GRUB_ERR_BAD_FILENAME)
-	      {
-		grub_errno = err = GRUB_ERR_NONE;
-		print_string ("# File ");
-		err = print (outbuf, newname, grub_strlen (newname));
-		if (err)
-		  return err;
-		print_string (" not found\n");
-	      }
-	    if (err)
-	      return err;
-	  }
-	grub_free (newname);
-	grub_free (new_cwd);
-	grub_free (new_target_cwd);
+	print_config (outbuf, menu, curentry->kernel_file, ap);
       }
       break;
     case KERNEL_NO_KERNEL:
-- 
1.9.1


[-- Attachment #3: 0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch.sig --]
[-- Type: application/pgp-signature, Size: 287 bytes --]

             reply	other threads:[~2015-03-17 17:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 17:40 The Gluglug [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-02-14  3:26 [bug #44238] Add support for menu.c32 and vesamenu.c32 in lib/syslinux_parse The Gluglug
     [not found] <20150213-163409.sv98365.64186@savannah.gnu.org>
     [not found] ` <20150213-190108.sv89796.21318@savannah.gnu.org>
2015-02-13 20:20   ` Lunar
2015-02-13 20:40     ` Andrei Borzenkov
2015-02-13 21:09       ` Lunar
2015-02-14  6:15         ` Andrei Borzenkov
2015-02-14  8:22           ` Lunar
2015-02-14 17:48             ` Andrei Borzenkov
2015-03-17 17:41           ` The Gluglug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55086710.8080506@gluglug.org.uk \
    --to=info@gluglug.org.uk \
    --cc=grub-devel@gnu.org \
    --cc=lunar@torproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.