Article View: gnu.gcc.bug
Article #6034fix to fixinc.svr4 for gcc-2.7.2.1: symlinks to .
From: Alex Garthwaite
Date: Tue, 07 Jan 1997 00:00
Date: Tue, 07 Jan 1997 00:00
106 lines
4747 bytes
4747 bytes
When installing gcc-2.7.2.1 on a solaris 2.5.1 system, the makefile
uses fixinc.svr4 to fix up the header files. However, this script
breaks for directories of header files that contain links to '.'.
The reason for this is that 'ls -LR' doesn't do the right thing and
instead attempts to follow the link to '.' ad infinitum.
Below is a patch to fixinc.svr4 that does a much better job of
handling these sorts of links. It certainly solved my problem.
NB: the last change should be fixed in any case: there is a
missing '$' on line 1471 of fixinc.svr4.
-- Alex
--
Alex Garthwaite Internet: alex@cis.upenn.edu
Systems Programmer Computer and Information Science
University of Pennsylvania (215) 898-5617
--------------------- Attached patch for fixinc.svr4 --------------------
*** fixinc.svr4.orig Thu Jun 15 17:03:29 1995
--- fixinc.svr4 Tue Jan 7 10:11:34 1997
***************
*** 74,80 ****
echo 'Making directories:'
cd ${INPUT}
if $LINKS; then
! files=`ls -LR | sed -n s/:$//p`
else
files=`find . -type d -print | sed '/^.$/d'`
fi
--- 74,80 ----
echo 'Making directories:'
cd ${INPUT}
if $LINKS; then
! files=`find . -follow -type d -print 2>/dev/null | sed '/^.$/d'`
else
files=`find . -type d -print | sed '/^.$/d'`
fi
***************
*** 99,104 ****
--- 99,105 ----
# In case $dest is relative, get to $file's dir first.
cd ${INPUT}
cd `echo ./$file | sed -n 's&[^/]*$&&p'`
+ rwd=`pwd`
# Check that the target directory exists.
# Redirections changed to avoid bug in sh on Ultrix.
(cd $dest) > /dev/null 2>&1
***************
*** 108,114 ****
x=`pwd`
# If link leads back into ${INPUT},
# make a similar link here.
! if expr $x : "${INPUT}/.*" > /dev/null; then
# Y gets the actual target dir name, relative to ${INPUT}.
y=`echo $x | sed -n "s&${INPUT}/&&p"`
# DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
--- 109,119 ----
x=`pwd`
# If link leads back into ${INPUT},
# make a similar link here.
! if expr "$dest" : '[^/][^/]*' >/dev/null && [ ! -h $dest ]; then
! echo $file '->' $dest': Making link'
! rm -fr ${LIB}/$file > /dev/null 2>&1
! ln -s $dest ${LIB}/$file > /dev/null 2>&1
! elif expr $x : "${INPUT}/.*" > /dev/null; then
# Y gets the actual target dir name, relative to ${INPUT}.
y=`echo $x | sed -n "s&${INPUT}/&&p"`
# DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
***************
*** 117,122 ****
--- 122,136 ----
echo $file '->' $dots$y ': Making link'
rm -fr ${LIB}/$file > /dev/null 2>&1
ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
+ elif expr $x : "${rwd}/.*" > /dev/null; then
+ # Y gets the actual target dir name, relative to the directory where the link is.
+ y=`echo $x | sed -n "s&${rwd}/&&p"`
+ # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
+ dots=`echo "$file" |
+ sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
+ echo $file '->' $dots$y ': Making link'
+ rm -fr ${LIB}/$file > /dev/null 2>&1
+ ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
else
# If the link is to outside ${INPUT},
# treat this directory as if it actually contained the files.
***************
*** 1468,1474 ****
for file in $files; do
dest=`ls -ld $file | sed -n 's/.*-> //p'`
if expr "$dest" : '[^/].*' > /dev/null; then
! target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
if [ -f $target ]; then
ln -s $dest ${LIB}/$file >/dev/null 2>&1
fi
--- 1482,1488 ----
for file in $files; do
dest=`ls -ld $file | sed -n 's/.*-> //p'`
if expr "$dest" : '[^/].*' > /dev/null; then
! target=${LIB}/`echo $file | sed "s|[^/]*\$|$dest|"`
if [ -f $target ]; then
ln -s $dest ${LIB}/$file >/dev/null 2>&1
fi
Technical Details
Message-ID:
<199701071537.KAA16130@samwise.cis.upenn.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,7a5d2bc4015a3499,start X-Google-Attributes: gid113d02,public From: alex@samwise.cis.upenn.edu (Alex Garthwaite) Subject: fix to fixinc.svr4 for gcc-2.7.2.1: symlinks to . Date: 1997/01/07 Message-ID: <199701071537.KAA16130@samwise.cis.upenn.edu> X-Deja-AN: 208290616 sender: bug-gcc-request@prep.ai.mit.edu content-type: text/plain; charset=US-ASCII x-gateway: relay4.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 7 Jan 1997 10:39:35 EST mime-version: 1.0 newsgroups: gnu.gcc.bug x-mailer: ELM [version 2.4 PL23-upenn2.9]