Skip to contentSkip to conversation

GRUB possible patches

PATCH In review George Buranov 2 participants 6 messages Feb 11, 2010 – Feb 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GRUB possible patches

Hello eveybody.

I am currently start investigation (and fixing the things that don't work for me =))

So, I got two for today, one is fix, and one is morelike a question, I am more than sure it's my mistake.

What's the correct way of applying patches to grub2? Am I correct that all I need is to post the patch to this mailing list and than some guys are applying them?:)

1) IMHO that's clearly a bug. Actually, I am not sure how did it work before =)

=== modified file 'disk/efi/efidisk.c'

efi/efidisk.c 2010-02-11 10:58:49 +0000 renamed from efi/efidisk.c 2010-01-20 08:12:47 +0000 +1 -1
@@ -825,7 +825,7 @@
          if (! disk)
            return 1;
 
-         if (disk->id == GRUB_DISK_DEVICE_EFIDISK_ID)
+         if (disk->dev && disk->dev->id == GRUB_DISK_DEVICE_EFIDISK_ID)
            {
              struct grub_efidisk_data *d;
 

2) That's more interesting. I nocticed that when I try to browse CD (ISO 9660 format) all files are ended with ";1". This basically crashed loading everything (including grub.cfg file). I fixed this by this stupid hack, but maybe somebody knows where is the clue?

http://picasaweb.google.com/lh/photo/psaYCXsX_M77pdG4_qeFGw?feat=directlink

=== modified file 'fs/iso9660.c'

iso9660.c 2010-02-11 11:11:36 +0000 renamed from iso9660.c 2010-01-27 03:11:20 +0000 +3 -0
@@ -638,6 +638,9 @@
             if (filename_alloc)
               grub_free (oldname);
 
+            int hookedFile = grub_strlen (filename);
+            filename[hookedFile - 2] = '\0';
+
             filename_alloc = 1;
           }
 

Regards,
Georgy

#1 lore raw
Quoted 5 lines · George Buranov

Hello eveybody.

I am currently start investigation (and fixing the things that don't work for me =))

Quoted 8 lines

So, I got two for today, one is fix, and one is morelike a question, I am more than sure it's my mistake.

What's the correct way of applying patches to grub2? Am I correct that all I need is to post the patch to this mailing list and than some guys are applying them?:)

1) IMHO that's clearly a bug.

It is. Can you write a ChangeLog entry?

Quoted 1 line

Actually, I am not sure how did it work before =)

It's a rarely used branch of code.

Quoted 14 lines

=== modified file 'disk/efi/efidisk.c'

efi/efidisk.c 2010-02-11 10:58:49 +0000 renamed from efi/efidisk.c 2010-01-20 08:12:47 +0000 +1 -1
@@ -825,7 +825,7 @@
          if (! disk)
            return 1;
 
-         if (disk->id == GRUB_DISK_DEVICE_EFIDISK_ID)
+         if (disk->dev && disk->dev->id == GRUB_DISK_DEVICE_EFIDISK_ID)
            {
              struct grub_efidisk_data *d;
 
Quoted 5 lines

2) That's more interesting. I nocticed that when I try to browse CD (ISO 9660 format) all files are ended with ";1". This basically crashed loading everything (including grub.cfg file). I fixed this by this stupid hack, but maybe somebody knows where is the clue?

;1 is so called version. Basically all terminating ;<number> have to be stripped but only if filename doesn't come from rockridge or joliet. Apparently nobody uses grub2 on non-rockridge, non-joliet iso. While this bug should be fixed using grub from plain iso isn't supported due to filename length limitation.

Quoted 25 lines

http://picasaweb.google.com/lh/photo/psaYCXsX_M77pdG4_qeFGw?feat=directlink

=== modified file 'fs/iso9660.c'

iso9660.c 2010-02-11 11:11:36 +0000 renamed from iso9660.c 2010-01-27 03:11:20 +0000 +3 -0
@@ -638,6 +638,9 @@
             if (filename_alloc)
               grub_free (oldname);
 
+            int hookedFile = grub_strlen (filename);
+            filename[hookedFile - 2] = '\0';
+
             filename_alloc = 1;
           }
 

Regards,
Georgy
------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw

Hello,

Quoted 1 line

It is. Can you write a ChangeLog entry?

Done

Quoted 5 lines

;1 is so called version. Basically all terminating ;<number> have to be stripped but only if filename doesn't come from rockridge or joliet. Apparently nobody uses grub2 on non-rockridge, non-joliet iso. While this bug should be fixed using grub from plain iso isn't supported due to filename length limitation.

I found out that I got versioning even on joliet CD. I created CD using "Small CD Writer". You can try the same. I created patch for that as well, but of course you can skip it.

Regards,
Georgy

PS: My Patch

=== modified file 'ChangeLog'

ChangeLog +5 -0
@@ -1,3 +1,8 @@
+2010-02-12  Georgy Buranov <[email protected]>
+
+	* disk/efi/efidisk.c (grub_efidisk_get_device_name): Fix bug obtaining device name of the whole disk
+	* fs/iso9660.c (grub_iso9660_iterate_dir): Remove file versions from ISO9660&Joliet file names
+
 2010-02-10  Vladimir Serbinenko  <[email protected]>
 
 	Pass SIMPLE framebuffer size in bytes and not 64K blocks.

=== modified file 'disk/efi/efidisk.c'

efi/efidisk.c +1 -1
@@ -825,7 +825,7 @@
 	  if (! disk)
 	    return 1;
 
-	  if (disk->id == GRUB_DISK_DEVICE_EFIDISK_ID)
+	  if (disk->dev->id == GRUB_DISK_DEVICE_EFIDISK_ID)
 	    {
 	      struct grub_efidisk_data *d;
 

=== modified file 'fs/iso9660.c'

iso9660.c +8 -3
@@ -615,9 +615,6 @@
 	if (!filename)
 	  {
 	    name[dirent.namelen] = '\0';
-	    filename = grub_strrchr (name, ';');
-	    if (filename)
-	      *filename = '\0';
 
 	    if (dirent.namelen == 1 && name[0] == 0)
 	      filename = ".";
@@ -640,6 +637,14 @@
 
             filename_alloc = 1;
           }
+	  
+	 if (!dir->data->rockridge)
+	 {
+	   // On simple ISO 9660 disks and on joliet, we need to remove file version, if any
+	    char* lastSymbol = grub_strrchr (filename, ';');
+	    if (lastSymbol)
+	      *lastSymbol = '\0';
+	 }	  
 
 	if (hook (filename, type, node))
 	  {

--
This message was sent on behalf of [email protected] at openSubscriber.com
http://www.opensubscriber.com/message/[email protected]/13415591.html

#3 lore raw
Quoted 8 lines · [email protected] wrote:

Hello,

Quoted 2 lines

It is. Can you write a ChangeLog entry?

Done

First part applied

Quoted 9 lines
Quoted 6 lines

;1 is so called version. Basically all terminating ;<number> have to be stripped but only if filename doesn't come from rockridge or joliet. Apparently nobody uses grub2 on non-rockridge, non-joliet iso. While this bug should be fixed using grub from plain iso isn't supported due to filename length limitation.

I found out that I got versioning even on joliet CD. I created CD using "Small CD Writer". You can try the same. I created patch for that as well, but of course you can skip it.

Please don't put unrelated patches into single file. Fast look on the joliet.c of mkisofs suggests that it's not the case for its joliet. It seems there is more to it. Can you find some normative documents?

Quoted 45 lines

Regards,
Georgy

PS: My Patch

=== modified file 'ChangeLog'

ChangeLog +5 -0
@@ -1,3 +1,8 @@
+2010-02-12  Georgy Buranov <[email protected]>
+
+	* disk/efi/efidisk.c (grub_efidisk_get_device_name): Fix bug obtaining device name of the whole disk
+	* fs/iso9660.c (grub_iso9660_iterate_dir): Remove file versions from ISO9660&Joliet file names
+
 2010-02-10  Vladimir Serbinenko  <[email protected]>
 
 	Pass SIMPLE framebuffer size in bytes and not 64K blocks.

=== modified file 'disk/efi/efidisk.c'

efi/efidisk.c +1 -1
@@ -825,7 +825,7 @@
 	  if (! disk)
 	    return 1;
 
-	  if (disk->id == GRUB_DISK_DEVICE_EFIDISK_ID)
+	  if (disk->dev->id == GRUB_DISK_DEVICE_EFIDISK_ID)
 	    {
 	      struct grub_efidisk_data *d;
 

=== modified file 'fs/iso9660.c'

iso9660.c +0 -3
@@ -615,9 +615,6 @@
 	if (!filename)
 	  {
 	    name[dirent.namelen] = '\0';
-	    filename = grub_strrchr (name, ';');
-	    if (filename)
-	      *filename = '\0';
 
 	    if (dirent.namelen == 1 && name[0] == 0)
 	      filename = ".";

iso9660.c line 644

Quoted 8 lines
iso9660.c +4 -0
@@ -640,6 +637,14 @@
 
             filename_alloc = 1;
           }
+	  
+	 if (!dir->data->rockridge)
+	 {
+	   // On simple ISO 9660 disks and on joliet, we need to remove file version, if any
 

We use only C-style comments

Quoted 21 lines
iso9660.c +4 -0
+	    char* lastSymbol = grub_strrchr (filename, ';');
+	    if (lastSymbol)
+	      *lastSymbol = '\0';
+	 }	  
 
 	if (hook (filename, type, node))

{

--
This message was sent on behalf of [email protected] at openSubscriber.com
http://www.opensubscriber.com/message/[email protected]/13415591.html

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#4 lore raw
Quoted 1 line

First part applied

Thanks!

Quoted 3 lines

Please don't put unrelated patches into single file. Fast look on the joliet.c of mkisofs suggests that it's not the case for its joliet. It seems there is more to it. Can you find some normative documents?

I searched a bit and found the following information:
Doc: http://www.transelectro.ru/technology/standard/joliet_spec.htm
In the documentation:

"Simply put, SEPARATOR 1 and SEPARATOR 2 shall be expanded to 16-bits".

SEPARATOR 2 is ';' - which is used signify the version number of a file.

About mkisofs - it seems it's just their implementation of joilet, they can use or not use versioning See this topic
http://www.mail-archive.com/[email protected]/msg03199.html

Quoted 1 line

We use only C-style comments

Ok, I will create new patch soon

Signature · 10 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko





--
This message was sent on behalf of [email protected] at openSubscriber.com
http://www.opensubscriber.com/message/[email protected]/13437133.html
#5 lore raw
Quoted 14 lines · [email protected] wrote:
Quoted 2 lines

First part applied

Thanks!

Quoted 4 lines

Please don't put unrelated patches into single file. Fast look on the joliet.c of mkisofs suggests that it's not the case for its joliet. It seems there is more to it. Can you find some normative documents?

I searched a bit and found the following information:
Doc: http://www.transelectro.ru/technology/standard/joliet_spec.htm
In the documentation:

Quoted 9 lines

"Simply put, SEPARATOR 1 and SEPARATOR 2 shall be expanded to 16-bits".

SEPARATOR 2 is ';' - which is used signify the version number of a file.

About mkisofs - it seems it's just their implementation of joilet, they can use or not use versioning See this topic
http://www.mail-archive.com/[email protected]/msg03199.html

Ok, I agree that it should be fixed but I made and applied a slightly different fix

Quoted 5 lines
Quoted 2 lines

We use only C-style comments

Ok, I will create new patch soon

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko