Bug 1986111

Summary: groupdel gives segmentation fault when using '-P'
Product: [Fedora] Fedora Reporter: Roy Lenferink <lenferinkroy>
Component: shadow-utilsAssignee: Iker Pedrosa <ipedrosa>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: high    
Version: 34CC: francois.rigault, ipedrosa, lberton, lenferinkroy, pvrabec, tm
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: shadow-utils-4.9-8.fc35 shadow-utils-4.8.1-10.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-26 01:22:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roy Lenferink 2021-07-26 17:18:07 UTC
Description of problem:
When using groupdel with a prefix path, it segfaults on Fedora 34.
groupadd and groupmod both are working fine.

Version-Release number of selected component (if applicable):
shadow-utils-4.8.1-8.fc34.x86_64

How reproducible:
Every time groupdel is executed (as root)

Steps to Reproduce:
1. Create a custom /etc/group file, e.g. using
[root@fedora ~]# mkdir -p $HOME/custom_root/etc/ && touch $HOME/custom_root/etc/group
2. Create a group (succeeds)
[root@fedora ~]# groupadd -P $HOME/custom_root test_group
3. Delete the group (fails)
[root@fedora ~]# groupdel -P $HOME/custom_root test_group

Actual results:
[root@fedora ~]# groupdel -P $HOME/custom_root test_group
Segmentation fault (core dumped)

Expected results:
Return code 0 with the group deleted from $HOME/custom_root/etc/group

Additional info:
[root@fedora ~]# gdb --args groupdel -P $HOME/custom_root test_group
(gdb) run
Starting program: /usr/sbin/groupdel -P /root/custom_root test_group

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7df795b in fgetpos@@GLIBC_2.2.5 () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff7df795b in fgetpos@@GLIBC_2.2.5 () from /lib64/libc.so.6
#1  0x00007ffff7e4d442 in fgetpwent () from /lib64/libc.so.6
#2  0x000055555555882c in main ()
(gdb) 

[root@fedora ~]# rpm -qa | grep glibc
glibc-all-langpacks-2.33-20.fc34.x86_64
glibc-common-2.33-20.fc34.x86_64
glibc-langpack-en-2.33-20.fc34.x86_64
glibc-2.33-20.fc34.x86_64
glibc-doc-2.33-20.fc34.noarch
glibc-headers-x86-2.33-20.fc34.noarch
glibc-devel-2.33-20.fc34.x86_64

Comment 1 Iker Pedrosa 2021-11-19 08:28:30 UTC
master
    groupdel: fix SIGSEGV when passwd does not exist - a757b458ffb4fb9a40bcbb4f7869449431c67f83

Comment 2 Fedora Update System 2021-11-23 08:48:14 UTC
FEDORA-2021-380251ce99 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-380251ce99

Comment 3 Fedora Update System 2021-11-24 01:57:06 UTC
FEDORA-2021-380251ce99 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-380251ce99`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-380251ce99

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2021-11-26 01:22:22 UTC
FEDORA-2021-380251ce99 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2021-11-30 14:44:52 UTC
FEDORA-2021-6ac83612a5 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-6ac83612a5

Comment 6 Fedora Update System 2021-12-01 01:56:29 UTC
FEDORA-2021-6ac83612a5 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-6ac83612a5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-6ac83612a5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2021-12-16 01:12:07 UTC
FEDORA-2021-6ac83612a5 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.