Azure-Samples / azure-sql-library-app-blazor

Library app built with SQL Server and Data API builder as backend, and Blazor as frontend.
MIT License
5 stars 3 forks source link

`installSQLtools.sh` and `postCreateCommand.sh` fail to run due to Windows line endings #9

Closed seantleonard closed 4 months ago

seantleonard commented 4 months ago

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Git clone repo
  2. Open folder in container
  3. Automatic execution of postCreateCommand.sh fails with log message below.

Any log messages given by the failure

[318402 ms] Start: Run in container: /bin/sh -c bash .devcontainer/sql/postCreateCommand.sh P@ssw0rd! './bin/Debug/' './.devcontainer/sql/' .devcontainer/sql/postCreateCommand.sh: line 7: $'\r': command not found 0+1 records in 0+1 records out 28 bytes copied, 0.000887324 s, 31.6 kB/s .devcontainer/sql/postCreateCommand.sh: line 9: syntax error near unexpected token $'\r'' 'devcontainer/sql/postCreateCommand.sh: line 9:for i in {1..60};

What's next: Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug cdd17efc8eb2df6013b3229488477cd30bf0d5baed79c624fbdf1684e7c62768 Learn more at https://docs.docker.com/go/debug-cli/ [319057 ms] postCreateCommand failed with exit code 2. Skipping any further user-provided commands. Done. Press any key to close the terminal.

Expected/desired behavior

  1. No failure expected. LIbrary database fails to install.

OS and Version?

  1. Windows 11 Docker with WSL2

Versions

  1. latest commit to main on this repo https://github.com/Azure-Samples/azure-sql-library-app-blazor/commit/0a1ba8c97744d887f209d95c7f932ddf0eb8b04c
seantleonard commented 4 months ago

does this samples repo expect that i clone the repo onto a Linux OS? maybe pulling on Windows is messing with the line endings?

seantleonard commented 4 months ago

fix was to follow this AskUbuntu guidance of installing dos2unix and running it against the two files specified. https://askubuntu.com/a/1046371

  1. sudo apt-get update
  2. sudo apt-get install dos2unix
  3. sudo dos2unix installSQLtools.sh
  4. sudo dos2unix postCreateCommand.sh
  5. sudo installSQLtools.sh -> without sudo , this fails due to path permissions errors /opt/sqlcmd
  6. sudo postCreateCommand.sh <params> More permanent fix would be to fix how line endings are pulled down for this repo in git settings.