[Sugar-devel] [PATCH] Fix for file list sorting for FAT32 formatted flash drives in Journal.

Kenny Meyer knny.myer at gmail.com
Thu May 13 01:16:14 EDT 2010


James Cameron (quozl at laptop.org) wrote:
> On Thu, May 13, 2010 at 12:21:11AM -0400, Kenny Meyer wrote:
> > Bernie, and I have had a special situation where a flash drive, which
> > has been formatted on Windows with (apparently) a FAT32 file-system.
> > Some of the files on the flash drive had a negative `changetime`,
> > which resulted in automatically making the `changetime` of type long,
> > whereas the sort() function expected an integer.
> 
> Fascinating.  Have you a way to change the changetime from Linux to
> achieve the same result?  I'd like to test.
> 
Hmm, I haven't found any method to manually manipulate the `ctime` of a file on
Linux systems. Sorry.

Actually, you could temporarily create a list of "fake files" for
`self._file_list` and change the second element (counting from 0) to something
negative, like -182353944234916. I haven't tried this, but it should work IMHO.

You could easily generate elements, by doing something like this:

    def setup_ready(self):
		for i in self._file_list:
			logging.debug(i)
		self._file_list.sort(lambda a, b: cmp(b[2], a[2]))
		self.ready.send(self)

Check `~/.sugar/log/shell.log`.

> > This behaviour was reproduced on sugar-0.84.16. Should be backported
> > to older versions. [?]
> 
> What is the effect of the bug on 0.82?  (Maybe it explains a
> long-standing problem we have).
> 
So when this special case occurs Python raises a TypeError, which doesn't get
catched, because of the number is of type long and not int.

This is what the user must do to reproduce the error:

1) Stick in the flash drive.
2) Access the flash drive with the Journal.

In the specific moment where Python reads the stats of a file on the flash drive
with the negative `ctime` the progress bar freezes and stays there.

I couldn't try this on 0.82 .

-- 
  Regards,
  Kenny Meyer | http://kenny.alwaysdata.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100513/4e34cfec/attachment.pgp 


More information about the Sugar-devel mailing list