Skip to content

Conversation

@hansfn
Copy link
Contributor

@hansfn hansfn commented Mar 5, 2018

Testing Drush 9.2.1 on XAMPP on Windows, I discovered this nice bug. Any Drush command would use 30% of the CPU and never finish. After some digging it was clear that DrupalBoot::scanUpForUri was the guilty one.

The bug is only present if you start in the Drupal site root. If you start inside the core or sites folder, the infinite loop isn't triggered. If you start in the Drupal site root, $root and $scan are identical, and as a result (of flawed logic IMHO) scanUpForUri ends up scanning all the way to the file system root.

On Linux scanUpForUri stops when it's gets to the file system root because $scan and $next becomes equal. On Windows this doesn't happen because of a nice bug in dirname:

dirname('C:/somedir') returns C:\, not the canonical C:/.

The fix in the pull request is the minimal fix that stops the infinite loop. I considered fixing the root issue, the scanning to the root of the file system, but since I wasn't 100% sure if it could be useful in other use-cases I left it it as is.

@hansfn
Copy link
Contributor Author

hansfn commented Mar 13, 2018

Should I file a corresponding issue or is this pull request on your radar? For Windows users this fix is quite critical.

@weitzman weitzman merged commit d5e6f83 into drush-ops:master Mar 13, 2018
@weitzman
Copy link
Member

Looks good. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants