Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

su - osh-user fails with "invalid applet name su" #319

Open
andychu opened this issue May 30, 2019 · 2 comments
Open

su - osh-user fails with "invalid applet name su" #319

andychu opened this issue May 30, 2019 · 2 comments

Comments

@andychu
Copy link
Contributor

andychu commented May 30, 2019

It works for su user, but not su - user or su -l user.

It works fine with dash.

$ su -l osh-user
Password: 
oil: Invalid applet name 'su'.

andy@lisa:/etc/profile.d$ su - osh-user
Password: 
oil: Invalid applet name 'su'.

Found it while investigating #318.

@lulcat
Copy link

lulcat commented Feb 16, 2021

the reason is of course because osh doesn't support --login or -l, which - is an alias of,

you can also replicate an error with su - user -s /path/osh

being the noob that I am, I would just patch here if upstream doesn't he:

add su to recognised incoming applet names. After all, su is pretty ancient, ubiquitous and will be there if macro checks for
__linux or __POSIX or whatever :d
then just deal with whatever... although once that is solved, I assum eit's because you most likely , should , in thename of
interoperability, add --login,-l as silent parsers instead of exiting. By this I mean, if you only want a single entrypoint (no /etc/profile vs. all kinds of various paths), I get that, AND document it.. BUT allow for the flag at least to silently be a no-op
that way one can still use scripts doing chroot $SHELL --login .... bla bla wihtout osh being the odd one out.

Of course, someone might at first get bitten in the bum regarding oh, why wasn't /etc/profile read, but this happens with ANY shell tbh, and people just assume stuff because they are used to certain systems setup. :)

One you have allowed the -l (no-op or whatever), then su becomes trivial (I think).

I would love to help but 2 things, timeeeee as I do so much but also, .

Still, I can whilst I am patching some other shell code, grab yours and have a look if anything.

@andychu
Copy link
Contributor Author

andychu commented Jan 21, 2022

Ah sorry for dropping this ...


I can reproduce this now

$ sudo useradd --shell /usr/local/bin/osh osh-user

andy@lenny:~/git/oilshell/oil$ sudo su -l osh-user
No directory, logging in with HOME=/
oil: Invalid applet name 'su'.

Even though we have -l and --login

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants