2017-04-19 21:41 GMT+02:00 Alistair Grant <akgrant0...@gmail.com>:

> Hi All,
>
> While recently running the test suite I've been getting failures in
> FileLocatorTest>>testMoveTo if the working directory when the test
> is run is on a different unix file system to the user's home directory.
>
> The failing primitive is 'primitiveFileRename' in module 'FilePlugin',
> which calls rename(), which is presumably part of libc - I didn't chase
> it back through the C code.
>
> libc rename() requires the source and destination filenames to be on the
> same file system.
>
> This has been discussed multiple times before:
>
> https://pharo.fogbugz.com/f/cases/13957/Add-exception-for-
> cross-volume-folder-renames
> https://pharo.fogbugz.com/f/cases/12992/Cannot-move-files-
> to-another-volume-partition-under-linux
> https://pharo.fogbugz.com/f/cases/12965/Cannot-moveTo-FileLocator
>
> Issue 12965 is even supposed to include a fix, although when I searched
> through the slice I couldn't find anything that actually looked like a
> fix.
>
> As Nicolai suggested in 12965, the obvious solution is to implement move
> as copy+delete.  It looks like there isn't an easy way to check whether
> the two files are on the same unix file system, so presumably it would
> be implemented as try to rename, and if that fails, try to copy and
> delete.
>

What? Google this: man stat
The first field of stat structure is a device ID, so deciding if two files
are on same file system or not is doable by checking this field for the
source file and destination file (if it exists) or directory - modulo the
fact that you'd have to care of symbolic links with lstat.



>
> Is there a reason not to propose this as a patch?
>
> Thanks,
> Alistair
>
>

Reply via email to