-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
The Filesystem component cannot rename between different drives #12533
Comments
Actually, this should be considered as a bug, as it is not the expected behaviour (even though PHP's |
Il I understand correctly, it's a Windows specific issue |
@pborreli no. cross-drives renaming are not possible on Linux either AFAIK. See the Composer code. It has the fallback for both Windows and Unix. See composer/composer#900 for the Unix report in Composer |
And fixing this is probably just a matter of reusing the Composer logic (licenses are compatible, and Composer is using this code since 2 years) |
ok @stof, thanks. |
Can confirm that using rename() PHP function here is the root of the issue for Linux with separated / and /home drives. |
@RoSk0 👍 , tested on three debian distribs this morning, got an error. But using copy + unlink works well. |
@Pierstoval I wasn't able to reproduce this on Ubuntu. Is there something special I have to do to get the error? By the way, the PHP documentation states that moving across device boundaries should be possible:
|
@xabbuh Looks like the issue here is in internal rename() implementation.
rename() works good with files, but when it comes to directories... |
@stof but the proposal composer solution uses the component process should include the PR component dependence proces or simply run operating system calls via exec, I could work on this. |
Do you think it may be a good idea to make multiple tries in copying and if none works, throw the exception ? With this, we may be able to log a warning when first try does not work and the next one does. For example, first try may be basically using |
@Pierstoval This is basically what Composer does (see the code @stof linked to in the issue description). |
@Pierstoval Are you working on this? |
Nope, I have too much work to do on my different apps to work on this issue :( |
I would like to send a PR, but should i use the process component for system calls, or call |
@desarrolla2 From my point of view, adding a dependency on the Process component only for this edge case doesn't make much sense. Checking first if the |
@xabbuh ok, i will work on this and send a PR. |
@xabbuh @desarrolla2 some components like |
…ross drives See symfony/symfony-installer#46 and symfony/symfony#12533
@desarrolla2 Are you still working on this? |
ups, i forget the issue, i will work on this this night. |
@desarrolla2 let me know if you can't work on it soon so I can take over the issue |
Just for reference if anyone is using Docker, there's a high chance they will come across this problem if their cache directory is originally created in a separate layer (i.e. at the build stage). |
Can confirm this issue during docker build, had to do a |
...to move a file without side effects. This gist reproduces the problem: https://gist.github.com/alcaeus/a367e895e6c55f7fb93870dcba46efa9 Same issue is fixed in a similary way in symfony core: symfony/symfony#12533 resolves #6713
...to move a file without side effects. This gist reproduces the problem: https://gist.github.com/alcaeus/a367e895e6c55f7fb93870dcba46efa9 Same issue is fixed in a similary way in symfony core: symfony/symfony#12533 resolves doctrine/orm#6713
Because it only tries the PHP
rename
function, the Filesystem component inherits its limitation about being restricted to a single drive.See https://github.com/symfony/symfony-installer/issues/46#issuecomment-63951753 for an issue caused by that.
composer implemented a fallback logic to be able to rename between drives: https://github.com/composer/composer/blob/edd4b2f984821fa696f1be848f9d5b5aea449537/src/Composer/Util/Filesystem.php#L260
It might be worth integrating it in the Filesystem component
The text was updated successfully, but these errors were encountered: