* Nathaniel Smith said: > > > And dynamic loader returns 127 in case dynamic bindings fail. That can be > > > used with much reliability for the test. Bash doesn't have such exit code. > > > > This is really getting tiresome. Try this: > > > > (from tcsh) > > sh > > perl -e 'exit 127' > > exit > > echo $? > > Yes, I know. There is no perfect way to figure this out, and if you have a > better suggestion I would love to hear it. However, I don't think that the > assumption that if the login shell exits with an error code within a second > or two of starting up will happen in non-pathological cases -- certainly, if > you explicitly try to trigger it by logging in as root, typing that perl, > and then exiting, you might be able to do it quickly enough that you could > trigger the fallback shell. However, this is unlikely enough that given the > inevitable compromise here (like I said, I'm fairly certain that it is > impossible to do "correctly"), I would consider it to be acceptable on my > box, and I think many other people would as well (please, remember, I don't > argue for necessarily forcing this on anyone). Well, I think that a fairly good solution for the problem you are talking about above would be to write a wrapper to be put as a root's login shell. It would exec either a dynamic shell (passed on the command line, /bin/sh if nothing is passed) or a static shell (either predefined or also passed on command line). Then we know that what we exec is actually a shell (unless somebody puts something weird as a root's shell - but that's not our problem) and we can forget about the case as above with a perl/whatever script returning a 127 error code. Either way, the error code _bears_ a possibility of being returned by the dynamic loader and it's better to be safe than sorry. marek
Attachment:
pgpbqYqH0fwEA.pgp
Description: PGP signature