Skip to content

new SMB storage backend - #4770

Closed
icewind1991 wants to merge 28 commits into
masterfrom
smb
Closed

icewind1991 wants to merge 28 commits into
masterfrom
smb

Conversation

@icewind1991

Copy link
Copy Markdown
Contributor

New implementation of the SMB storage backend using a new wrapper for smbclient (https://github.com/icewind1991/SMB).
This improves the test-ability and maintainability of the SMB backend and hopefully helps with the various issues the current SMB backend has.

Tested it locally against an smb server running on arch, requires testing against a windows smb server.

cc @DeepDiver1975 @karlitschek

@ghost

ghost commented Sep 8, 2013

Copy link
Copy Markdown

@ghost

ghost commented Sep 8, 2013

Copy link
Copy Markdown

Comment thread apps/files_external/lib/smb.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm - smb/cifs shares can be read only as well

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@icewind1991
Tested it against a Windows 7 machine
testRoot and testMimeType are failing
testFOpen and all remaining test could not be executed because a lot of smbclient processes (one for each executed test) consumed all the cpu - there is something wrong with the process termination of smbclient

Regarding testRoot:
it failes with root being '', '/', '/test and 'test'

for further testing: grab a windows vm here: http://www.modern.ie/en-US/virtualization-tools#downloads
Feel free ti catch me on irc in case you need help with the setup of shares in windows

@ghost

ghost commented Sep 9, 2013

Copy link
Copy Markdown

@itn3rd77

Copy link
Copy Markdown
Contributor

@icewind1991 Did you keep in mind the issue #2502 when implementing the new SMB storage backend?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

OC7

@PVince81

Copy link
Copy Markdown
Contributor

@icewind1991 I haven't read the code yet. Will it support streaming ? (ie not having to download a whole file when only the first MB is needed, for example for thumbnail generation or mimetype detection)

@icewind1991

Copy link
Copy Markdown
Contributor Author

No, that is a limitation of smbclient itself

@PVince81

Copy link
Copy Markdown
Contributor

Would be good to check whether it's possible to tell smbclient to output the file contents to stdout instead of a target file (or pipe it). If that works, it might be possible to stream whatever comes from its stdout back to ownCloud, maybe using popen() and pipes.

@PVince81

Copy link
Copy Markdown
Contributor

Awwwyeah, streaming/piping could work, this worked for me:

smbclient \\\\localhost\\shared -N -c "get pic.jpg -"

Seems it can work with put as well:

cat pic.jpg | smbclient \\\\localhost\\shared -N -c "put - pic.jpg"

Comment thread apps/files_external/lib/smb.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to either use file_exists() or fallback to the default impl that does just that.
Same for isUpdatable().
Always returning true might make callers believe that a file exists when it doesn't (scanFile())

@icewind1991

Copy link
Copy Markdown
Contributor Author

Updated streamwrapper and storage.

tested against a windows 8 VM and a samba server on Arch Linux.

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@ghost

ghost commented Feb 25, 2014

Copy link
Copy Markdown

@PVince81 PVince81 mentioned this pull request Mar 6, 2014
5 of 10 tasks

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can't this be done in a more automatic-autoload-approach, i.e. without registering your own autoloader?

@bantu

bantu commented Mar 6, 2014

Copy link
Copy Markdown

Please add class documentation to all classes. E.g. it should be easily possible to see what the difference between RawConnection and Connection is.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't these be available to subclasses? Personally, I think that the number of proper use-cases of private is just as limited as the number of use-cases for static.

@bantu

bantu commented Mar 6, 2014

Copy link
Copy Markdown

A PHP Stream Wrapper for SMB would be pretty awesome. :-)

@PVince81

Copy link
Copy Markdown
Contributor

@icewind1991 I started testing this, see some failing results here #4770 (comment)

@PVince81

Copy link
Copy Markdown
Contributor

I'd say better rebase this first, it seems some issues might be caused by stuff that was fixed already on master.

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Do we really want to continue with the approach to fork smbclient processes?

Even with a much better looking code base the basic mechanism remains - I'd prefer to have a native php module which uses samba libs to talk to smb/cifs shares directly.

@karlitschek @icewind1991 @PVince81

@bantu

bantu commented Apr 7, 2014

Copy link
Copy Markdown

@DeepDiver1975 I think improving the existing approach using smbclient via exec is an acceptable intermediate step.

@PVince81

PVince81 commented Apr 7, 2014

Copy link
Copy Markdown
Contributor

One advantage I saw here is that the smbclient process is only started once, and its internal CLI is driven by @icewind1991 's code which should improve performance a bit as we don't need to restart the process for every command (stat, etc...)

I'm still a bit afraid that this big change causes regressions.

@icewind1991

Copy link
Copy Markdown
Contributor Author

I agree that having a native php module would be the optimal solution but that wont be available in all situations

@ghost

ghost commented Apr 7, 2014

Copy link
Copy Markdown

@DeepDiver1975

Copy link
Copy Markdown
Contributor

that wont be available in all situations

true - but installations not capable of installing a custom/self-built php module generally don't need access to smb shares

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hmm. trim() on binary data?

@icewind1991

Copy link
Copy Markdown
Contributor Author

superseded by #10673

@MorrisJobke
MorrisJobke deleted the smb branch January 31, 2015 08:40
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 14, 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