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

FTP adapter and createDir with a dot folder #1006

Closed
GregOriol opened this issue Feb 15, 2019 · 7 comments
Closed

FTP adapter and createDir with a dot folder #1006

GregOriol opened this issue Feb 15, 2019 · 7 comments

Comments

@GregOriol
Copy link

GregOriol commented Feb 15, 2019

Bug Report

Q A
BC Break no
Version v1.0.50

Summary

With the FTP adapter, it seems that creating a directory inside a dot directory doesn't work.
Server is pure-ftpd on ubuntu.

How to reproduce

I'm trying to create a directory inside a dot directory like this ->createDir('.dir1/dir2'); and it fails because in FTP's createActualDirectory method, $listing = ftp_nlist($connection, '.') ?: []; returns only non-dot files and directories. So the createDir method thinks .dir1 doesn't exist, and tries to create it, which fails.

It is a problem because it can break in a few other use cases: when a dot file with the same name as the directory exists for example, createActualDirectory will try to create the dot directory and fail too, with a non explicit error.

A few more information:

  • this issue happens with pure-ftpd using configuration defaults from ubuntu
  • if enabling dot files in the pure-ftpd configuration ("yes" in /etc/pure-ftpd/conf/DisplayDotFiles), it works
  • this issue doesn't happen with vsftpd using configuration defaults from ubuntu
@frankdejonge
Copy link
Member

Hi, I've tried to reproduce this but I'm getting an error trying to create the directory .dirname which is not what you describe here. The error message states is not possible to create a directory with that name. So it seems dot-prefixed directory names are prohibited.

@frankdejonge
Copy link
Member

For now I'm going to close this issue because I think it's expected behaviour. If not, please comment with more information and we can re-open this issue.

@GregOriol
Copy link
Author

@frankdejonge Did you try it with different servers? The behavior might vary from server implementations I think.

I can't agree with the "expected behaviour": a server can have dot folders, and handling dot files must not fail in a bizarre way.

@frankdejonge
Copy link
Member

Regardless of what you think of it, I can't make a FTP server behave different, nor can I make the ftp_nlist function return dot prefixed directories. I also didn't see anything in the PHP docs about this described behaviour and I couldn't reproduce it with a standard implementation of FTP. I'm not going to just try all the FTP version out there, this is not my job.

So unless you supply better information or supply a PR that proves it (preferably with a server in docker) this issue is not actionable for me.

@GregOriol
Copy link
Author

GregOriol commented Mar 18, 2019

@frankdejonge I actually provided details on which servers I did and did not experience the issue!

Also, since the current implementation of the directory creation (in createActualDirectory) of the ftp implementation of flysystem is really a very custom one, I'm wondering how this is even expected to work, that's why I'm submitting it as an issue, instead of a PR/rewrite of that code.

Finally, managing the differences between server implementations is the job of an abstraction library like flysystem, and should make it work the same way regardless of the server used.

So unless this issue is resolved, let's keep it open, as a solution could be provided and people experiencing this behavior will find it helpful if the issue is being shown as open/ongoing.

@frankdejonge
Copy link
Member

This is an open source project. Submit a PR. Good luck.

@GregOriol
Copy link
Author

I will, if the issue is kept open.

@thephpleague thephpleague locked and limited conversation to collaborators Mar 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants