tlog
tlog copied to clipboard
tlog-rec-session: what happens if default shell does not exist?
the "shell" configuration defaults to /bin/bash
. But what if /bin/bash
does not exist or
is not in /etc/shells
? I'm not totally clear on how the configuration happens (I hit some
m4 and my eyes glazed over) but I don't see that this is handled in any way.
For portability, I'd suggest to either use /bin/sh
as the default, or to at least have /bin/sh
as a "reserve fallback" if /bin/bash
is not available.
At the moment, if the configured shell doesn't exist, session is aborted.
I don't think tlog-rec-session should do any falling back if the shell doesn't exist. It's supposed to be transparent as much as possible. Login services, such as login
and sshd
refuse to login, if the user's shell doesn't exist, after all. I would rather have that straightforward and easy to predict.
Regarding portability, I think bash is the most widespread shell nowadays, and setting the shell to /bin/sh
would surprise people using distros such as Debian, where /bin/sh
is not necessarily bash.
I would leave changing the shell to packaging, if any distro or OS wishes to use something else.
However, do you see /bin/bash
being absent often, perhaps in some cases important to us?
Regarding /etc/shells
, I think we should check if disallowing users to login with shells not in /etc/shells
would be a good thing.
m4 is used only during build to generate the configs (and configuration and command-line parsing code). However, what .conf files you see after the build in the src directory is what will be installed and used (with "DO NOT EDIT" warnings removed). The .default.conf
files go into /usr/share/tlog
to provide the default configuration and just the .conf
files go into /etc/tlog
for administrators to edit.
Actual values that go into the installed configuration files are in m4/tlog/*_conf_schema.m4
files. The shell in particular is in m4/tlog/rec_session_conf_schema.m4
.
Plenty of systems do not come with bash. I accept your point that packagers will set a default to whatever makes the most sense, but at the same time, if someone just downloads the source, builds it and runs it, you want it to work on a system that does not have bash. /bin/sh
can be assumed, bash cannot.
Yeah, I agree that /bin/sh
can be assumed, but, strictly speaking, /bin/bash
cannot. However, could you perhaps list some cases where /bin/bash
is not available, which we should care about?
It's just a general portability issue. Linuxisms and bashisms should be avoided. When people want to run this on FreeBSD or whatever, it will be a roadblock. Maybe there are other portability issues right now, but this one is easy to fix.
But it is up to you; it is just a suggestion from someone who does not use Linux as his main OS (don't tell my employer ;) )
Ah, I see. Well, I'm not sure if tlog would even build on FreeBSD (provided of course journal support is removed). Although I would like it to.
I would like it to be portable in general, but at the same time I'm concerned about the initial impression and the need to configure tlog right after installation on systems where /bin/bash
is the norm, and which are our primary targets.
A compromise might be adding a configure option to specify the default shell to make it easier to build and package for systems where /bin/bash
is not normally present.
Maybe configure script could detect system and set the default shell for particular systems e.g. Debian, Fedora, RHEL, and /bin/sh
for other systems.
I would prefer not to have configure detect the distro. That would be generally unreliable, unexpected by maintainers, and hard to debug.
What are Linux distros which don't have bash installed by default?
I don't know of any particular general-purpose GNU+Linux distros that don't come with bash.