After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 542542 - Don't offer hibernate choice if no swap
Don't offer hibernate choice if no swap
Status: RESOLVED NOTGNOME
Product: gdm
Classification: Core
Component: general
2.20.x
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2008-07-11 14:53 UTC by Michael Terry
Modified: 2009-01-22 23:46 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
/proc/swaps patch (721 bytes, patch)
2008-07-11 14:55 UTC, Michael Terry
none Details | Review

Description Michael Terry 2008-07-11 14:53:58 UTC
If there are no swap partitions, GDM probably shouldn't offer the choice to hibernate.  I'm attaching a patch that checks /proc/swaps for partitions and doesn't show the menu option if there are none.

Two things:
(A) This patch is a little janky in that it relies on the format of /proc/swaps.  I didn't find a better way to programatically ask the kernel about swaps.  I believe the /proc/swaps format is stable?

(B) It would be nicer to use HAL to ask the system if it can hibernate.  We could check power_management.can_hibernate which tells us if hibernation support is even compiled into the kernel.  And we could iterate over the volumes, checking the fstype of each for "swap" -- a cleaner way to check for swaps.

So, HAL would be cleaner, but much more involved.  Here's the quick and dirty patch anyway.
Comment 1 Michael Terry 2008-07-11 14:55:02 UTC
Created attachment 114393 [details] [review]
/proc/swaps patch
Comment 2 Sebastien Bacher 2009-01-22 23:46:38 UTC
the hibernate changes are ubuntu specific