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)



   From: "Phil Watkinson" <Pkwatkinson@tesco.net>
   Date: Sat, 24 Jun 2000 10:24:50 +0100

   This bug has been found by James Lee, whose email with his patch to
   solve the problem is added to the bottom of this mail.

   Due to the fact that the number of HylaFAX users who use Solaris and
   are sed experts are very few  (and based on the response James has
   had to his patch I would guess that number is 1, James himself)

Now you know 2.  :-)

   there has been no testing or confirmation that the patch is good;

I looked into his patch.  It worked for me, but my patch has the
following advantages:

* It's easier to maintain and understand.

* It handles the case of FOO/SYMLINK/../BAR correctly.  The current
  code, even with Lee's patch, incorrectly substitutes FOO/BAR.

* It handles the case of //FOO correctly on old-fashioned hosts where
  leading // is significant.  POSIX.1 allows a special meaning for
  leading //, so it's incorrect to replace //FOO with /FOO on those hosts.

On the other hand, James Lee's patch has the following advantages over
the patch that I submitted:

* It handles the case of .//FOO correctly.

* It optimizes ./FOO to FOO even at the start of a line.

So here's a revision to my proposed patch that combines the advantages
of the two patches.


2000-06-26  Paul Eggert  <eggert@twinsun.com>

	* port/mkdepend.in: Don't try to optimize "a/b/../d" into
	"a/d".  This is incorrect if b is a symbolic link.  Also, the
	code was broken anyway: it transformed "/2.95.2/../"
	into "/2.95.../".

===================================================================
RCS file: port/mkdepend.in,v
retrieving revision 1.1
retrieving revision 1.3
diff -pu -r1.1 -r1.3
--- port/mkdepend.in	1998/10/12 20:47:50	1.1
+++ port/mkdepend.in	2000/06/26 16:04:40	1.3
@@ -249,8 +249,9 @@ fi
 depgenxx=`echo $depgen|sed -e s/\'//g -e 's/(/\\(/g' -e 's/)/\\)/g'`
 $depgenxx $* |
     eval "sed \
-	-e :loop -e 's:[^\./][^\./]*/\.\./::g' -e tloop \
-	-e 's:\([/ ]\)\./:\1:g' \
+	-e 's:^: :' \
+	-e 's:\([/ ]\)\.//*:\1:g' \
+	-e 's:^ ::' \
 	$sedprog" |
     $AWK "$awkprog" >> $newdepfile
 




--------------------previous mail by James Lee---------------------------
Re sed script to simplify:
`/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/../../../../sparc-sun-so
laris2.7/include/assert.h'

[snip]
So please allow me to offer this:

old line 252 and 253 in ``port/mkdepend.in'':
-e :loop -e 's:[^\./][^\./]*/\.\./::g' -e tloop \
-e 's:\([/ ]\)\./:\1:g' \
new:
-e s:///*:/:g -e 's:^: :' -e 's: \([^/ ]\): ./\1:g' \
-e :a -e 's:/\./:/:' -e 's:/\.\./://:' -e ta \
-e :b -e 's:/[^/ ][^/ ]*//:/:' -e tb \
-e :c -e s://:/../: -e tc \
-e 's: \./\([^ ]\): \1:g' -e 's:^ ::' \


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




Project hosted by iFAX Solutions