New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #21
Fixes #21
Conversation
dbus.Int32 takes <class int> while initialization
'preview' is of type int
'timestamp' and 'creation_time' is of type dbus.Int32
Fixes error:
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.ValueError: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/dbus/service.py" line 711, in _message_cb
retval = candidate_method(self, *args, **keywords)
File "/usr/lib/python3/dist-packages/carquinyol/datastore.py", line 409, in find
metadata = self._metadata_store.retrieve(uid,properties)
File "/usr/lib/python3/dist-packages/carquinyol/metadatastore.py", line 84, in retrieve
metadata[key] = dbus.Int32(value)
ValueError: invalid literal for int() with base 10: b''
Regression introduced in sugarlabs@80fa75f
|
Wow! I am interested to know how you found the error. It looks interesting. I will test it on a clean build; How can I reproduce the error on master? Thanks |
Thanks @srevinsaju , I got this error while testing find-words-activity on a VM with Ubuntu 20.04, I am using packaged sugar i.e. sucrose. I installed find-words-activity via terminal activity using |
|
This is wrong in a few ways;
Please instead fix the caller so that a quoted bytes of |
This is probably a typing mistake I have done.
The overall analysis of source code says
The above method clearly specifies that filesize is of type int. And timestamp and creation_time take values of dbus.Int32.
According to comment here |
|
@Saumya-Mishra9129 said
Yes the comment says that and the current code works for every int value as Make sure the caller of |
The comment is probably correct, but it isn't to be taken as a definition of an API. Your traceback shows the Put it another way; why didn't you fix this in the activity or sugar-activity-web to make sure the value sent is an integer? Perhaps it is another one of those regressions we saw in sugar-activity-web with the port to later WebKit. Or perhaps you have corrupt data in your datastore. Check it out. Someone privately (don't know why privately) asked me why two of the keys are 32-bit integers instead of unspecified integer bit width. Answer is that both numbers are 32-bit on the Linux operating system at the time the datastore was written. They come from the |
I agree with you now. Perhaps data is corrupted as I am not getting this error while testing with any other activity. More testing required instead of jumping to conclusion.
Interesting and new info for me :) |
No. The additional complexity is unwarranted. Sending wrong data type will yield unpredictable outcome. It is responsibility of RPC caller to send the right data type. Concentrate on how it is that the value became a quoted bytes. |
|
I tried to look at workflow , we are calling retrieve method of metadatareader.c in order to obtain metadata.
What this call does is that it goes to that method in file, where it reads all the properties list and makes a dictionary. To read properties list it goes to read_from_properties_list function and we are calling add_property method also there, which contains code to convert filesize to dbus.ByteArray. |
|
Looking at the traceback in commit message for 968d87f, which is the only report of the problem I'm aware of, an RPC client has made a find method call, and in retrieving the metadata from the data file the Datastore has found that a value that should have been in integer form was actually found to be in quoted bytes form. Unfortunately, from the traceback we don't know anything else about the object in the datastore. The ambiguities of the situation are;
If you still have the datastore and can still reproduce the traceback, you can use filesystem tools to iterate through the datastore data and metadata to learn more about the object. |
@chimosky @quozl @srevinsaju Please Review. I reproduced it with find-words-activity.