-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
#2909: Relative root paths no longer seem to work #4019
Conversation
Greg suggest Path::canonicalize() instead of realpath(). |
@weitzman, Path::canonicalize() did not resolve the issue. The problem is that in |
I just approved webflo/drupal-finder#40. Hopefully @webflo will merge it soon. Does that fix it for you? |
@weitzman, The problem still occurs with the fix in webflo/drupal-finder#40. |
@weitzman, I was able to find where the bug is located.
The problem occurs in repo Webflo/Drupal-finder. In file |
BTW: I created webflo/drupal-finder#41 |
src/Config/Environment.php
Outdated
@@ -34,7 +34,7 @@ class Environment | |||
public function __construct($homeDir, $cwd, $autoloadFile) | |||
{ | |||
$this->homeDir = $homeDir; | |||
$this->originalCwd = Path::canonicalize($cwd); | |||
$this->originalCwd = FsUtils::realpath($cwd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FsUtils::realpath
is a lot safer than a raw realpath
call, so perhaps this is okay. If we add this, it means that we'll have to work harder in the AppVeyor tests, because this will convert Windows paths from using /
to \
.
This only introduces a handful of failures in the current tests, so I suppose it is tractable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greg-1-anderson, I'm not sure what the right way is to fix the tests. Can you point me in the right direction? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our typical strategy here is to normalize the output before asserting. For example, if you str_replace each \
with a /
, then you can compare the path invariantly again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Let's see if this fixes the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 👍 on this; however, symlinks and realpath
have caused us problems before, so let's get a second +1 from @weitzman before merging here before we decide whether we'll support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Canonicalized paths always have same slashes even on windows. So I don't immediately see why we need str replace.
This PR uses |
That's fine. I'm arguing against the replace calls in tests. Instead, whatever is writing cwd to config should canonicalize first. |
What about this change?
|
Thanks for your persistence, @JTubex. |
Great! |
This was done for dedicated (Enterprise) environments (whose absolute app root was not /app). Drush now supports relative paths (since 9.6.2) so this is unnecessary. Users whose dedicated (Enterprise) sites are on old versions of Drush 9 (i.e. between 9.0.0 and 9.6.2) are advised to upgrade Drush to at least 9.6.2. 9.7.1 is the latest version at the time of writing. See the Drush fix in drush-ops/drush#4019
This was done for dedicated (Enterprise) environments (whose absolute app root was not /app). Drush now supports relative paths (since 9.6.2) so this is unnecessary. Users whose dedicated (Enterprise) sites are on old versions of Drush 9 (i.e. between 9.0.0 and 9.6.2) are advised to upgrade Drush to at least 9.6.2. 9.7.1 is the latest version at the time of writing. See the Drush fix in drush-ops/drush#4019
This was done for dedicated (Enterprise) environments (whose absolute app root was not /app). Drush now supports relative paths (since 9.6.2) so this is unnecessary. Users whose dedicated (Enterprise) sites are on old versions of Drush 9 (i.e. between 9.0.0 and 9.6.2) are advised to upgrade Drush to at least 9.6.2. 9.7.1 is the latest version at the time of writing. See the Drush fix in drush-ops/drush#4019
Describe the bug
#2909
When executing any drush command in a relative root path, the command times out and gives a segmentation fault.
To Reproduce
execute
drush cr
.Expected behavior
A cache rebuild.
Actual behavior
The command timed out and gave a segmentation fault.
When executing drush cr -vvv the result was the following:
System Configuration