Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24228 - depscan.sh not processing symlinked /etc/init.d scripts
Summary: depscan.sh not processing symlinked /etc/init.d scripts
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-10 05:38 UTC by Gavin Panella
Modified: 2003-07-16 11:20 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Panella 2003-07-10 05:38:16 UTC
I have several locally created init scripts that I want to keep in /usr/local/etc/init.d, and 
which I symlink to from /etc/init.d.  However, /sbin/depscan.sh passes over these 
scripts because they are not regular files, so dependency information is not created. 

Reproducible: Always
Steps to Reproduce:
cd /etc/init.d 
 
# Because /sbin/runscript seems to resolve symlinks, you 
# need to make a copy of an existing service to avoid using 
# dependency information that has already been created. 
cp numlock /tmp/foo 
 
# Create a symlink 
ln -s /tmp/foo bar 
 
# Update dependency info 
/sbin/depscan.sh 
 
# Start the service 
./bar start 
 
Actual Results:  
 * Could not get dependency info for "foo"! 
 * Could not get dependency info for "foo"! 
 * Enabling numlock on ttys...                    [ ok ] 
 

Expected Results:  
If the symlink refers to a regular file depscan.sh should process it the same as a 
regular file.  It seems that the Gentoo rc system does other symlink related gubbins 
(e.g. resolving symlinks on init.d scripts) which is a little confusing; I don't understand 
the original intention... :-) 

# emerge info 
Portage 2.0.48-r1 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r4) 
================================================================= 
System uname: 2.4.19-gentoo-r10-ipvs i686 Intel(R) Pentium(R) III CPU family      
1400MHz 
GENTOO_MIRRORS="http://www.ibiblio.org/gentoo 
http://csociety-ftp.ecn.purdue.edu/pub/gentoo/ http://gentoo.mirrors.pair.com/ 
http://gentoo.seren.com/gentoo http://adelie.polymtl.ca/ 
http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo/ 
http://ftp.gentoo.skynet.be/pub/gentoo/ 
http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ 
http://ftp.easynet.nl/mirror/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo 
http://gentoo.linux.no/ http://trumpetti.atm.tut.fi/gentoo/ 
http://sunsite.cnlab-switch.ch/ftp/mirror/gentoo/ 
http://www.fhh.opensource-mirror.de/gentoo.org/ 
http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ 
http://darkstar.ist.utl.pt/gentoo/ http://ftp.caliu.info/pub/gentoo/ 
http://gentoo.inode.at/" 
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/config 
/usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /opt/tomcat/conf" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" 
PORTDIR="/usr/portage" 
DISTDIR="/usr/portage/distfiles" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR_OVERLAY="" 
USE="x86 3dnow apm crypt gif imlib jpeg libg++ mmx ncurses nls png spell xml2 zlib 
gdbm berkdb slang readline tetex tcltk java mysql postgres gpm tcpd pam libwww ssl 
perl python snmp ethereal exiscan-acl gd maildir oci8 samba sse -oss -arts -avi -cups 
-encode -gtk -kde -gnome -mikmod -motif -mpeg -oggvorbis -opengl -pdflib -quicktime 
-sdl -svga -truetype -xmms -xv -X -qt -ldap" 
COMPILER="gcc3" 
CHOST="i686-pc-linux-gnu" 
CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer" 
CXXFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer" 
ACCEPT_KEYWORDS="x86" 
MAKEOPTS="-j3" 
AUTOCLEAN="yes" 
SYNC="rsync://localhost/gentoo-portage" 
FEATURES="sandbox ccache distcc"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-16 11:20:56 UTC
This is one of those 'stone age features' that are not clear on why it
works that way.  I agree that it is not optimal.

The following patch to CVS should fix this:

-------------------------------
Index: ChangeLog
===================================================================
RCS file: /home/cvsroot/gentoo-src/rc-scripts/ChangeLog,v
retrieving revision 1.235
diff -u -u -r1.235 ChangeLog
--- ChangeLog	16 Jul 2003 18:13:45 -0000	1.235
+++ ChangeLog	16 Jul 2003 18:20:08 -0000
@@ -10,6 +10,9 @@
     Fix /etc/init.d/net.eth0 to not set rp_filter if already set via
     /etc/sysctl.conf, bug #24235 - thanks jochen <jochen.eisinger@gmx.de>.
 
+    Fix /sbin/runscript.sh and /lib/rcscripts/awk/cachedepend.awk to work
+	with symlinks in /etc/init.d/, closing bug #24228.
+
   15 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
 
     Add /bin/csh to /etc/shells.
Index: sbin/runscript.sh
===================================================================
RCS file: /home/cvsroot/gentoo-src/rc-scripts/sbin/runscript.sh,v
retrieving revision 1.22
diff -u -u -r1.22 runscript.sh
--- sbin/runscript.sh	18 May 2003 21:51:34 -0000	1.22
+++ sbin/runscript.sh	16 Jul 2003 18:20:08 -0000
@@ -16,7 +16,7 @@
 svcrestart="no"
 
 myscript="$1"
-if [ -L "$1" ]
+if [ -L "$1" -a "${1%/*}" != "/etc/init.d" ]
 then
 	myservice="$(readlink "$1")"
 else
Index: src/awk/cachedepends.awk
===================================================================
RCS file: /home/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v
retrieving revision 1.11
diff -u -u -r1.11 cachedepends.awk
--- src/awk/cachedepends.awk	21 May 2003 08:00:55 -0000	1.11
+++ src/awk/cachedepends.awk	16 Jul 2003 18:20:09 -0000
@@ -81,7 +81,7 @@
 	# Make sure that its a file we are working with,
 	# and do not process scripts, source or backup files.
 	for (x in TMPRCSCRIPTS)
-		if ((isfile(TMPRCSCRIPTS[x])) &&
+		if (((isfile(TMPRCSCRIPTS[x])) || (islink(TMPRCSCRIPTS[x]))) &&
 		    (TMPRCSCRIPTS[x] !~ /((\.(sh|c|bak))|\~)$/)) {
 
 			RCCOUNT++