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

Command-line on Windows: Locations with spaces fails with `was unexpected at this time` error #2220

Closed
kgeorge314 opened this issue Nov 28, 2018 · 4 comments

Comments

@kgeorge314
Copy link

@kgeorge314 kgeorge314 commented Nov 28, 2018

Which version and edition of Flyway are you using?

5.2.3

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Command-Line | Powershell via Octopus

Which database are you using (type & version)?

SQL Server | Azure & 2017

Which operating system are you using?

Windows 10 | 2012R2

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

The locations path contains a space i.e. C:\Work\temp\(US) Test\sql\. We tried the following

  • Original: .\flyway -user=xx -password=yy -url="jdbc:sqlserver://**;databaseName=**" -locations=filesystem:C:\Work\temp\(US) Test\sql\ migrate
  • Single-quote: .\flyway -user=xx -password=yy -url="jdbc:sqlserver://**;databaseName=**" -locations=filesystem:'C:\Work\temp\(US) Test\sql\' migrate
  • Double-Quote: .\flyway -user=xx -password=yy -url="jdbc:sqlserver://**;databaseName=**" -locations=filesystem:"C:\Work\temp\(US) Test\sql\" migrate
  • Quote-All: .\flyway -user=xx -password=yy -url="jdbc:sqlserver://**;databaseName=**" -locations="filesystem:C:\Work\temp\(US) Test\sql\" migrate
    & .\flyway -user=xx -password=yy -url="jdbc:sqlserver://**;databaseName=**" -locations='filesystem:C:\Work\temp\(US) Test\sql\' migrate
  • Linux Style escapce: .\flyway -user=xx -password=yy -url="jdbc:sqlserver://**;databaseName=**" -locations='filesystem:C:/Work/temp/(US)\ Test/sql' migrate
What did you expect to see?

Flyway Migration

What did you see instead?

Error:
Test/sql""=="" was unexpected at this time.

@kgeorge314 kgeorge314 changed the title flyway `filesystem:` does not handle spaces gives `was unexpected at this time.` flyway `-location=filesystem:` does not handle spaces gives `was unexpected at this time.` error Nov 28, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Nov 28, 2018

On Windows, you need to wrap the entire argument in double quotes and it will work:

.\flyway -user=xx -password=yy -url=jdbc:sqlserver://**;databaseName=** "-locations=filesystem:C:\Work\temp\(US) Test\sql\ migrate"
@kgeorge314
Copy link
Author

@kgeorge314 kgeorge314 commented Nov 28, 2018

Thanks, @axelfontaine, that fixed it I should have done a bit more checking 🙄

@kgeorge314
Copy link
Author

@kgeorge314 kgeorge314 commented Nov 28, 2018

Hi @axelfontaine - Apologies, I forgot to mention that it works fine in 5.0.7 but not in 5.2.1 / 5.2.3

Works in Flyway Community Edition 5.0.7 by Boxfuse

image

Doesn't work in Flyway Community Edition 5.2.1 by Boxfuse

image

Doesn't work with full quotes either .\flyway.cmd -user=sa -password=P@ssw0rd -url="jdbc:sqlserver://sqldock;databaseName=OneView" "-locations=filesystem:C:\Work\temp\US Test\sql" migrate
image

The enviroment is a local-docker instance, Server, Passwords etc are all temporary.

@axelfontaine axelfontaine reopened this Nov 29, 2018
@axelfontaine axelfontaine added t: bug and removed r: invalid labels Nov 29, 2018
@axelfontaine axelfontaine added this to the Flyway 5.2.4 milestone Nov 29, 2018
@axelfontaine axelfontaine changed the title flyway `-location=filesystem:` does not handle spaces gives `was unexpected at this time.` error Command-line on Windows: Locations with spaces fails with `was unexpected at this time` error Nov 29, 2018
axelfontaine added a commit that referenced this issue Nov 29, 2018
…h `was unexpected at this time` error
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Nov 29, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Nov 29, 2018

Thank you very much for digging deeper. We found the bug in our Windows batch argument parsing code that wasn't dealing properly with double quotes and spaces. Fixed.

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
…ls with `was unexpected at this time` error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.