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

implement specific rename handling for SMB #23845

Merged
merged 1 commit into from
Jun 7, 2016
Merged

implement specific rename handling for SMB #23845

merged 1 commit into from
Jun 7, 2016

Conversation

blizzz
Copy link
Contributor

@blizzz blizzz commented Apr 7, 2016

@icewind1991 were there reasons why there was no specifc rename for SMB and copy+delete was used instead? So far this changes work for me with and without php-libsmbclient.

@blizzz blizzz added this to the 9.1-current milestone Apr 7, 2016
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @icewind1991, @jmaciasportela, @PVince81 and @Xenopathic to be potential reviewers

@RobinMcCorkell
Copy link
Member

It should be unnecessary to wrap the rename call in an exception catcher, if an exception is thrown it will bubble up into the filesystem layer anyway and be logged (and ownCloud is smart enough to recognize the rename failed)

@blizzz blizzz force-pushed the smb-rename branch 2 times, most recently from 9539d5c to afd2f56 Compare April 7, 2016 15:26
@blizzz
Copy link
Contributor Author

blizzz commented Apr 7, 2016

It should be unnecessary to wrap the rename call in an exception catcher, if an exception is thrown it will bubble up into the filesystem layer anyway and be logged (and ownCloud is smart enough to recognize the rename failed)

True, seen that. Adjusted, thx!

@blizzz blizzz changed the title [WIP] implement specific rename handling for SMB implement specific rename handling for SMB Apr 7, 2016
$path2 = $this->buildPath($path2);
$result = $this->share->rename($path1, $path2);

// non-native Share implementation does not return bool in fact
Copy link
Member

Choose a reason for hiding this comment

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

Does it? According to the PHPDoc of icewine1991/SMB it should...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Doc is a lie.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😄 thx

@RobinMcCorkell
Copy link
Member

You'll probably need to do some unset($this->statCache[]) calls

@PVince81
Copy link
Contributor

no specifc rename for SMB and copy+delete

I believe this is because SMB doesn't allow you to rename + overwrite existing files. So you have to copy+overwrite then delete the source. At least that's how I had to do it back then when we had the smb4php lib.

@blizzz
Copy link
Contributor Author

blizzz commented Apr 18, 2016

In WND, i believe, we used to delete the target, if existing, and then do the rename. I adopted it.

@PVince81
Copy link
Contributor

@blizzz any specific reason why you decided to change the approach ? Does it fix any issue ?

@blizzz
Copy link
Contributor Author

blizzz commented May 13, 2016

I expect a native rename on an external storage to be more performing than copying a file there, honestly I did not compare it. My main motivation back then was proper behaviour in SMB notifications. In case there are other applications listening, they will not do get an information about a rename with the old and new name, but copy and delete actions. If another application would do this while we listen, this would be bad and we could not recognize a move, as we plan. So this is an issue indeed.

@PVince81
Copy link
Contributor

In case there are other applications listening, they will not do get an information about a rename with the old and new name, but copy and delete actions. If another application would do this while we listen, this would be bad and we could not recognize a move, as we plan. So this is an issue indeed.

That is actually a very good point

@PVince81
Copy link
Contributor

@icewind1991 @jvillafanez mind taking over this ?

@icewind1991
Copy link
Contributor

Updated

This is good to review @owncloud/filesystem

@PVince81
Copy link
Contributor

PVince81 commented Jun 1, 2016

  • TEST: DAV rename
  • TEST: DAV rename + overwrite
  • TEST: sync client rename
  • TEST: sync client rename + overwrite
  • TEST: sync client overwrite (internally part file will be renamed + overwrite target file)
  • TEST: move in/out of folders

👍

@jvillafanez
Copy link
Member

Being picky, how much common is to rename to an already existing file? I don't think this is very common, and probably it usually is due to a mistake. So 90% of the times, we'll be trying to delete a missing file (the target one) before renaming.

My point is that we might want to try the rename first, and if the rename fails due to the target file exists, we delete the file and retry.

@PVince81
Copy link
Contributor

PVince81 commented Jun 1, 2016

rename to an already existing file

When uploading a file with the desktop client, internally it creates a part file.
At the end of the transfer, the part file is renamed to the final file and overwrites it. So this is pretty common.

@PVince81
Copy link
Contributor

PVince81 commented Jun 7, 2016

@owncloud/filesystem @jvillafanez @guruz @dragotin @mmattel second review ?

@guruz
Copy link
Contributor

guruz commented Jun 7, 2016

Code looks ok 👍

@jvillafanez
Copy link
Member

👍

@PVince81 PVince81 merged commit 46fe2dd into master Jun 7, 2016
@PVince81 PVince81 deleted the smb-rename branch June 7, 2016 10:32
@lock
Copy link

lock bot commented Aug 5, 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 5, 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.

8 participants