Skip to content

Conversation

@butonic
Copy link
Member

@butonic butonic commented Aug 16, 2016

forward port of some of the smb fixes that went into 8.2

cc @dercorn

@mention-bot
Copy link

@butonic, thanks for your PR! By analyzing the annotation information on this pull request, we identified @icewind1991, @jmaciasportela, @PVince81 and @Xenopathic to be potential reviewers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a log here. We don't overwrite things often so debugging this could be confusing because we expect no modifications.

@butonic
Copy link
Member Author

butonic commented Aug 19, 2016

This has become a release blocker.

@butonic butonic force-pushed the stable9-smbfixes branch 2 times, most recently from 0eeeb82 to 8b3aad7 Compare August 19, 2016 14:57
@butonic
Copy link
Member Author

butonic commented Aug 22, 2016

hm, I can rename a felder just fine ... also with spaces ... investigating

@butonic
Copy link
Member Author

butonic commented Aug 22, 2016

@DeepDiver1975 is jenkins using phpsmbclient or smbclient via cli? icewind1991/SMB#52

@DeepDiver1975
Copy link
Member

@DeepDiver1975 is jenkins using phpsmbclient or smbclient via cli? icewind1991/SMB#52

smbclient

@butonic
Copy link
Member Author

butonic commented Aug 23, 2016

@DeepDiver1975 for smbclient running the testsuite locally gives me only errors and failures. debugging it I don't seem to be able to allinfo any file. Testing it on the cli with smbclient I see the same thing.

Testing with libsmbclient 57of77 tests fail. Running individual tests alone makes them pass ... WTF.

Investigating further.

try {
$this->log("stat fetching '{$this->root}|$path'");
$this->statCache[$path] = $this->share->stat($path);
if ($this->remoteIsShare() && $this->isRootDir($path) && $this->statCache[$path]->isHidden()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to remove the $this->remoteIsShare() from here. If the remote subfolder isn't empty, the function is intended to return false (we aren't connecting directly to a share but to a inner folder), so in that case if the folder is hidden it won't be shown.

@butonic
Copy link
Member Author

butonic commented Aug 23, 2016

FYI: this cannot be automatically tested when you are using any Windows desktop os because "The number of connections is limited to 20 by the software license agreement". Running individual tests works.

We are not explicitly closing / disconnecting in tearDown(). That piles up connections and after 20 tests the rest fails ...

@butonic
Copy link
Member Author

butonic commented Aug 23, 2016

great, now all of the tests are broken, but they all work on my machine.

if ($this->instance) {
$this->instance->rmdir('');
// force disconnect of the client
unset($this->instance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe needs a more explicit disconnect ? If it doesn't work on CI it could be due to a different PHP version where maybe the GC works differently ?

Maybe add a method "close" on the SMB instance and use method_exists here before trying to call it ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, unsetting works around the connection limit just fine. The problem with nearly all tests failing may have been caused by how the share was set up and which version of smbclient is available.

I have shared my E: drive as 'guest', with a root of '' the testsuite fails completely when using smbclient but completes fine with lbsmbclient. The problem is that I smbclient cannot get a stat with allinfo "/path/to/file". It will always get a NT_STATUS_OBJECT_NAME_NOT_FOUND getting alt name for /path/to/file. There was a related issue regarding the root of a share: #14347

Also, it seems recent smbclient changed the output of allinfo, see icewind1991/SMB#52

remember, all these problems only arise whan using the fallback smbclient implementation.

@DeepDiver1975 we also need to test libsmbclient automatically.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a fallback for failing stats thet try reading the stat info from the parent folders dirlisting. Waiting for jenkins...

@PVince81
Copy link
Contributor

@butonic are these already on stable9.1 or will they need to be forward-ported too ?

@butonic
Copy link
Member Author

butonic commented Aug 24, 2016

need to be forward ported as I was debugging this at a customer. the code in 9.1 and master is exactly the same with the upper/lower case filenames being the exception.

throw $e;
}
}
if ($this->remoteIsShare() && $this->isRootDir($path) && $this->statCache[$path]->isHidden()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also applies if our root path targets a remote folder, not just the share, so the $this->remoteIsShare() condition should be removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean when the actual share is eg. \\host\Users but in oc is configured as 'share'=>'\\host\User\Bob', 'root'=>'' ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, more or less. An expected configuration should be 'share' => 'Users' , 'root' => 'Bob' so when the user ask for the storage's root path ('') it's internally mapped to \\host\Users\Bob.

In that case, the remoteIsShare() should return false because we're connecting to an inner folder not to the share's root.

@butonic butonic changed the title [WIP][Stable9] smbfixes [Stable9] smbfixes Aug 24, 2016
@butonic
Copy link
Member Author

butonic commented Aug 24, 2016

@jvillafanez I also added the smbclient vs libsmbcliend toggle.

@ALL can I haz 👍 pls?

private function removeFromCache($path) {
$path = trim($path, '/');
// TODO The CappedCache does not really clear by prefix. It just clears all.
//$this->dirCache->clear($path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ commented code!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I left them in to hint at what was cached in 8.2. But performance improvements can be done in a separate PR.

@jvillafanez
Copy link
Member

My only concern is that the getFileInfo function has gotten big. I'm not sure if it's possible to simplify the function and reduce the number of lines just by splitting it into smaller functions.

Anyway 👍 unless @owncloud/qa says otherwise.

@PVince81
Copy link
Contributor

@butonic had a quick look and it looks fine.

@butonic please answer this comment https://github.com/owncloud/core/pull/25817/files#r75436102

Then once Jenkins is ressurected, if the tests pass then 👍

@butonic
Copy link
Member Author

butonic commented Aug 26, 2016

all tests pass, two thumbs, all comments answered.

@butonic butonic merged commit 72fa98b into stable9 Aug 26, 2016
@butonic
Copy link
Member Author

butonic commented Aug 26, 2016

will port forward now

@PVince81 PVince81 deleted the stable9-smbfixes branch January 12, 2017 09:00
@lock
Copy link

lock bot commented Aug 4, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants