[syslinux] PATH directive rules

Matt Fleming matt at console-pimps.org
Mon Jan 28 14:06:29 PST 2013


On Sun, 2013-01-27 at 16:14 +0200, Ady wrote:
> Hello Syslinux Team,
> 
> If I understand correctly (and I should emphasize that condition), 
> the lib*.c32 library modules, when required, are initially 
> searched-for according to the following (fallback) rules:
> 
> 1_ Search for the relevant lib*.c32 file(s) in the Current Working 
> Directory.
> 2_ Search for the relevant lib*.c32 file(s) in the directory where 
> ldlinux.c32 is located.
> 
> Then the lib*.c32 files are searched-for according to the PATH 
> directive, as follows:
> 3_ Search for the relevant lib*.c32 file(s) in the paths indicated by 
> the PATH directive, in the same order as they are stated.
> 4_ Each path used in each PATH directive is appended to the end of 
> the list of the searched-for paths previously set.

Yep, that seems like an accurate summary.

> So, I have several questions.
> 
> 1_ Am I understanding the PATH rules correctly?

Yes.

> 2_ From the user's perspective, are there any differences (or 
> different behaviors) between each Syslinux variant regarding the 
> above rules?

The variants that do not have an "installation" directory (ISOLINUX,
PXELINUX) do operate slightly differently in that there's a list of
directories in which we search for ldlinux.c32, e.g.

       static const char *search_directories[] = {                             
                "/boot/isolinux",                                               
                "/isolinux",                                                    
                "/boot/syslinux",                                               
                "/syslinux",                                                    
                "/",                                                            
                NULL                                                            
        };

But for all variants, wherever we find ldlinux.c32, that's used as the
initial PATH string.

> 3_ After fallback rules #1 and #2, and before searching for lib*.c32 
> files according to the PATH directive, a possible third fallback rule 
> could potentially be: "search for the relevant lib*.c32 file(s) in 
> the same directory where the main c32 module (the one that needs the 
> c32 library file(s)) resides". Is this addition possible? Would there 
> be any disadvantages? Are there any problems in adding this third 
> fallback rule, before searching according to the PATH directive?

Yeah, I had thought of doing this before, but it would require us to
keep track of the last successful lookup path. It could be something we
can add in the future.

> 4_ According to the rules, some of the resulting paths could 
> potentially be searched-for more than once. If a specific path was 
> already searched-for, is there a situation where it could be 
> searched-for again, thus wasting time and resources? Or, instead, is 
> this duplicity avoided?

If you add the ldlinux.c32 directory to PATH, or include config files
that have the same PATH entries, then you could end up searching the
same directories more than once. No attempt is made to avoid this
duplicity, it's just expected that you won't do that. This works much
the same way that the PATH environment variable works in *nix shells.

-- 
Matt Fleming, Intel Open Source Technology Center



More information about the Syslinux mailing list