Bug 102372

Summary: Patch to remove root's username dependencies
Product: [I don't know] kde Reporter: Lucas Correia Villa Real <lucasvr>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: nate, rakuco
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Gets the superuser's name in a portable way

Description Lucas Correia Villa Real 2005-03-24 17:06:55 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          GCC 3.4.3 
OS:                Linux

The KDE build system and some KDE sources currently assumes that the superuser is called "root". This is not a good idea, since the only assumption should be that the superuser has uid=0.

This patch fixes that for the KDE-Base, by replacing "root" by the portable getpwuid() calls and by replacing "root" by "0" on shell scripts.
Comment 1 Lucas Correia Villa Real 2005-03-24 17:07:54 UTC
Created attachment 10327 [details]
Gets the superuser's name in a portable way

This patch fixes that for the KDE-Base, by replacing "root" by the portable
getpwuid() calls and by replacing "root" by "0" on shell scripts.
Comment 2 Waldo Bastian 2005-03-24 19:40:49 UTC
Some parts of KDE actually use $ADMIN_ACCOUNT when defined instead of root.
Comment 3 Stephan Kulow 2005-03-30 15:55:32 UTC
I don't like the patch as it copies code around. Add a static function to kuser.h that returns the correct name and take in account what Waldo said:

      if (user.isEmpty())
        user = ::getenv("ADMIN_ACCOUNT");
      if (user.isEmpty())
        user = "root";
Comment 4 Raphael Kubo da Costa 2009-08-25 03:14:31 UTC
I can see that some places still use hard-coded "root". Lucas, is it still relevant for you? Can you update the patch?
Comment 5 Nate Graham 2020-09-29 03:06:37 UTC
Not relevant anymore.