[Sugar-devel] Read-only access to thumb drive forbidden by Rainbow?

Jim Simmons nicestep at gmail.com
Sun Aug 30 14:32:40 EDT 2009


Tomeu,

It turned out that fixing the problem with .olpc.store was pretty
simple and I now have an Activity that is functional.  The next
problem is, it works differently in .82 and .84.  In .82 every file on
the thumb drive and SD card is treated as a Journal entry and listed
out by the datastore API.  In .84 these files are not listed, so I
have to use os.walk() to get them.  Unfortunately doing this means
duplicate entries when the app is running in .82.  So it would be
useful if I could tell when my os.walk() routine is needed and ONLY
run that code when it is needed.  I'd prefer to do something like try
to do something that the datastore API only allows in .84 and later
and catch an exception, which I then use to determine whether to run
the code or not.  Failing that, if I could detect the version of Sugar
and base my code on that that would be OK.  I'm looking for something
robust and future-proof.

Any ideas?  Thanks again,

James Simmons


On Sun, Aug 30, 2009 at 9:40 AM, Jim Simmons<nicestep at gmail.com> wrote:
> Tomeu,
>
> Your suggestion was right on the money.  When I run a simple program
> from Terminal that prints out the files it finds it goes through my SD
> card (also mounted on /media) and seems to stall in the depths of the
> .olpc_store directory.  What I think I need to do is write my own
> walk-like function that ignores hidden directories.  I really should
> have thought of your suggestion myself but everything ran so well on
> my test boxes that I jumped to the conclusion that something on the XO
> was the problem.
>
> Thanks again,
>
> James Simmons
>
>
> On Sun, Aug 30, 2009 at 3:31 AM, Tomeu Vizoso<tomeu at sugarlabs.org> wrote:
>> On Sun, Aug 30, 2009 at 01:50, Jim Simmons<nicestep at gmail.com> wrote:
>>> Walter,
>>>
>>> I tried deleting /etc/olpc-security but that had no effect,  Even
>>> rebooting after deleting olpc-security had no effect.  I managed to
>>> copy the log messages from my previous efforts to the clipboard and
>>> save them to a thumb drive:
>>>
>>> reserved credentials (10002, 10005)
>>>
>>> adding group: /usr/sbin/groupadd -o -g 10005 10005
>>>
>>> groupadd: group 10005 exists
>>>
>>> adding user: /usr/sbin/useradd -m -u 10002 -g 10005 -c
>>> org.laptop.ViewSlidesActivity.10002 -d
>>> /home/olpc/isolation/1/uid_to_home_dir/10002 10002
>>>
>>> Creating mailbox file: File exists
>>>
>>> dropping privilege to (10002, 10005)
>>>
>>> chdir to /home/olpc/Activities/ViewSlides.activity
>>>
>>> umask(0)
>>>
>>> about to execve
>>>
>>> argv: dbus.Array([dbus.UTF8String('sugar-activity'),
>>> dbus.UTF8String('viewslides.ViewSlidesActivity'),
>>> dbus.UTF8String('-b'),
>>> dbus.UTF8String('org.laptop.ViewSlidesActivity'),
>>> dbus.UTF8String('-a'),
>>> dbus.UTF8String('9469a4295fc4c2a1c5bc89a049bc8046978bcd4d')],
>>> signature=dbus.Signature('s'))
>>>
>>> env: dbus.Dictionary({dbus.UTF8String('LOGNAME'):
>>> dbus.UTF8String('olpc'), 'USER': '10002', dbus.UTF8String('HOME'):
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002',
>>> dbus.UTF8String('PATH'):
>>> dbus.UTF8String('/home/olpc/Activities/ViewSlides.activity/bin:/usr/bin:/bin'),
>>> dbus.UTF8String('DISPLAY'): dbus.UTF8String(':0'),
>>> dbus.UTF8String('LANG'): dbus.UTF8String('en_US.UTF-8'),
>>> dbus.UTF8String('SHELL'): dbus.UTF8String('/bin/bash'),
>>> dbus.UTF8String('TZ'): dbus.UTF8String('UTC'),
>>> dbus.UTF8String('XDG_SESSION_COOKIE'):
>>> dbus.UTF8String('953edcc5e38ef3d4eb1c4ec349fc8998-1251513204.25857-1875509082'),
>>> dbus.UTF8String('SESSION_MANAGER'):
>>> dbus.UTF8String('local/unix:@/tmp/.ICE-unix/1312,unix/unix:/tmp/.ICE-unix/1312'),
>>> dbus.UTF8String('SHLVL'): dbus.UTF8String('1'),
>>> dbus.UTF8String('ICEAUTHORITY'):
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002/.ICEauthority',
>>> dbus.UTF8String('WINDOWPATH'): dbus.UTF8String('3'),
>>> dbus.UTF8String('SUGAR_BUNDLE_PATH'):
>>> dbus.UTF8String('/home/olpc/Activities/ViewSlides.activity'),
>>> dbus.UTF8String('SUGAR_LOCALEDIR'):
>>> dbus.UTF8String('/home/olpc/Activities/ViewSlides.activity/locale'),
>>> dbus.UTF8String('SUGAR_THEME'): dbus.UTF8String('sugar-xo'),
>>> dbus.UTF8String('SUGAR_ACTIVITY_ROOT'):
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002',
>>> dbus.UTF8String('GTK2_RC_FILES'):
>>> dbus.UTF8String('/usr/share/sugar/data/sugar-xo.gtkrc'),
>>> dbus.UTF8String('SUGAR_BUNDLE_ID'):
>>> dbus.UTF8String('org.laptop.ViewSlidesActivity'),
>>> dbus.UTF8String('DBUS_SESSION_BUS_ADDRESS'):
>>> dbus.UTF8String('unix:path=/tmp/olpc-session-bus,guid=858a48de7c5f74d530c5570c4a989374'),
>>> 'TMPDIR': '/home/olpc/isolation/1/uid_to_home_dir/10002/tmp',
>>> dbus.UTF8String('XAUTHORITY'):
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002/.Xauthority',
>>> dbus.UTF8String('GTK_IM_MODULE'):
>>> dbus.UTF8String('gtk-im-context-simple'),
>>> dbus.UTF8String('XSERVERAUTH'):
>>> dbus.UTF8String('/var/tmp/olpc-auth/.Xserverauth'),
>>> dbus.UTF8String('PWD'): dbus.UTF8String('/home/olpc')},
>>> signature=dbus.Signature('ss'))
>>>
>>> closing all fds but (1, 2)
>>>
>>> {dbus.UTF8String('LOGNAME'): dbus.UTF8String('olpc'), 'USER': '10002',
>>> 'PATH': dbus.UTF8String('/home/olpc/Activities/ViewSlides.activity/bin:/usr/bin:/bin'),
>>> dbus.UTF8String('HOME'):
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002', 'DISPLAY':
>>> dbus.UTF8String(':0'), 'LANG': dbus.UTF8String('en_US.UTF-8'), 'TERM':
>>> 'linux', dbus.UTF8String('SHELL'): dbus.UTF8String('/bin/bash'),
>>> dbus.UTF8String('TZ'): dbus.UTF8String('UTC'), 'XAUTHORITY':
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002/.Xauthority',
>>> dbus.UTF8String('SESSION_MANAGER'):
>>> dbus.UTF8String('local/unix:@/tmp/.ICE-unix/1312,unix/unix:/tmp/.ICE-unix/1312'),
>>> dbus.UTF8String('SHLVL'): dbus.UTF8String('1'), 'ICEAUTHORITY':
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002/.ICEauthority',
>>> dbus.UTF8String('WINDOWPATH'): dbus.UTF8String('3'),
>>> dbus.UTF8String('SUGAR_BUNDLE_PATH'):
>>> dbus.UTF8String('/home/olpc/Activities/ViewSlides.activity'),
>>> dbus.UTF8String('SUGAR_LOCALEDIR'):
>>> dbus.UTF8String('/home/olpc/Activities/ViewSlides.activity/locale'),
>>> dbus.UTF8String('SUGAR_THEME'): dbus.UTF8String('sugar-xo'),
>>> 'UPSTART_JOB': 'rainbow', 'UPSTART_JOB_ID': '3',
>>> dbus.UTF8String('SUGAR_BUNDLE_ID'):
>>> dbus.UTF8String('org.laptop.ViewSlidesActivity'),
>>> 'DBUS_SESSION_BUS_ADDRESS':
>>> dbus.UTF8String('unix:path=/tmp/olpc-session-bus,guid=858a48de7c5f74d530c5570c4a989374'),
>>> 'TMPDIR': '/home/olpc/isolation/1/uid_to_home_dir/10002/tmp',
>>> dbus.UTF8String('XDG_SESSION_COOKIE'):
>>> dbus.UTF8String('953edcc5e38ef3d4eb1c4ec349fc8998-1251513204.25857-1875509082'),
>>> dbus.UTF8String('GTK_IM_MODULE'):
>>> dbus.UTF8String('gtk-im-context-simple'),
>>> dbus.UTF8String('XSERVERAUTH'):
>>> dbus.UTF8String('/var/tmp/olpc-auth/.Xserverauth'),
>>> dbus.UTF8String('SUGAR_ACTIVITY_ROOT'):
>>> '/home/olpc/isolation/1/uid_to_home_dir/10002',
>>> dbus.UTF8String('PWD'): dbus.UTF8String('/home/olpc'),
>>> 'UPSTART_EVENT': 'started', 'GTK2_RC_FILES':
>>> dbus.UTF8String('/usr/share/sugar/data/sugar-xo.gtkrc')}
>>>
>>> /usr/lib/python2.5/site-packages/sugar/graphics/combobox.py:93:
>>> PangoWarning: error opening config file '/root/.pangorc': Permission
>>> denied
>>>
>>>
>>>
>>>  self._model.append([action_id, text, pixbuf, False])
>>>
>>> 1251513267.164775 WARNING root: No gtk.AccelGroup in the top level window.
>>>
>>> 1251513267.186601 WARNING root: No gtk.AccelGroup in the top level window.
>>>
>>>
>>> With /etc/olpc-security removed I only get the last two messages,
>>> which we seem to get for ALL Activities.
>>>
>>> When I comment out the lines in question the Activity works again.
>>> Since the only line I'm commenting out is the os.walk() I have to
>>> assume that that's the one it doesn't like, since the other lines are
>>> practically identical to the ones I'm using to load the Journal
>>> entries in the table with.  I just wish I got some kind of message.
>>>
>>> When I do a ps ax I see that the View Slides activity is shown to be
>>> running after the startup icon stops.  I tried killing it, which
>>> worked, but it didn't give me any messages in the Log activity.
>>>
>>> The one other thing I can think of which is different in the XO than
>>> in my development environments is that the XO has an SD card also
>>> mounted at /media.  No image files on it.
>>>
>>> Hope somebody can suggest something.  Thanks,
>>
>> If the activity process is running but the activity window doesn't
>> appear, perhaps the activity is in an infinite loop or just that
>> walking across the whole disk is taking much more time than expected?
>> Printing something in the loop might tell us if that's the case.
>>
>> HTH,
>>
>> Tomeu
>>
>>> James Simmons
>>>
>>> On Fri, Aug 28, 2009 at 9:25 PM, Walter Bender<walter.bender at gmail.com> wrote:
>>>> You can isolate Rainbow by disabling it and seeing if the problem goes away.
>>>>
>>>> sudo rm /etc/olpc-security
>>>>
>>>> will disable Rainbow
>>>>
>>>> sudo touch /etc/olpc-security
>>>>
>>>> will reenable it.
>>>>
>>>> -walter
>>>>
>>>> On Fri, Aug 28, 2009 at 10:19 PM, Jim Simmons<nicestep at gmail.com> wrote:
>>>>> As I have mentioned in this list before, I am trying to make View
>>>>> Slides able to get pictures that may or may not be in the Journal and
>>>>> add them to a slide presentation.  Under .82 objects in thumb drives
>>>>> can be listed using the Data Store API, which was fine.  In .84 you
>>>>> cannot do that any more, but I was led to believe that if I just
>>>>> wanted to READ these files that Python IO would work.  So I use this
>>>>> code:
>>>>>
>>>>>        valid_endings = ('.jpg',  '.jpeg', '.JPEG',  '.JPG', '.gif',
>>>>> '.GIF', '.tiff', '.TIFF', '.png', '.PNG')
>>>>>        for dirname,  dirnames,  filenames in os.walk('/media'):
>>>>>            for filename in filenames:
>>>>>                if filename.endswith(valid_endings):
>>>>>                    iter = self.ls_right.append()
>>>>>                    jobject_wrapper = JobjectWrapper()
>>>>>
>>>>> jobject_wrapper.set_file_path(os.path.join(dirname,  filename))
>>>>>                    self.ls_right.set(iter,  COLUMN_IMAGE,  filename)
>>>>>                    self.ls_right.set(iter,  COLUMN_PATH,  jobject_wrapper)
>>>>>
>>>>> Now this code runs just fine on the Sugar test environment of Fedora
>>>>> 11 (.84) and Fedora 10 (.82).  However, if I try running the same code
>>>>> on my XO, currently running .82, the Activity does not even finish
>>>>> coming up.  Using the Log Activity does not give me any useful
>>>>> messages.  I can only suspect that Rainbow is the culprit here,
>>>>> although I'm not getting any actual messages that say that.  It's just
>>>>> a guess on my part.
>>>>>
>>>>> In the code above the jobject_wrapper is a class I created so that my
>>>>> table column could hold an object that would return a file path,
>>>>> either by getting it from a wrapped journal object or from a path
>>>>> supplied by the code above.  Works fine in my test environment, but
>>>>> bails out on my XO.
>>>>>
>>>>> Does anyone have any ideas?  Thanks,
>>>>>
>>>>> James Simmons
>>>>> _______________________________________________
>>>>> Sugar-devel mailing list
>>>>> Sugar-devel at lists.sugarlabs.org
>>>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>
>>
>>
>> --
>> «Sugar Labs is anyone who participates in improving and using Sugar.
>> What Sugar Labs does is determined by the participants.» - David
>> Farning
>>
>


More information about the Sugar-devel mailing list