Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why a shared folder cannot be moved from/to external storage #11546

Closed
DecaTec opened this issue Oct 2, 2018 · 3 comments
Closed

Why a shared folder cannot be moved from/to external storage #11546

DecaTec opened this issue Oct 2, 2018 · 3 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: external storage

Comments

@DecaTec
Copy link

DecaTec commented Oct 2, 2018

I already posted this question in the forums, but I thinks it's more a dev thing, so I'll try it here.

Let's assume that there are two users: Admin and Bob.
Both have external storage mounted (mounted external storage as admin):
External storage mounted as admin

Steps to reproduce

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

Expected behaviour

I would expect that the shared folder can be moved, no matter if it's on "internal" or external storage.

Actual behaviour

An error is shown that the folder cannot be moved.

Are you using external storage, if yes which one: SMB/CIFS (but it shouldn't make any difference when using other types of external storage)

Are you using encryption: no

Are you using an external user-backend, if yes which one: No

Logs

Nextcloud log (data/nextcloud.log)

Log entries are only written if the log level is set to a value < 2. These entries are written with log level 0 (debug):

Nextcloud log
{"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"}

The error message says it all:

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

I took a look at the code producing this message. 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. This seems to work without any issues. The only problem is the integrity warning I get with these changes.

So I don't know if this is a real issue, but I'm asking:

  • Why it is not permitted to move a shared folder from/to external storage?
  • Are there any technical issues I will run into when implementing the workaround mentioned above?
  • Is there any chance to implement a "proper" workaround?

Any ideas would be appreciated.

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #1020 (Search not working in shared (external/local storage) folders), #6707 (User cannot move shared file to shared folder), #6802 (Can't update a file in a shared folder from a external SMB storage with Collabora Online), #585 (Unable to generate new share from shared external storage), and #10563 (Failure to move directory to (local) external storage).

@DecaTec
Copy link
Author

DecaTec commented Oct 29, 2018

Any idea why moving a share on external share is "prohibited in code"?

I mean, it's not a real issue, its's only a question, but I want to understand what I could break when modifying the code in order to support moving shares on external storage.

@skjnldsv skjnldsv added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jun 12, 2019
@skjnldsv
Copy link
Member

duplicate of #12445, see explanation there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: external storage
Projects
None yet
Development

No branches or pull requests

3 participants