GNOME Bugzilla – Bug 144887
unable to copy file to msdos/FAT fs
Last modified: 2005-02-02 17:58:19 UTC
strace gnomevfs-copy /home/sb/Desktop/photo/pict0803.jpg /media/camera/dcim/101image/pict0803.jpg ... open("/media/camera/dcim/101image/.vfs-write.tmp", O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_LARGEFILE, 0600) = -1 EINVAL (Invalid argument) Solution: Use better file name, at least on 8+3 filesystems.
I can confirm this e.g. dd if=/dev/zero of=/tmp/fat bs=1M count=10 mkdosfs -A /tmp/fat mount -o loop /tmp/fat /mnt/fat strace gnomevfs-copy /tmp/file /mnt/fat/file ... open("/mnt/fat/.vfs-write.tmp", O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_LARGEFILE, 0600) = -1 EINVAL (Invalid argument) I traced this back to gnome-vfs-xfer.c line 2030 - 2047 at least with my example the problem seems to be with using a dot file and not the file length i.e. changing to 'vfs-write.tmp' works, the filename is just truncated to 8+3. I tested with gnome-vfs-2.6.1.1
Right after the creation of this file there is the special case: /* some methods only allow certain filenames (e.g. .desktop files) */ if (result == GNOME_VFS_ERROR_INVALID_URI) { result = GNOME_VFS_OK; } EINVAL is not a documented return for open, so one can only hope that it's only ever returned in this specific situation. It maps through gnome_vfs_result_from_errno() to GNOME_VFS_ERROR_BAD_PARAMETERS. If we add GNOME_VFS_ERROR_BAD_PARAMETERS to the above if() the problem should go away. Alternatively (probably cleaner) we could add a special case (maybe #ifdef __linux__) in the do_create function of the file:// method that in the event of EINVAL, it returns GNOME_VFS_ERROR_INVALID_URI instead of calling gnome_vfs_result_from_errno();
*** This bug has been marked as a duplicate of 78486 ***