I've installed vcron, then anacron ( both from portage ). Now whenever the default runlevel is entered, rc is confused because of the '*cron' link, and expands /etc/init.d/anacron and /etc/init.d/cron at the same time. + '[' '!' -e /etc/init.d/anacron /etc/init.d/vcron ']' /sbin/rc: [: /etc/init.d/anacron: binary operator expected + ln -sf /etc/init.d/anacron /etc/init.d/vcron '/mnt/.init.d/softscripts.new/*cron' ln: when making multiple links, last argument must be a directory
Can you attach your /sbin/rc ? I am not sure what happens here, as it is not supposed to reference '*cron'. -------------------relevant piece of code--------------------- for x in ${myscripts} do if [ ! -e /etc/init.d/${x} ] then ewarn "WARNING: /etc/init.d/${x} missing; skipping..." continue fi # the -f eliminates a warning if the symlink already exists, # which can happen if a service is in both the boot level and # the current "normal" runlevel ln -sf /etc/init.d/${x} ${svcdir}/softscripts.new/${x} done -------------------------------------------------------------
Created attachment 5369 [details] /sbin/rc this is my /sbin/rc
I emerged vcron and am experiencing a similar problem. The cause would seem to be the pathname: /etc/runlevels/default/*cron I'm no bash guru, but it doesn't seem like a good idea to use '*' in critical system runlevel filenames unless you really want to make your life more complicated. I'm going to tinker with this problem today and see if I can figure out a fix. For what it's worth, I notice that in /sbin/rc there are a few calls to the dolisting() func from /sbin/functions.sh where the params aren't quoted. The comment attached to dolisting() warns, in part: "quote the params if they contain globs".
Nowhere does it call 'dolisting /foo/*' ... Also I cannot see where '*cron' is referenced.
/etc/runlevels/default/*cron is referenced at /sbin/rc line 222. Quoting the variable in the symlink test at that line eliminates one of the errors but not all of them. As for a fix, I removed /etc/runlevels/default/*cron and ran '/sbin/rc-update add vcron default', then rebooted. No more error messages and after boot cron is running as expected. Because the test failure prevents the filename containing the glob character or any of the elements of the expanded glob being appended to myscripts, the errors are harmless; the other values for x cause no errors and are appended to myscripts if they are symlinks, as expected. rc calls the dolisting() function from /sbin/functions.sh passing it the string "/etc/runlevels/default". dolisting() changes the default directory to /etc/runlevels/default and builds a space-separated string of <path>/<symlink> strings and returns it. /sbin/rc tests each element of the list produced by the word splitting of this string without quoting it, permitting glob expansion of the element "/etc/runlevels/default/*cron" so that the test expression becomes: if [ -L /etc/runlevels/default/*cron /etc/runlevels/default/anacron /etc/runlevels/default/vcron ] This is the cause of the first error, -L expects a single argument. Note what happens in the first example when ${f} is unquoted in the argument to -L. The glob "*cron" is expanded to the list "*cron vcron". In the filer's case, this list expands to "*cron anacron vcron". $ for f in \*cron vcron; do if [ -L ${f} ]; then echo "syml: ${f}"; else echo not syml: ${f}; fi; done [: *cron: binary operator expected not syml: *cron vcron syml: vcron $ for f in \*cron vcron; do if [ -L "${f}" ]; then echo "syml: ${f}"; else echo "not syml: ${f}"; fi; done not syml: *cron syml: vcron
Let me put it this way .. I do not see how you get "/etc/runlevels/default/*cron" in there ? I checked it this side, and it works fine. Maybe im just too involved to see what could be going wrong your side, but ....
There was a file called: /etc/runlevels/default/*cron <-- That's a literal asterisk. I rm'd that file and the errors went away. At some point a script probably tried to perform some operation against all the cron-related symlinks in that directory but did it in such a way that the glob wasn't expanded. My guess would be that it happened when I emerged vcron. I'll try to figure out where that file comes from the next time I do an install, probably within the next couple of days.
It wont be vron, as the ebuild never touch /etc/runlevels. Only thing it could be is rc-update, or something else in baselayout. Only problem is that I have never seen this :( How did you call rc-update to add vcron and anacron ?
I didn't run rc-update when I first installed the stuff out of ignorance. So it's not rc-update. Then on next startup this error occured. My guess is that that *cron link must have been there since one of the install phases of gentoo ? I've compiled all phases myself.
I quoted the tests in rc-update and /sbin/rc ... it should handle '*' in links much better now. This will be present in baselayout-1.8.5.6 ...