Bug 1270913

Summary: cinnamon-screensaver logout-command does not work
Product: [Fedora] Fedora EPEL Reporter: Jonathan Billings <jsbillin>
Component: cinnamon-screensaverAssignee: leigh scott <leigh123linux>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: fale, fedora, leigh123linux
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cinnamon-screensaver-2.0.3-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-01 17:23:05 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:
Attachments:
Description Flags
Patch from upstream to fix away message none

Description Jonathan Billings 2015-10-12 16:07:13 UTC
Created attachment 1082056 [details]
Patch from upstream to fix away message

Description of problem:
If you set the dconf setting:
logout-enabled = true
logout-command = "cinnamon-session-quit-force-noprompt"
logout-delay = 900

In my case, I have a script called 'cinnamon-session-quit-force-noprompt' that just logs the command and runs '/usr/bin/cinnamon-session-quit --force --noprompt'.

You should have a button appear after 900 seconds (15 minutes) called "Log out" which will log out the existing user.  Instead, if the user clicks the "Log out" button, nothing happens.

Version-Release number of selected component (if applicable):
cinnamon-screensaver-0:2.0.3-2.el7.x86_64

How reproducible:


Steps to Reproduce:
1. Install cinnamon desktop with cinnamon screensaver
2. Set the dconf settings logout-enabled, logout-command and logout-delay.
3. Log in with cinnamon desktop
4. Lock screen and wait time defined in logout-delay
5. Hit the 'Logout' button at password prompt

Actual results:
Nothing happens.

Expected results:
Command defined in logout-command should be run.

Additional info:
I ended up attaching 'strace' to the running cinnamon-screensaver process, and I saw that when the button is called, this is run:

3753  execve("/usr/libexec/cinnamon-screensaver-dialog", ["/usr/libexec/cinnamon-screensaver-dialog", "--enable-logout", "--logout-command=\1"], [/* 53 vars */] <unfinished ...>
...
3753  write(2, "\n** (cinnamon-screensaver-dialog:3753): WARNING **: Could not run logout command: Failed to execute child process \"\\u0001\" (No such file or directory)\n", 151) = 151


I tried again after unlocking the screen then locking again, and saw that the bogus command was a different string of random characters.

I looked at the code, and discovered that in the gs_manager_set_away_message() function defined in src/gs-manager.c, this is run:

g_free (manager->priv->logout_command);

I don't think there's any reason why gs_manager_set_away_message() should be freeing logout_command.  Probably a bug?  I suspect that what's happening is that gs_manager_set_away_message is being called and freeing the logout_command value, but the pointer is already being used in the actual functions for calling the command, so it ends up pointing into random memory.

Fortunately, there appears that there's already an upstream fix that incidentally fixes this bug when fixing the away message, in this commit:

https://github.com/linuxmint/cinnamon-screensaver/commit/da54a610cae33232a3fa05439fa9e9d3581113e3

I rebuilt the EPEL7 cinnamon-screensaver with just this patch added, and cinnamon-screensaver now correctly executes what is defined in logout_command.  I'm also attaching the patch file.

Comment 1 Fedora Update System 2015-10-12 17:00:02 UTC
cinnamon-screensaver-2.0.3-3.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-3030f423a7

Comment 2 Fedora Update System 2015-10-12 18:49:43 UTC
cinnamon-screensaver-2.0.3-3.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update cinnamon-screensaver'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-3030f423a7

Comment 3 Fedora Update System 2015-11-01 17:23:02 UTC
cinnamon-screensaver-2.0.3-3.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.