[Sugar-devel] [sugar-toolkit-gtk3 PATCH] sl#4276: Writing the icon-files for ".xo" files on a permanent mount-point, and not /tmp. mount-point.

Gonzalo Odiard gonzalo at laptop.org
Tue Dec 11 06:26:46 EST 2012


> The difference is, there are a time race between icon reading,

> > and displaying, at times, as the file is a tempfile,
> > at the moment of display was already deleted.
>
> Is the code deleting the file?  Otherwise who deletes it?
>
> In /etc/fstab I see the line:
>
> /tmp    /tmp    tmpfs    rw,size=50m    0    0
>
> So unless /tmp is filled by 50 megas of files or the XO is rebooted,
> the icon should stay there, no?
>

It's a tempfile [1] then python delete it magically after closed.
See ActivityBundle.get_icon()
In fact the code have a comment:
        # FIXME: this should return the icon data, not a filename, so that
        # we don't need to create a temp file in the zip case
And we are returning util.TempFilePath, where there are code to delete
pending files if needed.

I think in this case, the proper solution is get the icon data
(adding a method get_icon_data) and put it in the listmodel.
(Only for the .xo cases)

In the meantime, have the icons cached in a directory is no so bad.
Maybe we can do it in /tmp/ to get it deleted at startup
without need more

[1] http://docs.python.org/2/library/tempfile.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20121211/37583d67/attachment.html>


More information about the Sugar-devel mailing list