Jump to content











Photo
- - - - -

Syslinux config with relative paths


  • Please log in to reply
2 replies to this topic

#1 ady

ady

    Frequent Member

  • Advanced user
  • 130 posts

Posted 06 June 2012 - 03:58 PM

This topic is about a difference I found between using SYSLINUX in comparison to ISOLINUX when parsing the CONFIG directive with RELATIVE paths.
I use CONFIG directives between several cfg files. When I use CONFIG, I also change the syslinux base directory.
(Note: I know the following example seems too much complicated, and I could potentially make the paths easier, but that's not the point of the topic, so please keep reading. TIA.)

Example with ABSOLUTE paths (I am posting only the relevant info) :

/boot/syslinux/syslinux.cfg :

# Current syslinux base directory is /boot/syslinux/

DEFAULT 1

LABEL 1

CONFIG /DIRA/DIR22/DIR23/2nd.cfg

APPEND /DIRA/DIR22/


/DIRA/DIR22/DIR23/2nd.cfg :

# Current syslinux base directory is /DIRA/DIR22/

DEFAULT 2

LABEL 2

CONFIG /DIRA/DIR32/DIR33/3rd.cfg

APPEND /DIRA/DIR32/DIR33/


/DIRA/DIR32/DIR33/3rd.cfg :

# Current syslinux base directory is /DIRA/DIR32/DIR33/

DEFAULT 3

CONFIG /DIRA/DIR32/DIR33/4th.cfg

APPEND /DIRA/

# 3rd.cfg and 4th.cfg are in the same location as the base directory.

# Note that the new syslinux base directory is going up in the path.


/DIRA/DIR32/DIR33/4th.cfg :

# Current syslinux base directory is /DIRA/

UI /DIRA/DIR22/DIR23/menu.c32

# menu.c32 and 2nd.cfg are in the same location.

# ...

# ... whatever menu you want

# ...

# Or use /DIRA/DIR22/DIR23/hello.c32 or

# or /DIRA/DIR22/DIR23/pwd.c32 for testing purposes.


Now I take the above working example and make the paths to be RELATIVE to the relevant syslinux base directory.

The same cfg files using RELATIVE paths:

boot/syslinux/syslinux.cfg :

# Current syslinux base directory is boot/syslinux/

DEFAULT 1

LABEL 1

CONFIG ../../DIRA/DIR22/DIR23/2nd.cfg

APPEND ../../DIRA/DIR22/


DIRA/DIR22/DIR23/2nd.cfg :

# Current syslinux base directory is DIRA/DIR22/

DEFAULT 2

LABEL 2

CONFIG ../DIR32/DIR33/3rd.cfg

APPEND ../DIR32/DIR33/


DIRA/DIR32/DIR33/3rd.cfg :

# Current syslinux base directory is DIRA/DIR32/DIR33/

DEFAULT 3

CONFIG 4th.cfg

APPEND ../../

# 3rd.cfg and 4th.cfg are in the same location as the base directory.

# Note that the new syslinux base directory is going up in the path.


DIRA/DIR32/DIR33/4th.cfg :

# Current syslinux base directory is DIRA/

UI DIR22/DIR23/menu.c32

# menu.c32 and 2nd.cfg are in the same location.

# ...

# ... whatever menu you want

# ...

# Or use DIR22/DIR23/hello.c32 or

# or DIR22/DIR23/pwd.c32 for testing purposes.


The above examples (with ABSOLUTE paths or with RELATIVE paths) work correctly when booting with ISOLINUX (with isolinux.bin in /boot/syslinux/ ).

But when using SYSLINUX (ldlinux.sys in /boot/syslinux/ ), only the first case (ABSOLUTE paths) works correctly. For the RELATIVE paths case, SYSLINUX parses the CONFIG + APPEND statements in a different way than ISOLINUX does. It seems as if SYSLINUX would "concatenate" the relative paths.
By the time SYSLINUX gets to the last "4th.cfg" file (the one with UI or hello.c32 ) the resulting PWD should be "DIRA/" (using the RELATIVE path notation), but it is not. Since SYSLINUX wrongly understands the intended PWD, SYSLINUX fails to complete the whole procedure successfully.

BTW, I am using Syslinux v.4.05.

Am I doing something wrong? Can anyone confirm or reproduce this problem? Is this a bug? Are ISOLINUX and SYSLINUX known to interpret the same cfg files differently when using RELATIVE paths?

TIA.

#2 ady

ady

    Frequent Member

  • Advanced user
  • 130 posts

Posted 08 June 2012 - 06:09 PM

To make it easier, I have uploaded a 7z archive containing:

_ 1 ISO image
_ 1 raw (VMDK) image

Both images contain the same cfg files and the exact same tree path. The references to paths in the cfg files are all in relative notation. The only difference is the respective bootloader.

While the ISO image boots successfully (ISOLINUX), the FAT16 image fails (SYSLINUX).

For ISOLINUX:

Final PWD:
/boot/syslinux/../../DIRA/DIR22/../DIR32/DIR33/../../

which is equivalent to
/DIRA/


For SYSLINUX:

Error: "Could not find kernel image", which means SYSLINUX does not parse the CONFIG + APPEND -> new PWD correctly for relative paths.

Final PWD:
/boot/syslinux/../../DIRA/DIR22/../DIR32/DIR33/../

which is equivalent to
/DIRA/DIR32/
instead of the expected
DIRA

To download the 7z archive:



  -hXXp://www.fileconvoy.com/dfl.php?id=g62dba72a1e40e2481201735aaf95eb701c0270  

(note the "-hXXp", which of course should be changed for the link to work correctly)



MD5 : 27130425C7D1A8870F0E71263E53AADA

SHA1 : D821CF408D9D81786B277284247794994D61FBAC

SIZE : 500439 bytes ( 0.5MB )



The archive will be available for 7 days.

I hope this archive will ease checking for the problem, and hopefully someone from The Syslinux Project will at least comment on this.

TIA.

#3 ady

ady

    Frequent Member

  • Advanced user
  • 130 posts

Posted 11 June 2012 - 01:32 AM

To Icecube, GeneC, Paulo, Sha0 or whoever is involved in The Syslinux Project,

I have tested 4.06-pre5, and SYSLINUX is still failing, while ISOLINUX completes the process successfully.

I also tested a standard 1440KiB floppy, and it fails too.

It seems as if the following patches from Matt Fleming were not even considered:

[syslinux] [PATCH 10/19] ldlinux: Loading a config file should cause re-initialisation
http://www.syslinux....rch/017362.html

[syslinux] [PATCH 13/19] ldlinux: chdir to the APPEND str when parsing a CONFIG directive
http://www.syslinux....rch/017359.html

I don't know if the code in those patches is correct, but the thread's subject sure it is; the problem indeed exists.

Both patches were sent after v.4.05, but before 4.06-pre5. Yet 4.06-pre5 still fails.

Please consider this bug and release some new testing version.

It would be nice to see at least an acknowledgment that the problem exists!

PS: The cfg code I posted in my OP has a little LABEL error (I have no way to edit and correct the post), but the 7z archive I uploaded uses the correct cfg files. Please let me know if you need the floppy image too or any additional testing.

TIA.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users