SideCandy Ram/Swap crashes, when user has no swap at all

Bug #186351 reported by DrMetzger
2
Affects Status Importance Assigned to Milestone
gDesklets
Invalid
Low
MarioGonzalez

Bug Description

Hi.
I am using ubuntu and I do not have a swap partition at all. When I launch the SideCandy RAM/Swap gdesklet, it crashes with this error:
float division
/usr/share/gdesklets/Displays/sidecandy-ram/SideCandyRAM.display
   24
   25 def get_mem():
   26 Dsp.swap_used.value = "%s / %s"
%(mem_format(sys.swap.used),mem_format(sys.swap.total))
   27 Dsp.memory_used.value = "%s / %s / %s" %(mem_format(sys.memory.used-
sys.memory.cached-
sys.memory.buffer),mem_format(sys.memory.used),mem_format(sys.memory.total))
   28 Dsp.gauge_mem.fill = int((sys.memory.used/float(sys.memory.total))*100)
> 29 Dsp.gauge_swap.fill = int((sys.swap.used/float(sys.swap.total))*100)
   30 Dsp.gauge_mem_true.fill = int(((sys.memory.used-sys.memory.cached-
sys.memory.buffer)/float(sys.memory.total))*100)
   31 Dsp.show_ram.value = mem_load(var_a,var_b)
   32 add_timer(refresh, get_mem)
   33
   34 add_timer(0, get_mem)
   35

It would be cool, if I can use the gdesklet only for my ram.

Revision history for this message
Christian Meyer (chrisime) wrote : Re: [Bug 186351] [NEW] SideCandy Ram/Swap crashes, when user has no swap at all

could you please try a recent version from bzr? many bugs have been fixed so
far.

Revision history for this message
Bjoern Koch (h.humpel) wrote :

The problem is that sys.swap looks like this if you have no swap or turned swap off:

Struct { .free = 0, .pagein = 0, .pageout = 0, .total = 0, .used = 0 }

So, sys.swap.total equals 0 (zero) and this raises the float division error.

A fast fix (for you) would be to simply comment out or delete the line, or simply set the value to flat 0 (zero) like:

Dsp.gauge_swap.fill = 0

A "real fix" would first check the value in sys.swap.total...

Changed in gdesklets:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
MarioGonzalez (gonzalemario) wrote :

Currently the gdesklets.de site is offline so I don't know if this desklet is official or not but I think I have found a fix and I wrote a patch.

What do you think?

Changed in gdesklets:
assignee: nobody → gonzalemario
importance: Medium → Low
status: Confirmed → In Progress
Revision history for this message
Bjoern Koch (h.humpel) wrote :

Looks good to me (although I haven't tested it yet).
SideCandy-RAM is not an "official" desklet nor is it part of the SideCandy archive itself. It can be found on the archive website.
I am just trying to find and contact the author of this desklet but as there is no contact information in the desklet's archive this is going to be a shot in the dark.

Revision history for this message
MarioGonzalez (gonzalemario) wrote : Re: [Bug 186351] Re: SideCandy Ram/Swap crashes, when user has no swap at all

El vie, 14-03-2008 a las 18:15 +0000, Bjoern Koch escribió:
> Looks good to me (although I haven't tested it yet).

 I tested it and works for me.

> SideCandy-RAM is not an "official" desklet nor is it part of the SideCandy archive itself. It can be found on the archive website.
> I am just trying to find and contact the author of this desklet but as there is no contact information in the desklet's archive this is going to be a shot in the dark.
>

 Why should not we include this desklet into the officials ones? It
looks useful and pretty :)

--
www.mgonzalez.cl

Revision history for this message
Bjoern Koch (h.humpel) wrote :

> Why should not we include this desklet into the officials ones? It looks useful and pretty :)

Well, basically because we don't know for sure the license it has been released under. So we would have to contact the author for this information anyway ;).
Furthermore it would make more sense to include it into the upcoming/planned SideCandy-0.20 release.

Revision history for this message
MarioGonzalez (gonzalemario) wrote : Re: [Bug 186351] Re: SideCandy Ram/Swap crashes, when user has no swap at all

Bjoern Koch wrote:
> Well, basically because we don't know for sure the license it has been
> released under. So we would have to contact the author for this
> information anyway ;).
> Furthermore it would make more sense to include it into the
> upcoming/planned SideCandy-0.20 release.
>

  Well, that's fine :-)

>

Revision history for this message
MarioGonzalez (gonzalemario) wrote :

Invalid, this desklet is not an official one... so far.

Bjoern Koch, did you contact with the Author? I think my patch was not applied?

Changed in gdesklets:
status: In Progress → Invalid
Revision history for this message
Bjoern Koch (h.humpel) wrote :

Well, I sent out a few emails but never got any answer. No luck yet.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Bug attachments

Remote bug watches

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