InterNetNews / inn

INN (InterNetNews) Usenet server
https://www.isc.org/othersoftware/#INN
Other
68 stars 13 forks source link

Remove the need for the "nnrpd -s" hack: improve setproctitle() and fix /usr/ucb/ps on Solaris #53

Open rra opened 3 years ago

rra commented 3 years ago

Reported by eagle on 14 Dec 2008 07:43 UTC Reported by Miroslaw Luc mirecki@nask.pl.

  1. ps reads all of the strings from argv, not just argv[0], to the nearest NULL. Setting argv[1] to NULL helps ps to read only argv[0].

  2. If the length of the initial args > argv[0] modified by setproctitle() then ps discards the latter and displays the initial args. The problem is that it is always true because of using SPACES in ovdb_monitor/ovdb_server and `-s' in nnrpd.

We should:

  1. Set argv[1] to NULL in setproctitle().
  2. Move the environment to malloc()'ed space to make a room for argv[0].
  3. Spawn nnrpd without `-s'.
  4. Remove SPACES from ovdb_init,monitor,server.

It's not clear if this is worth it; setproctitle() seems to be getting less and less popular.

Julien-Elie commented 3 years ago

Does someone know if setproctitle() works with ps on Solaris 10 & 11?

Julien-Elie commented 1 year ago

Using /usr/ucb/ps -auxww on Solaris 10 and Solaris 11 shows the problem is still present:

$ /usr/ucb/ps -auxwww | grep nnrpd      
iulius   12698  0.0  0.0 8240 1664 ?        S 11:39:24  0:00 - nnrpd: acceptin  acceptin ceptin tin
iulius   12717  0.0  0.0 8376 1944 ?        S 11:40:09  0:00 - nnrpd: localhos  localhos calhos hos

And native ps auxww does not show the updated process title:

$ ps auxww | grep nnrpd
iulius   12790  0.0  0.0 8264 1024 ?        S 12:00:24  0:00 ./nnrpd -D -p 11119

Solaris 11.4 is currently announced to be supported by Oracle until 2034, so I keep this ticket open, and update its title.

Julien-Elie commented 1 year ago

Fixing that issue on Solaris will permit getting rid of the -s flag hack for nnrpd. Let's schedule it for the next major release.