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

New features #19

Closed
milesj opened this issue Apr 30, 2014 · 11 comments
Closed

New features #19

milesj opened this issue Apr 30, 2014 · 11 comments

Comments

@milesj
Copy link
Contributor

milesj commented Apr 30, 2014

Hey again, so I'm currently converting https://github.com/titon/io tests to use this library, and these are some features that are missing. I'm not sure what is possible with streams or not, so just let me know what is and isn't possible.

  • symlinks (is_link(), lchgrp(), lchown(), etc)
  • is_executable()

I've also noticed some weirdness with rename() in regards to folders. Specifically, this test: https://github.com/titon/io/blob/master/tests/Titon/Io/NodeTest.php#L201 According to the docs, rename should overwrite the target, so I'm assuming that the folder contents get moved to the new location. I'm not 100% positive how folder renaming works in PHP land, so will need to test more before I submit an issue.

@michael-donat
Copy link
Owner

Renaming directories on top of existing includes the renamed into existing, have a look here

donatm@osx-donatm:/tmp$ cd milesj/
donatm@osx-donatm:/tmp/milesj$ mkdir source
donatm@osx-donatm:/tmp/milesj$ mkdir -p target/contents
donatm@osx-donatm:/tmp/milesj$ ll source/
total 0
drwxr-xr-x  2 donatm  wheel   68 30 Apr 07:59 .
drwxr-xr-x  4 donatm  wheel  136 30 Apr 07:59 ..
donatm@osx-donatm:/tmp/milesj$ ll target/
total 0
drwxr-xr-x  3 donatm  wheel  102 30 Apr 07:59 .
drwxr-xr-x  4 donatm  wheel  136 30 Apr 07:59 ..
drwxr-xr-x  2 donatm  wheel   68 30 Apr 07:59 contents
donatm@osx-donatm:/tmp/milesj$ mv target source
donatm@osx-donatm:/tmp/milesj$ ll
total 0
drwxr-xr-x   3 donatm  wheel  102 30 Apr 07:59 .
drwxrwxrwt  20 root    wheel  680 30 Apr 07:59 ..
drwxr-xr-x   3 donatm  wheel  102 30 Apr 07:59 source
donatm@osx-donatm:/tmp/milesj$ ll source/
total 0
drwxr-xr-x  3 donatm  wheel  102 30 Apr 07:59 .
drwxr-xr-x  3 donatm  wheel  102 30 Apr 07:59 ..
drwxr-xr-x  3 donatm  wheel  102 30 Apr 07:59 target
donatm@osx-donatm:/tmp/milesj$

mv target source moved target into source, not replaced. This is the behaviour I recreated.

@michael-donat
Copy link
Owner

Digging further,

<?php
        mkdir('/tmp/a');
        mkdir('/tmp/b');

        rename('/tmp/a', '/tmp/b');

Above removed a and replaced with b.

While

<?php
        mkdir('/tmp/aa', 0777, true);
        mkdir('/tmp/bb', 0777, true);
        file_put_contents('/tmp/bb/file', 'data');

        rename('/tmp/aa', '/tmp/bb');

Resulted in rename(/tmp/aa,/tmp/bb): Directory not empty

This is probably the behaviour to be expected. I will adjust as soon as I have some time.

@michael-donat
Copy link
Owner

I'm also looking at Links. This is possible, need to add another Node type that's all.

@milesj
Copy link
Contributor Author

milesj commented Apr 30, 2014

Awesome, thanks for looking into it. I'll implement more of the more complex areas next to see if there's anything else missing.

@milesj
Copy link
Contributor Author

milesj commented May 3, 2014

Found another one: flock

This was referenced May 10, 2014
@michael-donat
Copy link
Owner

@milesj what's wrong with is_executable? Seems to be working fine with a simple true/false case?

@milesj
Copy link
Contributor Author

milesj commented May 10, 2014

During this test, it would always fail. https://github.com/titon/io/blob/master/tests/Titon/Io/NodeTest.php#L247

Didn't look into it much though.

@michael-donat
Copy link
Owner

/usr/local/Cellar/php55/5.5.11/bin/php /private/var/folders/y1/hclnhr051gl3lyrvx9vz5qs40000gn/T/ide-phpunit.php --configuration /Volumes/Development/io/phpunit.xml.dist --filter "/::testPermissionReading( .*)?$/" Titon\Io\NodeTest /Volumes/Development/io/tests/Titon/Io/NodeTest.php
Testing started at 19:43 ...
PHPUnit 4.0.7 by Sebastian Bergmann.

Configuration read from /Volumes/Development/io/phpunit.xml.dist



Time: 59 ms, Memory: 4.50Mb

OK (1 test, 8 assertions)

Process finished with exit code 0

@michael-donat
Copy link
Owner

Right, against DIR it will always return false. PHP limitation.

@milesj
Copy link
Contributor Author

milesj commented May 10, 2014

Derp, I knew it was something simple. Thanks for looking, always nice to have another set of eyes.

@michael-donat
Copy link
Owner

Have moved everything else to separate issues. Will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants