SIGTERM does not work on earthwallpaper.sh_new

Bug #589355 reported by Josh Brown
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Code Monkey
Fix Released
Medium
Unassigned

Bug Description

When the earthwallpaper.sh_new script is running and the computer is shut down, the script does not revert to the original wallpaper as expected.

Ubuntu Forums post here: http://ubuntuforums.org/showthread.php?t=1529636

Bug #589900 is dependent upon the solution of this bug.

Related branches

Josh Brown (joshbrown)
Changed in codemonkey:
importance: Undecided → Low
Revision history for this message
Tom Swartz (tom-swartz07) wrote :

I was inspecting this earlier today-
there are a few ways we could go with this:

*what if we inserted the whole program into a loop, so that if the loop is interrupted,it just throws an error, rather than deleting it

*we could also try making a backup image, as in a copy of the current that will only be replaced AFTER the new one has been updated. I think this is also in the original..

either way, I'll see if I could run some trials with possible solutions

Revision history for this message
Josh Brown (joshbrown) wrote :

Tom, enclosing the program in a loop doesn't sound like a very good solution. I've done some research and it seems that Ubuntu sends SIGTERM to all programs before shutting down. Since the script should trap SIGTERM and clean up before exiting, I don't know what's going wrong.

I'm not sure what you mean about the backup image - the original image is restored fine when I kill the program with SIGINT [ Ctrl + C ].

Changed in codemonkey:
status: New → Confirmed
Revision history for this message
Tom Swartz (tom-swartz07) wrote :

Ive been looking at this code.
I think this might be a simple fix, actually.

The downloaded image is stored to a temp file. When the system shuts down, it clears all of these files.
It basically just comes down to the fact that the better part of the images are stored in temp

I dont know what you would like to do about it, but my suggestion is this:

* If we specify a physical location for the image where it can be stored, perhaps in the directory that it is run (appended with a dot title so it is hidden) the images could be stored and overwritten. This would also allow the user to manually add the image to the background selections (granted they find the .filename file)

Revision history for this message
Josh Brown (joshbrown) wrote :

The sunmap is useless without the script running - if the script ends, the sunmap shouldn't still be set as the wallpaper. Anyway, having the script output a file wastes the users time both setting the background, and unsetting it afterwards.

Changed in codemonkey:
assignee: nobody → Code Monkey Developers (codemonkeydevs)
importance: Low → Medium
description: updated
Josh Brown (joshbrown)
description: updated
Revision history for this message
Josh Brown (joshbrown) wrote :

Assignee is normally set to a single person so that people don't clobber themselves solving the same bug, it's usually only set to a team if it's a collaborative effort that will require lots of people writing code.

Changed in codemonkey:
assignee: Code Monkey Developers (codemonkeydevs) → nobody
Josh Brown (joshbrown)
description: updated
Josh Brown (joshbrown)
description: updated
Revision history for this message
Josh Brown (joshbrown) wrote :

Looks like this is a problem with the program failing to catch SIGTERM, now the problem is identified it should be easy to fix.

summary: - earthwallpaper.sh_new does not revert to original background if computer
- is shut down while script is running
+ SIGTERM does not work on earthwallpaper.sh_new
Josh Brown (joshbrown)
Changed in codemonkey:
status: Confirmed → Fix Committed
Revision history for this message
Tom Swartz (tom-swartz07) wrote :

Are you sure that interfacing with SIGTERM is a solid idea?

It seems kind of like using a sledgehammer to hang a picture frame, to me.

What if we read the user's original background image setting through gconf, save it as a variable and then invoke it back when the script exits?

Revision history for this message
Josh Brown (joshbrown) wrote :

On Wed, 2010-07-14 at 00:30 +0000, Tom Swartz wrote:
> What if we read the user's original background image setting through
> gconf, save it as a variable and then invoke it back when the script
> exits?

Tom, that's exactly what the script does. I'm using trap to catch
SIGTERM and run the above mentioned code before exiting, quite a common
scripting technique: http://www.google.com/search?q=shell+trap+sigterm

Revision history for this message
Josh Brown (joshbrown) wrote :
Changed in codemonkey:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.