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

Passwords with slashes breaks parsing of --db-url #1134

Open
hansfn opened this issue Jan 30, 2015 · 5 comments
Open

Passwords with slashes breaks parsing of --db-url #1134

hansfn opened this issue Jan 30, 2015 · 5 comments

Comments

@hansfn
Copy link
Contributor

hansfn commented Jan 30, 2015

I'm auto-generating passwords for MySQL and tried to use one of them when running site-install. It failed. It took some tries before I noticed the problem - see simplified example:

$ drush site-install standard --db-url=mysql://drush_si_test:12/34@localhost/drush_si_test
You are about to CREATE the '34@localhost/drush_si_test' database. Do you want to continue? (y/n): n

The database name is wrong because of the slash in the password - '34@localhost/drush_si_test' versus the expected 'drush_si_test'. The reason this happens is that function drush_convert_db_from_db_url (in includes/sitealias.inc) uses parse_url to parse the DB URL.

One solution is to document that Drush doesn't support passwords with slashes. Another is to introduce some type of escaping of the slash.

I think the best fix is to parse the db-url string manually. I'm happy to write a patch if people think Drush should handle passwords with slashes.

PS! This has been discussed and turned down before - see https://www.drupal.org/node/1526858

@hansfn
Copy link
Contributor Author

hansfn commented Jan 30, 2015

Related issue: #1129

@dpi
Copy link
Contributor

dpi commented Jan 31, 2015

The connect string is a URL scheme, you should urlencode your password as a slash character will mess things up. The other issue is not quite the same.

@greg-1-anderson
Copy link
Member

Could you please test this again, URL-encoding your password, and see if Drush / parse_url correctly unencodes the password?

If that works, we can update the documentation and close this + #1129.

@greg-1-anderson greg-1-anderson added this to the Drush7 milestone Feb 2, 2015
@dpi
Copy link
Contributor

dpi commented Feb 2, 2015

As I mentioned there, I URL-encoded the password and it works fine, which is the problem with this issue.
Its when Drush reads the password from settings.php is where problems show for the other issue.
The issues are not the same.

@hansfn
Copy link
Contributor Author

hansfn commented Feb 6, 2015

Yes, URL-encoding the password works. It will help if we update the documentation. I also think we should help the user - do some minimal sanity checks of the format (and the result of the parsing) and warn the user. I can write a patch for this if it sounds interesting.

#1129 is different.

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

3 participants