Line 512 of /sbin/rc : if the $svcdir variable is not defined, this line removes everything on the hard drive ("rm -rf /*"). I guess that by default the variable should be set to an innoffencive value Reproducible: Always Steps to Reproduce: 1. copy /sbin/rc in /etc/init.d/ of a debian box 2. run "/etc/init.d/rc reboot" 3. the hard drive is empty. Enjoy :-) Actual Results: The hard drive was empty Expected Results: reboot the computer
1) why are you using gentoo's rc for debian 2) post emerge --info like it asks 3) there's no such line locally that does that in my /sbin/rc
I'm using gentoo's rc on debian for experimental purposes. here is the part of /sbin/rc I'm talking about # Clear $svcdir from stale entries, but leave the caches around, as it # should help speed things up a bit rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \ grep -ve '\(depcache\|deptree\|envcache\)') and here is the emerge info Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.5-r1, 2.6.11-gentoo-r6 i686) ================================================================= System uname: 2.6.11-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz Gentoo Base System version 1.6.13 dev-lang/python: 2.3.5 sys-apps/sandbox: 1.2.11 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5 sys-devel/binutils: 2.15.92.0.2-r10 sys-devel/libtool: 1.5.18-r1 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://mirror.switch.ch/mirror/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://mir.zyrianes.net/gentoo/ http://mir.zyrianes.net/gentoo/" LANG="fr_FR.UTF-8" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X alsa apm avi bash-completion berkdb bitmap-fonts cdr crypt cups curl divx4linux dvd eds emacs emacs-w3 emboss encode esd fam fftw foomaticdb fortran gd gdbm gif gpm gstreamer gtk gtk2 guile imagemagick imap imlib ipv6 java jpeg libg++ libwww mad mikmod motif mp3 mpeg ncurses nls offensive ogg oggvorbis opengl oss pam pdflib perl php png python qt quicktime radeon readline sdl spell ssl svga tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts vorbis x86 xml2 xmms xv xvid zlib video_cards_radeon userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Sorry, but Gentoo bugzilla is not a support forum. And certainly don't mark problems totally unrelated to Gentoo as critical. I'm still missing how is this related to Gentoo and why this is in bugzilla.
This pertains to a valuable lesson. If you're going to experiment with something that is part of the core functionality of your system, know what the code does. Solution? Define $svcdir then. It is also not specifically added there with the malicious intent of destroying a user's system, so it doesn't belong here.
Well, apparently johnm requested this bug be opened, so here's a patch against the latest sys-apps/baselayout-1.12.0_pre5 attached.
Created attachment 66240 [details, diff] rc.patch
copy /sbin/functions.sh to your debian box too