Bug in post-removal of manjaro-settings-samba: group doesn't get removed

Recently, when I removed the manjaro-settings-samba package from my system, I noticed something pretty weird. Here's the output.

[awesome@i56400 ~]$ sudo pacman -R manjaro-settings-samba
[sudo] password for awesome: 
checking dependencies...

Packages (1) manjaro-settings-samba-20180509-2

Total Removed Size:  0.03 MiB

:: Do you want to remove these packages? [Y/n] y
:: Processing package changes...
(1/1) removing manjaro-settings-samba              [######################] 100%
==> Attempting to disable Samba services...Removed /etc/systemd/system/multi-user.target.wants/smb.service.
Removed /etc/systemd/system/multi-user.target.wants/nmb.service.
groupadd: group 'sambashare' already exists

==> Samba services should now be disabled. Reboot your system.
[awesome@i56400 ~]$ man groupadd
[awesome@i56400 ~]$ getent group sambashare

Somehow, when I removed manjaro-settings-samba, the post-remove function of that package tried to add a group called sambashare, and of course failed to do so because the group already existed (it was created when I installed the package on my system). I suppose the intent was to remove this group, not to add it.

Looking at the build files on the old Github (it is not on Gitlab yet, most likely because it has not been modified since the moment Manjaro moved on its own Gitlab instance), I notice this.

post_remove() {
  msg "Attempting to disable Samba services..."
  ! systemctl is-active smb >/dev/null || systemctl disable smb
  ! systemctl is-active nmb >/dev/null || systemctl disable nmb
  ! getent group sambashare || groupadd -r sambashare
  echo ""
  msg "Samba services should now be disabled. Reboot your system."
echo ""

So at post-removal, the following command is executed : ! getent group sambashare || groupadd -r sambashare. So yes, it was really using the groupadd command. Instead of groupadd -r, it should be groupdel instead in order to remove the group instead of adding it.

Last packager is @Ste74.

(It will be a good moment to add it in Manjaro's Gitlab.)


Done.. thank you.. seem i have used an old config :innocent:

1 Like