Bug 381987 - Partitionmanager fails to get root privileges with latest kpmcore
Summary: Partitionmanager fails to get root privileges with latest kpmcore
Status: RESOLVED FIXED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 3.0
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-04 13:50 UTC by Daimonion
Modified: 2017-07-04 20:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: kpmcore 3.1.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daimonion 2017-07-04 13:50:55 UTC
With latest kpmcore (3.1.1, Arch Linux packages) partitionmanager (both 3.1.1 and 3.1.0 versions) fails to get root privileges and cannot apply any action. I have rebuilt kpmcore with these commits reversed:

1. https://github.com/KDE/kpmcore/commit/9252bc615686830615c22c32a63b004c723ce828
2. https://github.com/KDE/kpmcore/commit/63b5c8c34cf257d29fb8e67b41da7b606b32aec0

and it now works.
Comment 1 Andrius Štikonas 2017-07-04 13:58:57 UTC
Hi, I probably need a bit more info. So far I don't understand why it wouldn't work :(

Do you use separate root account with a separate password, or ir root account disabled and you use user password?

By the way feel free to join #kde-devel or #calamares on FreeNode IRC to discuss it.
Comment 2 Daimonion 2017-07-04 15:20:28 UTC
> Do you use separate root account with a separate password

Yes.

> By the way feel free to join #kde-devel

Will do.
Comment 3 Andrius Štikonas 2017-07-04 19:58:54 UTC
ok, what happens is getlogin() function fails to obtain a username, returns an empty pointer and then KDE Partition Manager crashes on nullptr dereference.

We need to add a check in kpmcore.

But I wonder why getlogin() fails. Is Arch/Parabola doing something strange with glibc?
Comment 4 Andrius Štikonas 2017-07-04 20:11:36 UTC
Git commit 13c063a1500c34b33b25a8008394af2cb65534ac by Andrius Štikonas.
Committed on 04/07/2017 at 20:07.
Pushed by stikonas into branch 'master'.

Fix a possible null pointer dereference.

On some systems getlogin() function might fail to obtain user name.
For now just check whether pointer is nullptr. In that case suspending
plasma device automounter would not work but at least we will not crash.

In future it might make sense to try to use other methods of obtaining login
name, such as running "who am i".

M  +8    -2    src/core/operationrunner.cpp

https://commits.kde.org/kpmcore/13c063a1500c34b33b25a8008394af2cb65534ac