Summary
Several issues encountered when using bashrs for a ground truth comparison script in whisper.apr:
Issue 1: exec() generates shell exec instead of running commands
Expected Behavior
exec("cargo build --release");
Should generate shell that runs the command.
Actual Behavior
Generates:
exec 'cargo build --release'
Which replaces the current shell process instead of running the command.
Workaround
Manual edit of generated script to remove exec wrapper.
Issue 2: Pipe operator detection too aggressive in string literals
Code that fails
echo("| whisper.apr | whisper.cpp | HuggingFace |");
Error
error: Validation error: Pipe operator detected in string literal
Expected
Pipes inside string literals should be allowed - they're not shell pipes, just characters.
Issue 3: capture() with pipes fails build
Code that fails (from examples/safety/injection_prevention.rs)
let count = capture("ls /tmp | wc -l");
Error
error: AST validation error: Unsupported expression type
Expected
The capture() function should handle commands with pipes since that's a common shell pattern.
Issue 4: Several examples don't build
$ bashrs build examples/basic/functions.rs -o /tmp/test.sh
error: AST validation error: Only functions are allowed in Rash code
The #[bashrs::main] attribute and #[cfg(test)] modules cause build failures.
Environment
- bashrs version: 6.43.0
- OS: Linux 6.8.0-87-generic
Suggested Improvements
- exec() should translate to
eval or direct command execution, not shell exec
- String literal validation should not flag
| inside quotes
- capture() should support piped commands
- Examples should all be buildable with
bashrs build
Reproduction
#[bashrs::main]
fn main() {
echo("|table|header|"); // Fails: pipe detected
exec("ls -la"); // Wrong: generates shell exec
let x = capture("ls | wc -l"); // Fails: unsupported
}
🤖 Generated with Claude Code
Summary
Several issues encountered when using bashrs for a ground truth comparison script in whisper.apr:
Issue 1:
exec()generates shellexecinstead of running commandsExpected Behavior
Should generate shell that runs the command.
Actual Behavior
Generates:
Which replaces the current shell process instead of running the command.
Workaround
Manual edit of generated script to remove
execwrapper.Issue 2: Pipe operator detection too aggressive in string literals
Code that fails
Error
Expected
Pipes inside string literals should be allowed - they're not shell pipes, just characters.
Issue 3: capture() with pipes fails build
Code that fails (from examples/safety/injection_prevention.rs)
Error
Expected
The
capture()function should handle commands with pipes since that's a common shell pattern.Issue 4: Several examples don't build
$ bashrs build examples/basic/functions.rs -o /tmp/test.sh error: AST validation error: Only functions are allowed in Rash codeThe
#[bashrs::main]attribute and#[cfg(test)]modules cause build failures.Environment
Suggested Improvements
evalor direct command execution, not shellexec|inside quotesbashrs buildReproduction
🤖 Generated with Claude Code