HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] Re: hylafax mkdepend mishandles symlinks and GCC paths (Solaris 8, gcc)



Dear sed expert(s),


Problem summary: Makedepend produces a path name, similar to the
following:
"/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/../../../../sparc
-sun-solaris2.7/include/assert.h"
The sed script which comes from "port/mkdepend.in" is supposed to
simplify this path but fails.



I submitted a sed script patch in January which successfully reduces 
this path on my installation, but as Phil Watkinson points out there 
are 2 flaws in general usage. The first is with paths starting "//foo" 
of which I am unaware, this would be easy to fix - if thought 
necessary.  Second, I did not consider symbolic links above the dot 
dot, eg "FOO/SYMLINK/../BAR", which must not be reduced to "FOO/BAR". 
This is interesting because a path of that form is where this all 
starts, we need to take a wider view.

Note also "foo/././bar" is only reduced to "foo/./bar" by:
        sed -e 's:\([/ ]\)\.//*:\1:g'
You do need those branches I put in, not the g flag.



sed as a simple textual process cannot possibly know about symbolic
links, so must not simplify "FOO/dont-know-if-its-a-link/../BAR" into
"FOO/BAR", as the original mkdepend.in suggest we should.  Be reminded
the whole point of this exercise to change:
"/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/../../../../sparc
-sun-solaris2.7/include/assert.h"
to:
"/usr/local/sparc-sun-solaris2.7/include/assert.h"

sed alone cannot solve this problem. We need something like Java's
java.io.File.getCanonicalPath().



Other redundant path bits need not be simplified as Makedepend does
not produce them. We are trying to save a few bytes in a temporary
file but at the expense of complexity and extra bytes in the software
package file.  The path name was created by machine, is perfectly
correct and is to be read by machine.  Please, can we just leave the
path as it is! It worked for me.

Just remove lines 252 and 253 from hylafax-4.1beta2/port/mkdepend.in.
Well almost as sed needs something to allow passing of lines so add
'-e ""' in case "$sedprog" is empty, although I think it is set.  The
comments at 242 to 245 are wrong too, so should go.




James Lee.
jameswlee@lineone.net





____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions