Cannot move shared folder on external storage

Hi,

recently I discovered a problem with moving shared files and folders on external storage mounts.

The usual workflow is as follows:

  • There are two users: Admin and Bob
  • Admin shares a folder with Bob
  • For Bob, the shared folder is shown in the file dir root
  • Now Bob can move the shared folder to another folder (in this example /Documents).

When the data directory is the standard Nextcloud data directory, everything works as expected, the shared folder can be moved.

Nextcloud version: 14.0.1
Operating system and version: Ubuntu 18.04
Apache or nginx version: nginx 1.15.3
PHP version: 7.2

The issue you are facing:
When using external (SMB) storage, the shared folder cannot be moved with the workflow above.

Is this the first time you’ve seen this error? No

Steps to replicate it:

  1. Create an external storage for users Admin and Bob. These are shared folder from a Windows machine (SMB).
  2. As user Admin, create a folder (“For Bob”) in the external storage (so ExtAdmin/For Bob)
  3. Share this folder (“For Bob”) with user Bob.
  4. Log in with user Bob.
  5. Create a folder called “Documents” in Bob’s external Storage (so ExtBob/Documents)
  6. Try to move the shared folder (“For Bob”) to ExtBob/Documents.
  7. An error is shown that the folder cannot be moved.

The output of your Nextcloud log in Admin > Logging:
Log entries are only produced when the log level is set to a value < 2, here is the dedug output:

{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"PHP","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"Couldn't stat smb:\/\/192.168.178.100\/Test\/Bob\/Documents\/For%20Bob: Does not exist at \/var\/www\/nextcloudbeta\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Native\/NativeState.php#179","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"no app in context","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"No cache entry found for \/Bob\/files\/ExtBob\/Documents\/For Bob (storage: smb::SMB-User@192.168.178.100\/\/Test\/\/Bob\/, internalPath: Documents\/For Bob)","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"PHP","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"Couldn't stat smb:\/\/192.168.178.100\/Test\/Bob\/Documents\/For%20Bob: Does not exist at \/var\/www\/nextcloudbeta\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Native\/NativeState.php#179","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"PHP","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"Couldn't stat smb:\/\/192.168.178.100\/Test\/Bob\/Documents\/For%20Bob: Does not exist at \/var\/www\/nextcloudbeta\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Native\/NativeState.php#179","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"PHP","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"Couldn't stat smb:\/\/192.168.178.100\/Test\/Bob\/Documents\/For%20Bob: Does not exist at \/var\/www\/nextcloudbeta\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Native\/NativeState.php#179","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"no app in context","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"No cache entry found for \/Bob\/files\/ExtBob\/Documents\/For Bob (storage: smb::SMB-User@192.168.178.100\/\/Test\/\/Bob\/, internalPath: Documents\/For Bob)","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"PHP","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"Couldn't stat smb:\/\/192.168.178.100\/Test\/Bob\/Documents\/For%20Bob: Does not exist at \/var\/www\/nextcloudbeta\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Native\/NativeState.php#179","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"files","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":"It is not allowed to move one mount point into another one","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}
{"reqId":"nkAz55yYQzFAJdLGLx7W","level":0,"time":"2018-10-01T18:06:06+02:00","remoteAddr":"192.168.178.11","user":"Bob","app":"webdav","method":"MOVE","url":"\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","message":{"Exception":"Sabre\\DAV\\Exception\\Forbidden","Message":"","Code":0,"Trace":[{"file":"\/var\/www\/nextcloudbeta\/3rdparty\/sabre\/dav\/lib\/DAV\/Tree.php","line":158,"function":"moveInto","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["For Bob","files\/Bob\/For Bob",{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]},{"file":"\/var\/www\/nextcloudbeta\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":646,"function":"move","class":"Sabre\\DAV\\Tree","type":"->","args":["files\/Bob\/For Bob","files\/Bob\/ExtBob\/Documents\/For Bob"]},{"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"http:\/\/testlab.decatec.de\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloudbeta\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpMove"],[{"absoluteUrl":"http:\/\/testlab.decatec.de\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloudbeta\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:MOVE",[{"absoluteUrl":"http:\/\/testlab.decatec.de\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloudbeta\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"http:\/\/testlab.decatec.de\/nextcloudbeta\/remote.php\/dav\/files\/Bob\/For%20Bob","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloudbeta\/apps\/dav\/lib\/Server.php","line":293,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloudbeta\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloudbeta\/remote.php","line":163,"args":["\/var\/www\/nextcloudbeta\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/nextcloudbeta\/apps\/dav\/lib\/Connector\/Sabre\/Directory.php","Line":442,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.1.1"}

I wonder about this error:

It is not allowed to move one mount point into another one

Why this is not allowed? Isn’t a shared folder just a link to another folder internally?
Is there any workflow in order to be able to move shared folders between external shares?

Any help would be appreciated.

I’ve searched the code where the error message is created. It’s in /lib/private/Files/View.php:

	private function isTargetAllowed($target) {
		list($targetStorage, $targetInternalPath) = \OC\Files\Filesystem::resolvePath($target);
		if (!$targetStorage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
			\OCP\Util::writeLog('files',
				'It is not allowed to move one mount point into another one',
				ILogger::DEBUG);
			return false;
		}

When I get this right, when moving a file or folder, it is checked if i’s on local or external storage. When on external storage, the operation gets cancelled.

When removing the if-block executing this check, I am able to move shared folders on external storage. It seems to work pretty well.

Only drawback: Of course I now get a warning regarding the integrity check…

So now my main question is: Why it’s not permitted to move shared folders on external storage? Is there any technical reason?

1 Like

Did you get any response (besides here in this help forum)?