Skip to contentSkip to conversation

su

GIT PULL Ludwig Nussel 3 participants 8 messages May 24, 2012 – May 30, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi,

coreutils isn't really interested in maintaining su anymore. Distributions have to add custom patches to fix bugs and add features. The worst offender is probably the pam patch. Fortunately we managed to sync the patch between openSUSE and Fedora meanwhile. Over time the risk that the patches divert again increases though. Since util-linux now contains a common login program it looks like a good new home for su too.

To integrate su into util-linux I've extracted the history of the su program until the last GPLv2 version (they've changed to GPLv3 meanwhile) from coreutils' git and merged it with util-linux. Then I've added the patches used in Fedora and openSUSE and fixed the files to actually build.

You can find the result in branch su-v1 (ff6b15d) at [email protected]:lnussel/util-linux.git

I've also filed a pull request on github:
https://github.com/karelzak/util-linux/pull/10

Originally I had planned to implement separate tty allocation for the child program on top of that to get rid of the evil setsid patch. It turned out to be more complicated than I thought though. The change would be too massive to backport anyways I guess. So the next step would be to rip out the non-pam legacy stuff and clean up the code to make it readable again.

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
maintainer
#1 lore raw
Quoted 8 lines · Ludwig Nussel

coreutils isn't really interested in maintaining su anymore. Distributions have to add custom patches to fix bugs and add features. The worst offender is probably the pam patch. Fortunately we managed to sync the patch between openSUSE and Fedora meanwhile. Over time the risk that the patches divert again increases though. Since util-linux now contains a common login program it looks like a good new home for su too.

Quoted 5 lines

To integrate su into util-linux I've extracted the history of the su program until the last GPLv2 version (they've changed to GPLv3 meanwhile) from coreutils' git and merged it with util-linux. Then I've added the patches used in Fedora and openSUSE and fixed the files to actually build.

Good work, thanks.

Quoted 6 lines

You can find the result in branch su-v1 (ff6b15d) at [email protected]:lnussel/util-linux.git

I've also filed a pull request on github:
https://github.com/karelzak/util-linux/pull/10

Quoted 6 lines

Originally I had planned to implement separate tty allocation for the child program on top of that to get rid of the evil setsid patch. It turned out to be more complicated than I thought though. The change would be too massive to backport anyways I guess. So the next step would be to rip out the non-pam legacy stuff and clean up the code to make it readable again.

It would be nice to cleanup the code (remove non-PAM stuff) before merge. Can you do this in your su branch? Please.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw
Quoted 11 lines · Karel Zak
Quoted 7 lines · Ludwig Nussel

coreutils isn't really interested in maintaining su anymore. Distributions have to add custom patches to fix bugs and add features. The worst offender is probably the pam patch. Fortunately we managed to sync the patch between openSUSE and Fedora meanwhile. Over time the risk that the patches divert again increases though. Since util-linux now contains a common login program it looks like a good new home for su too.

[...]
It would be nice to cleanup the code (remove non-PAM stuff) before merge. Can you do this in your su branch? Please.

Done.

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
maintainer
#4 lore raw

su(1) wish list

Quoted 7 lines · Karel Zak
Quoted 2 lines · Ludwig Nussel

I've also filed a pull request on github:
https://github.com/karelzak/util-linux/pull/10

Merged, but you forgot man page ;-) I don't think we need whole history for the man page, so just copy and edit any existing su.1 man page and send it as a patch.

another issue:

- why su.c expects "PATH" and "SUPATH" login default variables, but login.c expects "ENV_PATH" and "ENV_SUPATH"?

See also login.def man page from shadow-utils where ENV_* is documented (for login as well as for su).

IMHO we need to share the configuration between login and su.

and wish list:

- remove MAX(), use max() from c.h
- use err(), errx() and warn() and warnx() rather than error()
- share init_environ() from login.c with su.c
- cleanup usage()
- move longopts[] to main
- remove horrible PAM_BAIL macro, see is_pam_failure() in login.c
- remove #if 0 code

- simplify xsetenv(), move it to include/env.h as inline function, and use it in su.c, login.c etc.

IMHO we can use code without putenv(), something like

if (setenv(name, value, ow) != 0)
err(EXIT_FAILURE, "failed to set %s variable", name);

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw

Re: su(1) wish list

Quoted 8 lines · Karel Zak
Quoted 7 lines · Karel Zak
Quoted 2 lines · Ludwig Nussel

I've also filed a pull request on github:
https://github.com/karelzak/util-linux/pull/10

Merged, but you forgot man page ;-) I don't think we need whole history for the man page, so just copy and edit any existing su.1 man page and send it as a patch.

The su man page from coreutils is pretty brief. More docu is in the info page. The license is the FDL, would that be ok or would a new man page from scratch be better? Or maybe the one from shadow-utils?

Quoted 9 lines

another issue:

- why su.c expects "PATH" and "SUPATH" login default variables, but login.c expects "ENV_PATH" and "ENV_SUPATH"?

See also login.def man page from shadow-utils where ENV_* is documented (for login as well as for su).

IMHO we need to share the configuration between login and su.

No idea why it is different. Probably legacy stuff. I see no reason why to use different values than login though.

Quoted 1 line

and wish list:

ACK

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
#6 lore raw

RE: su(1) wish list

Quoted 2 lines · Ludwig Nussel

The su man page from coreutils is pretty brief. More docu is in the info page.

Coreutil's manpages are generated from --help output. It's intension is just to have a brief overview over the behavior and the options. Therefore it's almost always better to look into the info pages. AFAIR that's GNU-ish.

Have a nice day,
Berny

maintainer
#7 lore raw

Re: su(1) wish list

In reply to Ludwig Nussel
Quoted 6 lines · Ludwig Nussel
Quoted 5 lines · Karel Zak
Quoted 4 lines · Karel Zak
Quoted 2 lines · Ludwig Nussel

I've also filed a pull request on github:
https://github.com/karelzak/util-linux/pull/10

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Merged, but you forgot man page ;-) I don't think we need whole history for the man page, so just copy and edit any existing su.1 man page and send it as a patch.

The su man page from coreutils is pretty brief. More docu is in the info page. The license is the FDL, would that be ok or would a new man page from scratch be better? Or maybe the one from shadow-utils?

It should be pretty simple to write a new man page from scratch -- as an example see some new man pages in util-linux (e.g. lsblk, lslocks, ...)

Quoted 2 lines

No idea why it is different. Probably legacy stuff. I see no reason why to use different values than login though.

OK, I'll (or Sami in his cleanup) will change it. Thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com