Skip to content

script extension can be either '.sc' or empty string #3802

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

Merged
merged 32 commits into from
Jul 31, 2025

Conversation

philwalk
Copy link
Contributor

File with no extension only considered a script if file has a shebang header.
This is a follow-up to #3794 which passed CI tests but implemented a less restrictive script definition.

A script with a valid shebang header and no extension is recognized as a valid script even when launched from a shell that isn't shebang capable. Consequently, it can be run when directly passed to scala-cli without the shebang command, just like a script with '.sc' extension.

A side-effect of the less restrictive script definition in #3794 is that the wrapper class for a script with .scala extension also has a def scriptPath defined, which is nice. However, without knowing all the potential side-effects of that change, it seems safer to restrict the scope here.

@philwalk philwalk marked this pull request as draft July 24, 2025 20:33
@philwalk philwalk changed the title script extension restricted to be either '.sc' or empty string script extension can be either '.sc' or empty string Jul 27, 2025
@philwalk
Copy link
Contributor Author

@Gedochao - At least some of these test failures are download problems:

download error: Caught java.io.IOException (Server returned HTTP response code: 503 for URL: https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-linux-amd64-22.3.1.tar.gz) while downloading https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-linux-amd64-22.3.1.tar.gz
Run VirtusLab/scala-cli-setup@v1
Install Coursier
Error: Unexpected HTTP response: 503

All but 1 of the 78 failures are passing on my Linux box.
The one failing test is `'sclicheck.GifTests.complete-install' which times out.

Reading the first 2 bytes of a script file to compare against #! is problematic if the file is a pipe or a stream, so it's been disabled when when processing all files in a directory. I'm not quite sure I fully understand that use-case, so I don't know if that will be a problem.

Let me know if I should squash everything to a single commit.

@philwalk philwalk marked this pull request as ready for review July 29, 2025 20:21
Copy link
Contributor

@Gedochao Gedochao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I'll squash the commits when merging, no worries.

…riptTestDefinitions.scala

Co-authored-by: Piotr Chabelski <[email protected]>
@philwalk
Copy link
Contributor Author

The 2 failing tests pass on my aarch64 mac f.w.i.w.

  • 'scala.cli.integration.BspTests213.setup-ide doesn't pass unrecognised arguments to old --cli-versions: 1.5.0-19-g932866db6-SNAPSHOT'
  • 'scala.cli.integration.BspTests213.setup-ide prepares a valid BSP configuration with --cli-version 1.5.0-34-g31a88e428-SNAPSHOT'

@Gedochao
Copy link
Contributor

Suspecting intermittent failures on the CI, irrelevant to this PR...

@Gedochao Gedochao merged commit a4d814b into VirtusLab:main Jul 31, 2025
101 of 110 checks passed
@philwalk philwalk deleted the tune-script-definition branch August 4, 2025 14:43
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

Successfully merging this pull request may close these issues.

2 participants