Replacing files with 'gio copy' fails in softlinks to GVFS mounts
DESCRIPTION
When you try to replace a file in a link to a GVFS share with gio copy, it fails with an error. Expected behavior would be, that the file is being replaced like it does when using plain cp command.
As an result gio copy seems to leaves some artifacts in the file system, so even after deleting this file, normal cp operation does not work anymore.
REPRODUCTION
- mount an SMB network share with
gio mount smb://servername/sharename/
- edit the VARS in the following script to match your environment, and run it
#!/bin/bash
#set -o xtrace
FILE="1" # needs to be changed on each run to see it first working, then failing
LINK="testlink"
USER="1001" # see /run/user/
SERVER="servername"
SHARE="sharename"
[ ! -d "$LINK" ] && ln -s /run/user/$USER/gvfs/smb-share:server=$SERVER,share=$SHARE/ $LINK
touch $FILE
cp $FILE $LINK
echo "overwriting, deleting, and re-copy works just fine:"
cp $FILE $LINK
rm $LINK/$FILE
cp $FILE $LINK
echo "no errors"
echo
echo "instead of 'cp' we now replace the file with 'gio copy', which fails:"
gio copy $FILE $LINK
echo
echo "and from now on, also normal cp doesn't works anymore, even if the file is deleted before:"
rm $LINK/$FILE
cp $FILE $LINK
ENVIRONMENT
I am on Ubuntu 20.04 LTS latest. The Fuse-mount points to an SMB share (in my case from a Synology NAS). This bug exists for a few months now - before it was fine.
Thanks a lot for looking into the issue! BTW, I am not sure whether this is a bug in gvfs or glib for example.
Edited by ToS0