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 528812 - Logout sound not playing at all
Logout sound not playing at all
Status: RESOLVED OBSOLETE
Product: gnome-session
Classification: Core
Component: gnome-session
2.26.x
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
: 530257 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-04-18 20:10 UTC by Mark
Modified: 2020-10-30 14:32 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Proposed patch (3.20 KB, patch)
2009-06-01 19:08 UTC, Michael Terry
needs-work Details | Review

Description Mark 2008-04-18 20:10:35 UTC
Hey,

I'm running Fedora 9 rawhide with the latest patches and nearly all sound things of gnome work even login! The only one that isn't working is the logout sound while it's defined and working when i click the play button next to it (in the gnome sound settings panel).

I've had it before (older gnome versions) that the logout sound was only played partly or ended abruptly but in this gnome version it simply doesn't play at all.

Thanx,
Mark
Comment 1 Lucas Rocha 2008-04-21 19:39:07 UTC
Hi Mark, which version of gnome-session are you using?
Comment 2 Lucas Rocha 2008-06-06 08:49:04 UTC
*** Bug 530257 has been marked as a duplicate of this bug. ***
Comment 3 Mark 2008-06-09 21:55:02 UTC
I'm using the latest stable version.
The ones that are installed by default on Fedora and Ubuntu.
Comment 4 Brian Cameron 2008-10-24 07:45:44 UTC
I can verify that this bug is also happening on Solaris, using GNOME 2.24.  All sounds seem to work okay, but not logout sounds.
Comment 5 Michael Terry 2009-06-01 16:32:20 UTC
I can confirm this bug on GNOME 2.26 on Ubuntu Jaunty (updating bug fields to match).

The expected way to play it appears to be via the /usr/share/gnome/shutdown/libcanberra-logout-sound.sh file installed by libcanberra.  It corresponds to the /usr/share/gnome/autostart/libcanberra-login-sound.desktop file that plays the login sound.

While gnome-session looks in /usr/share/gnome/autostart/ and runs the scripts there, it doesn't seem to know about /usr/share/gnome/shutdown/.  Is this a directory that libcanberra just made up?

Would a patch that ran scripts in that directory before shutting down be accepted?
Comment 6 Michael Terry 2009-06-01 16:57:46 UTC
On second thought, maybe running all scripts in that directory is not the best approach.  canberra is installing a .sh file, not a .desktop file, and I suspect if we implemented support for this, we'd want to use .desktop files.

And since this is the only case of something wanting to be done on shutdown, perhaps gnome-session should just call ca_context_play and directly play the sound on shutdown.
Comment 7 Dan Winship 2009-06-01 18:06:00 UTC
(In reply to comment #5)
> The expected way to play it appears to be via the
> /usr/share/gnome/shutdown/libcanberra-logout-sound.sh file installed by
> libcanberra.  It corresponds to the
> /usr/share/gnome/autostart/libcanberra-login-sound.desktop file that plays the
> login sound.
> 
> While gnome-session looks in /usr/share/gnome/autostart/ and runs the scripts
> there, it doesn't seem to know about /usr/share/gnome/shutdown/.  Is this a
> directory that libcanberra just made up?

libcanberra didn't just make that up. It's definitely supposed to work. It's possible that the code in gnome-session just never got written... :)

(In reply to comment #6)
> On second thought, maybe running all scripts in that directory is not the best
> approach.  canberra is installing a .sh file, not a .desktop file, and I
> suspect if we implemented support for this, we'd want to use .desktop files.

There are good reasons for using .desktop files for startup that don't really apply as much to shutdown. (At shutdown you're generally not really launching applications, you're just doing cleanup) Also, KDE does it this way (directory full of scripts, not .desktop files), so this moves us a little closer towards session compatibility with them.

> And since this is the only case of something wanting to be done on shutdown,
> perhaps gnome-session should just call ca_context_play and directly play the
> sound on shutdown.

The official theory is that gnome-session does not take any interest in the specifics of what happens in the session, so having it be an external script is correct. (Note that gnome-session doesn't currently depend on libcanberra.)
Comment 8 Michael Terry 2009-06-01 19:08:44 UTC
Created attachment 135759 [details] [review]
Proposed patch

Here's a possible patch to run all scripts found in the shutdown directory.  It plays a logout sound for me.

There are two open questions with it:
1) Did I put the hook in the right place (end_phase for GSM_MANAGER_PHASE_EXIT)?
2) I used spawn_sync, thinking that it would be bad if gnome-session exited in the middle of a shutdown script.  I assume that's correct, even if it means we are vulnerable to slow scripts?  Should I add timeout logic?
Comment 9 Vincent Untz 2009-06-29 21:17:46 UTC
(In reply to comment #8)
> Created an attachment (id=135759) [edit]
> Proposed patch
> 
> Here's a possible patch to run all scripts found in the shutdown directory.  It
> plays a logout sound for me.
> 
> There are two open questions with it:
> 1) Did I put the hook in the right place (end_phase for
> GSM_MANAGER_PHASE_EXIT)?

That looks okay, but I'd probably move it inside gsm_manager_quit(). Hrm, see below, though.

> 2) I used spawn_sync, thinking that it would be bad if gnome-session exited in
> the middle of a shutdown script.  I assume that's correct, even if it means we
> are vulnerable to slow scripts?  Should I add timeout logic?

Yeah. I think we'd need some timeout here. We already have some stuff that deals with timeout in phases. It might be worth adding a new phase just for this and use the current infrastructure. In that case, I imagine we would move the stuff that stops client in the EXIT phase to a new phase that is just before, and run the scripts instead in EXIT.
Comment 10 Michael Terry 2009-07-01 13:56:17 UTC
Just FYI, I don't have time now to clean this patch up myself.  I can come back to it later, or some other enterprising soul can fix it up.
Comment 11 Lennart Poettering 2009-09-11 21:48:55 UTC
Hmm, when we finally get this it would be good if the shutdown path was overridable at runtime via 'gnome-session --shutdown', similar to the way we already have 'gnome-session --autostart'. This can then be used by gdm in much the same way as --autostart to make sure the gdm login X11 display is cleaned up properly before we hand it over to the user.
Comment 12 Ghee Teo 2009-09-18 16:23:03 UTC
This is nice to have. Is there a freedesktop spec for this part of the implementation? If the directory is /usr/share/gnome/shutdown, one tends to interprete that a shutdown rather than logout. However, the libcanberra sound here is for lgout rather than shutdown. Therefore, should the directory not be /usr/share/gnome/logout? Of course the 'shutdown' directory can be reserved for actual shutdown.
Comment 13 Dan Winship 2009-09-18 16:37:51 UTC
(In reply to comment #12)
> This is nice to have. Is there a freedesktop spec for this part of the
> implementation? If the directory is /usr/share/gnome/shutdown, one tends to
> interprete that a shutdown rather than logout. However, the libcanberra sound
> here is for lgout rather than shutdown. Therefore, should the directory not be
> /usr/share/gnome/logout? Of course the 'shutdown' directory can be reserved for
> actual shutdown.

There's no freedesktop spec, but KDE uses $KDEDIR/shutdown/ (eg, /usr/share/kde/4.0/shutdown/), so I'd copied that.
Comment 14 Chris Wilson 2011-01-19 15:57:30 UTC
What's happening with this patch? There was talk of 'cleaning the patch up', but there hasn't been a resubmission.
Comment 15 aaron 2011-05-28 05:01:27 UTC
I'd be happy to clean it up.  

In what way does it need to be cleaned up?  What is it calling or doing that needs to be cleaned?  (Sorry, I'm not a gnome developer.  Just a part time coder.  I don't have the entire gnome spec in front of me.  Where is the entire gnome spec?)
Comment 16 aaron 2011-05-28 05:19:58 UTC
Apologies.  I see that it needs to "adding a new phase just for this and use the current infrastructure." and "move the stuff that stops client in the EXIT phase to a new phase that is just before, and run the scripts instead in EXIT."  But, where do I get all the specs and such for the infrastructure and the phases?
Comment 17 André Klapper 2020-10-30 14:32:25 UTC
Assuming that this problem is obsolete nowadays. 

If you can still reproduce this problem with a recent version (currently: 3.38) of GNOME / gnome-session, then please report this at https://gitlab.gnome.org/GNOME/gdm/-/issues/ and follow https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines - thanks a lot!