Fwd: Re: session mgmt: does POSIX indeed prohibit NOOP execution?
> Not much room to argue? Why that? This is not about laws you have to follow blindly whether you understand them or not, this is all about an Outcome - a working machine that should properly function. "Not much to argue about what behaviour is required by the standard". The standard could have been written to require different behaviour and most probably still make sense, but it wasn't; but at least it's unambiguous. After that, the discussion is rather... philosophical. It is not the standard that concerns me, it is *failure* that concerns me. When I try to run a daemon from the base OS (in the orderly way, via daemon command), and it just DOES NOT WORK, and I need to find out and look into it what's actually wrong, then for me that's not philosophy, that's a failure that needs some effort to fix. And I dont want such issues, and, more important, I don't want other people to run into the same issue again! (Not sure what is so difficult to understand with that.) In any case, either the base system has a flaw, or the syscall has a flaw, or the Posix has a flaw. I don't care which, You're free to choose, But if you instead think that flaws are not allowed to exist because Posix is perfect, and therefore the much better solution is to just bully the people who happen to run into the flaws, well, thats also okay. rgds, PMc ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: session mgmt: does POSIX indeed prohibit NOOP execution?
## Peter (pe...@citylink.dinoex.sub.org): > > Not much room to argue? > > Why that? This is not about laws you have to follow blindly whether > you understand them or not, this is all about an Outcome - a working > machine that should properly function. "Not much to argue about what behaviour is required by the standard". The standard could have been written to require different behaviour and most probably still make sense, but it wasn't; but at least it's unambiguous. After that, the discussion is rather... philosophical. Regards, Christoph -- Spare Space ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: session mgmt: does POSIX indeed prohibit NOOP execution?
On Mon, 06 Jan 2020 01:10:57 +0100, Christoph Moench-Tegeder wrote: When a program is invoked via /usr/sbin/daemon, it should already be session leader AND group leader, and then the above code WOULD be a NOOP, unless POSIX would require the setpgid() to fail and thereby the program to abort - which, btw, is NOT a NOOP :( https://pubs.opengroup.org/onlinepubs/9699919799/ "The setpgid() function shall fail if: [...] The process indicated by the pid argument is a session leader." Okay, so, what You are saying is that I got correct information insofar that POSIX indeed demands the perceived behaviour. Thanks for that confirmation. Not much room to argue? Why that? This is not about laws you have to follow blindly whether you understand them or not, this is all about an Outcome - a working machine that should properly function. So either there are other positive aspects in this behaviour that weight against the perceived malfunction, or the requirement is simply wrong. And the latter case should be all the argument that is needed. I do not say disobey Posix. I only say that one of the involved parts must certainly be wrong, and that should be fixed. So if You are saying, the problem is in Posix, but we are in the role of blind monkeys who have to follow that alien commandment by all means no matter the outcome, then this does not seem acceptable to me. Actually, as it seems to me, this whole session thing came originally out of Kirk McKusick's kitchen and made its way from there into Posix, so if there is indeed a flaw in it, it should well be possible to fix it going the same way. In any case, this here (to be found in /etc/rc,d/kadmind) is a crappy workaround and not acceptable style: command_args="$command_args &" We aren't slaves, or, are we? I for my part came just accidentially across this matter, and as my stance is, 1. the code has to be solid enough to stand the Jupiter mission, and therefore 2. do a rootcause Always, on Every misbehaviour (and then fix it once and for all), so I figured that thing out. rgds, PMc ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: session mgmt: does POSIX indeed prohibit NOOP execution?
## Peter (pe...@citylink.dinoex.sub.org): > When a program is invoked via /usr/sbin/daemon, it should already be > session leader AND group leader, and then the above code WOULD be a > NOOP, unless POSIX would require the setpgid() to fail and thereby the > program to abort - which, btw, is NOT a NOOP :( https://pubs.opengroup.org/onlinepubs/9699919799/ "The setpgid() function shall fail if: [...] The process indicated by the pid argument is a session leader." Not much room to argue? Regards, Christoph -- Spare Space ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
session mgmt: does POSIX indeed prohibit NOOP execution?
pgrp = getpid(); if(setpgid(0, pgrp) < 0) err(1, "setpgid"); This appears to me a program trying to deemonize itself (in the old style when there was only job control but no session management). In the case this program is already properly daemonized, e.g. by starting it from /usr/sbin/daemon, this code now fails, invoking the err() clause and thereby aborting. From what I could find out, POSIX does not allow a session leader to do setpgid() on itself. When a program is invoked via /usr/sbin/daemon, it should already be session leader AND group leader, and then the above code WOULD be a NOOP, unless POSIX would require the setpgid() to fail and thereby the program to abort - which, btw, is NOT a NOOP :( So, where is the mistake here? Option 1: I have completely misunderstood something. Then please tell me what. Option 2: The quoted code is bogus. Then why is it in base? option 3: The setpgid() behaviour is bogus. It may stop a session leader from executing it, but it should detect a NOOP and just go thru with it. Then why don't we fix that? Option 4: POSIX is bogus. Unlikely, because as far as I could find out, that part of it was written following the Berkeley implementation. ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"