ilstam / FF-Multi-Converter

GUI File Format Converter
https://sites.google.com/site/ffmulticonverter/
GNU General Public License v3.0
83 stars 14 forks source link

shutdown after convertion - problematic feature #54

Closed jirib closed 6 years ago

jirib commented 7 years ago

Hi,

'Shutdown after convertion' feature seems quite odd:

            if self.shutdownQCB.isChecked():
                if utils.is_installed('systemctl'):
                    subprocess.call(shlex.split('systemctl poweroff'))
                else:
                    subprocess.call(shlex.split('shutdown -h now'))

I'm not Linux destop user but anyway, how could this work? Does this mean everybody can run 'systemctl' or 'shutdown' command? Just checking my CentOS 7 server and 'systemctl' is root owned, same on my OpenBSD box.

I'm not sure but you need dbus, polkit... Anyway, IMO the best would be do check if such integration (Linux, dbus/polkit) is available and if not then it would be best to make the checkbox inactive (greyed) with tooltip describing why it is inactive. (Or in preferences a configuration to support dbus/polkit or defining command to run, ie. 'sudo shutdown -h now'.)

ilstam commented 7 years ago

Hello there,

In Arch Linux (and derrivatives) just installing polkit immediately allows you to perform these actions. I don't know if it's like that in other distros as well. But polkit is always installed as a dependency of something else, so in all my machines I always end up with "rootless" shutdown without even trying. Not sure if it's common in general or not though.

Anyway, what you describe is nice. The problem is that you can overpass this password thing with other ways as well (for example setup passwordless sudo and alias 'shutdown' to 'sudo shutdown'). And I don't think it's easy to predict all these cases, so I wouldn't want to have a false negative and disable the option while it would work perfectly.

In the past I have completely disabled this feature because of its "complexity". But recently I brought it back again because it was requested. Well, I guess there's no big harm as it is right now. If - for whatever reason - you have passwordless shutdown it works normally. If not, it just doesn't do anything.

If could somebody provide/implement a neat solution that works in every case it would be welcome for sure. But to be honest I don't see it to be very urgent or important.

I don't know if you have any extra thoughts on this.

Thanks, Ilias