network_restart script should catch exactly where it requires running as root
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Checkbox Provider - Base |
Invalid
|
Low
|
Unassigned |
Bug Description
The network_restart script checks for root permissions at the top of the main function:
# Verify that script is run as root
if os.getuid():
'This script needs superuser permissions to run correctly\n')
return 1
The problem is that it's unclear why the script can't run as root. What if the script is refactored one day so that it doesn't really need to run as root anymore? Unfortunately, there's no way to know what parts of the script make any assumption about running as root. The script is therefore doomed to always require running as root whether it's actually required or not.
The right solution would be to properly check the return value exactly where the script might encounter an error when not running as root. Then, when that error is caught, report an error to the user.
Related branches
- Marc Tardif (community): Needs Fixing
-
Diff: 171 lines (+65/-23)2 files modifieddebian/changelog (+2/-0)
scripts/network_restart (+63/-23)
affects: | checkbox → plainbox-provider-checkbox |
Changed in plainbox-provider-checkbox: | |
milestone: | none → future |
Changed in plainbox-provider-checkbox: | |
status: | Triaged → Invalid |
Agreed, although I don't see this causing any huge issues even in the long run