Skip to content

Add checks for test.sh existence and executable permissions in build command.#4

Closed
rohitpaulk wants to merge 1 commit into
mainfrom
add-checks-test.sh-existence-executable-permissions
Closed

Add checks for test.sh existence and executable permissions in build command.#4
rohitpaulk wants to merge 1 commit into
mainfrom
add-checks-test.sh-existence-executable-permissions

Conversation

@rohitpaulk

@rohitpaulk rohitpaulk commented Dec 17, 2025

Copy link
Copy Markdown
Member

Note

Adds early checks ensuring testerDir/test.sh exists and is executable, with clear failure messages.

  • Build command (builder/internal/commands/build_image_command.go):
    • Validate testerDir/test.sh exists; return error if missing.
    • Check test.sh is executable; return error if not.
    • Handle and surface errors from stat on test.sh with detailed messages.

Written by Cursor Bugbot for commit 8bc68f6. This will update automatically on new commits. Configure here.

}
if fileInfo.Mode()&0111 == 0 {
return handleErrorDuringBuild(build, "", fmt.Errorf("test.sh is not executable in tester dir (%s)", testerDir))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Missing check that test.sh is a regular file

The validation checks existence and executable permissions but doesn't verify that test.sh is a regular file. If test.sh is a directory (which typically has execute bits set for traversal), the check fileInfo.Mode()&0111 == 0 passes, but attempting to execute it as a script later will fail. Adding a check like fileInfo.Mode().IsRegular() would catch this case and provide a clearer error message upfront.

Fix in Cursor Fix in Web

@rohitpaulk rohitpaulk closed this Dec 17, 2025
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.

1 participant