-
Notifications
You must be signed in to change notification settings - Fork 249
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
User Services #573
User Services #573
Conversation
c664da6
to
52a6b29
Compare
src/shared/misc.c
Outdated
char * | ||
rc_krunlevel_path_get() { | ||
if (!krunlevel_path) { | ||
krunlevel_path = xmalloc(sizeof(char) * PATH_MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @anna-cli. One major problem I see is that memory is allocated each time the function is called, but never freed. Or did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @anna-cli. One major problem I see is that memory is allocated each time the function is called, but never freed. Or did I miss something?
Hello @andy5995! It shouldn't allocate more than once per function (since the
pointers are global, and there's the check before allocation). But you
made me realise that is probably better to just declare the string as a
static char array inside the function!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at #432 I don't see any of the maintainers making any comment on whether this feature is desired or not.
But just glancing over the diff, I see a decent amount of things which I do not like. I figured I'd leave my comments in here.
But keep in mind that I'm not a maintainer here, so for some of my "larger design related" comments, you probably should wait for a maintainer to comment before acting on it.
c89ba7d
to
8cf077a
Compare
7436c74
to
dec4e6a
Compare
Hello again! Last two days I rewrote the whole patchset, and I think it is ready for review! (although there's probably a few mistakes left still). |
f035ad9
to
b27b375
Compare
@dwfreed @williamh @vapier (CC @thesamesam), Hello! sam recommended I tag one of you, could you check this PR? If it is a desired feature, and if the code overall looks okay! I am currently daily driving the the patches and looking for bugs and if everything is working too. |
Easy way to test on gentoo:
|
114eea7
to
be062d4
Compare
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]> Closes: OpenRC#573 Signed-off-by: Sam James <[email protected]>
This is great! However, have you had any problems with services using D-Bus at all? How would you handle environment exports like that? I am asking since stuff like PipeWire requires it to properly function. |
for the scripts i wrote so far, only wireplumber needs dbus, a hack to make it work is setting 'rc_env_allow="DBUS_SESSION_BUS_ADDRESS"' in .config/openrc/rc.conf, tho this won't really work when the runlevel is started via PAM (which would be the ideal way to handle that imo). one thing i'm thinking is making a user init script for a dbus user session, that could be a step to allow the services to see dbus, tho i'm still not sure how to get the var from that into the env of other scripts |
That's the problem. You should preemptively export Now, as for the how, it's up to you; I think you can place it in Also yes, an accompanying PAM module might be beneficial to the PR. I would suggest looking at https://github.com/chimera-linux/turnstile/blob/master/src/pam_turnstile.cc |
Get rid of the alarm/setjmp/longjmp. Trust that the kernel will not block with O_NDELAY. Use write() instead of stdio. Bug: https://bugs.gentoo.org/923326 Signed-off-by: Mike Gilbert <[email protected]>
- Remove 'pkgconfig' subdir - use meson 'pkgconfig' module to generate and install appropriate .pc files when required. - add `rc_path` variable to installed pkgconfig files Signed-off-by: Matt Jolly <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
The stop schedule code calls syslog, so we need to open a syslog connection so the process name will get properly logged on musl, and we can ensure the pid gets logged and the right facility is used.
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
some services might expect to be in home, and may behave unexpectedly for the user, e.g. any program started via dbus, and this matches systemd-user behaviour. Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
superseded by #723 for the sole reason of github doesn't let me change the source branch of a pr (seriously gh??) |
Hello! This is the start of a draft for supporting user services.
The current "design" works by basically mimicking the layout of the system services.
This commit is the start of the proof of concept, based on what was talked on #432.
I'm opening this draft PR early to ask for some comments and a bit of guidance (since is this my first patch contributing to any project!), and to track progress of the feature.
The current implementation for paths is not that great IMO but I failed to think of a better one.
This also only includes librc, some other utilities are accessing the define'd variables and thus are broken in this patch, but I was able to get rc-update and rc-status, and to an extend, rc-service too, working as things is (granted I created the files in .config manually).
Once a better implementation is decided (or if this one is deemed ideal) I'll patch every file needed and run the tests properly.
The current implementation checks for the callers
euid
in order to toggle to user mode. If this is not desirable, we could instead introduce subcommands or flags in the commands themselves (rc-update user add <service>
for example)I am also still not familiar with openrc-run, so more study on that and the possible syntax for user service files is needed.
In resume, the idea is to have user-specific runtimes, limited to the users home folder, and tracked by the user (either via PAM, by running the
openrc
command manually to set the runlevel or other method).If this feature is wanted, I'm willing to keep developing it and maintaining it for as long as necessary.
Signed-off-by: anna [email protected]