[Gambas-user] Issue 200 in gambas: [gb.dbus] A bug in the handling of errors when calling the dbus

gambas at ...2524... gambas at ...2524...
Fri Jan 20 21:43:25 CET 2012


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 200 by svit... at ...626...: [gb.dbus] A bug in the handling of  
errors when calling the dbus
http://code.google.com/p/gambas/issues/detail?id=200

1) Describe the problem.
When call has no return value, no error is raised. Even if the call was  
wrong.
When calling a function, there is no detailed error message. There is  
only  "Unable to call method".
2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: 3.0.0
Revision: none
Operating system: Linux
Distribution: other
Architecture: x86
GUI component: none
Desktop used: none

3) Provide a little project that reproduces the bug or the crash.
attached project and patch

CODE:
Public Sub Main()

   Dim o As Object

   Print "BUG 1"
   Print "Try  
DBus[\"system://org.freedesktop.UDisks\"][\"/org/freedesktop/UDisks\"].Uninhibit(\"fake_cookie\")"
   Try  
DBus["system://org.freedesktop.UDisks"]["/org/freedesktop/UDisks"].Uninhibit("fake_cookie")
   If Error Then
     Print "NO BUG. Error message:";; Error.Text
   Else
     Print "BUG! No error message"
   End If

   Print "BUG 2"
   Print "Try  
DBus[\"system://org.freedesktop.UDisks\"][\"/org/freedesktop/UDisks\"].FindDeviceByDeviceFile(\"/fake_device\")"
   Try o =  
DBus["system://org.freedesktop.UDisks"]["/org/freedesktop/UDisks"].FindDeviceByDeviceFile("/fake_device")
   If Error Then
     If Error.Text = "Unable to call method" Then
       Print "BUG! No detailed error message: ";; Error.Text
     Else
       Print "NO BUG. Error message is detailed:";; Error.Text
     End If
   Else
     Print "No error. Strange"
   End If

End


Output:
BUG 1
Try  
DBus["system://org.freedesktop.UDisks"]["/org/freedesktop/UDisks"].Uninhibit("fake_cookie")
BUG! No error message
BUG 2
Try  
DBus["system://org.freedesktop.UDisks"]["/org/freedesktop/UDisks"].FindDeviceByDeviceFile("/fake_device")
BUG! No detailed error message:  Unable to call method
gbx3: warning: 6 allocation(s) non freed.


After patch:
BUG 1
Try  
DBus["system://org.freedesktop.UDisks"]["/org/freedesktop/UDisks"].Uninhibit("fake_cookie")
NO BUG. Error message: org.freedesktop.UDisks.Error.Failed: No such  
inhibitor
BUG 2
Try  
DBus["system://org.freedesktop.UDisks"]["/org/freedesktop/UDisks"].FindDeviceByDeviceFile("/fake_device")
NO BUG. Error message is detailed: org.freedesktop.UDisks.Error.Failed: No  
such device
gbx3: warning: 4 allocation(s) non freed.


Allocation warning is probably another bug.



Attachments:
	bug-gb.dbus-error-handle-0.0.1.tar.gz  4.7 KB
	gb-dbus-handle-error-bug.patch  1.3 KB





More information about the User mailing list