FixDirReferences may modify files incorrectly on a rootless installation

During SymlinkProgram phase the FixDirReferences script may modify
paths inside some types of files.
Some paths may be modified to /usr (if no better path can be found).
This may cause problems on a rootless gobolinux installation.

If the problem only occurs in a specific case one might of course
"solve" the by editing the offending file.
However it would also be nice if a more general solution could be done.

My first quick and dirty solution to the problem was to modify
FixDirReferences to never use /usr modification on rootless
installations (patch as attachment).
However I am not certain this is the best solution to the problem.

Other solutions might be to make other modifications to FixDirReferences:
  Perhaps try to use more advanced logic to replace paths using some
type of more advanced trickery?
     (My knowledge about how pkg-config etc is used is close to
noneexistant but I surmise it would be possible )
  Or perhaps modify FixdirReferences to use some type of
goboPrefix/usr instead of /usr ?


What do you think would be a good solution to this problem ?

I would of course prefer if anyone else could wave a magic wand and
solve the problem :)
But I would be willing to take a look at this problem assuming an
modification would be of interest.

/Regards Martin
Index: FixDirReferences
===================================================================
--- FixDirReferences	(revision 3554)
+++ FixDirReferences	(working copy)
@@ -20,6 +20,25 @@
 Parse_Conf Compile/Compile.conf || exit 1
 Is_Writable "$PWD" || exit 1
 
+
+sed_changes="
+s%$goboPrograms/[^ /]*/*[^ /]*/+lib(/?)/*%$goboLibraries\1%g;
+s%$goboPrograms/[^ /]*/*[^ /]*/+lib([ '\''])%$goboLibraries/\1%g;
+s%$goboPrograms/[^ /]*/*[^ /]*/+include(/?)/*%$goboHeaders\1%g;
+s%$goboPrograms/[^ /]*/*[^ /]*/+include([ '\''])%$goboHeaders/\1%g;
+s%$goboPrograms/[^ /]*/*[^ /]*/+share(/?)/*%$goboShared\1%g;
+s%$goboPrograms/[^ /]*/*[^ /]*/+share([ '\''])%$goboShared/\1%g;
+s%$goboPrograms/[^ /]*/*[^ /]*/+etc(/?)/*%$goboSettings\1%g;
+s%$goboPrograms/[^ /]*/+Settings/(.*)%$goboSettings/\1%g;
+s%(-L|-I|-R)*$compileDir/[^('| )]*%%g;
+" 
+
+if [ $ROOTLESS_GOBOLINUX = 0 ]
+then
+   $sed_changes="$sed_changes%$goboPrograms/[^ /]*/*[^ /]*%/usr%g;
+"
+fi
+
 n=$(Number_Of_Arguments)
 for (( i=1 ; i<=n ; i++))
 do
@@ -34,18 +53,7 @@
    do old="$old~"
    done
    cp "${current}" "$old"
-   cat "$old" | sed -r "
-s%$goboPrograms/[^ /]*/*[^ /]*/+lib(/?)/*%$goboLibraries\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*/+lib([ '\''])%$goboLibraries/\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*/+include(/?)/*%$goboHeaders\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*/+include([ '\''])%$goboHeaders/\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*/+share(/?)/*%$goboShared\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*/+share([ '\''])%$goboShared/\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*/+etc(/?)/*%$goboSettings\1%g;
-s%$goboPrograms/[^ /]*/+Settings/(.*)%$goboSettings/\1%g;
-s%$goboPrograms/[^ /]*/*[^ /]*%/usr%g;
-s%(-L|-I|-R)*$compileDir/[^('| )]*%%g;
-" > "${current}"
+   cat "$old" | sed -r "$sed_changes" > "${current}"
    Boolean "backup" || rm -- "$old"
 done
 
_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to