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

The db_remove() function from salt.modules.mysql mistakenly tests the name against "information_scheme" #54938

Open
arizvisa opened this issue Oct 9, 2019 · 6 comments
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@arizvisa
Copy link
Contributor

arizvisa commented Oct 9, 2019

Description of Issue

This is a pretty insignificant bug, but in the salt.modules.mysql module, there's a misspelling when checking to see if the provided database name is invalid.

https://github.com/saltstack/salt/blob/master/salt/modules/mysql.py#L1184

    if name in ('mysql', 'information_scheme'):
        log.info('DB \'%s\' may not be removed', name)
        return False

When calling db_remove(), the function first checks if the named database exists and then checks the name against a tuple. One of these names, "information_scheme" is misspelled and should be "information_schema". Thus, this results in different semantics than from what the author intended.

I'm pretty sure that you're not able to drop the "information_schema" table though, and it's pretty crazy to try as it's used for reflection. So it's a 1-byte fix.

Setup

This is in the salt/modules/mysql.py file from the master branch.

Steps to Reproduce Issue

Probably call db.remove like:

salt \* mysql.db_remove information_schema

Versions Report

This was just found while doing something else in the master branch.

@stale
Copy link

stale bot commented Jan 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 7, 2020
@arizvisa
Copy link
Contributor Author

arizvisa commented Jan 8, 2020

This is literally a 1-character patch and shouldn't take long to fix. The testcase for it is pretty simple too.

snaps whip at bot

@stale
Copy link

stale bot commented Jan 8, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 8, 2020
@Ch3LL
Copy link
Contributor

Ch3LL commented Jan 13, 2020

thanks for pointing this one out. Any chance you want to give it a go and push a PR?

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists P3 Priority 3 and removed needs-triage labels Jan 13, 2020
@Ch3LL Ch3LL added this to the Approved milestone Jan 13, 2020
@arizvisa
Copy link
Contributor Author

Yeah, I can. I'm still waiting for a couple of my PRs to get merged/ported into master though. So I'm hesitant to submit anything until those make it through.

@arizvisa
Copy link
Contributor Author

Specifically #55186

@sagetherage sagetherage removed the P3 Priority 3 label Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests

5 participants