Comment 2 for bug 804548

Andreas Hasenack (ahasenack) wrote :

As a side note, os.rename() doesn't work accross devices, so if /tmp happens to be on a different partition, something common in certain server installations, the operation would fail.

    def _handle_sources(self, ignored, sources):
        """Handle sources repositories."""
        fd, path = tempfile.mkstemp()
        os.rename(path, self.SOURCES_LIST)

>>> import os,tempfile
>>> fd,path = tempfile.mkstemp()
>>> os.close(fd)
>>> path
>>> os.rename(path,"/home/andreas/foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 18] Invalid cross-device link

From the docs at
"The operation may fail on some Unix flavors if src and dst are on different filesystems"