Add rbash test#104
Conversation
🤖 Augment PR SummarySummary: Adds an rbash-focused regression test to the bashport stable patch set. Changes:
Technical Notes: The new test primarily validates restrictions by checking non-zero exit codes from 🤖 Was this summary useful? React with 👍 or 👎 |
| + echo "Testing: $test_name" | ||
| + | ||
| + # Run command in rbash and capture exit code | ||
| + rbash -c "$command" 2>/dev/null |
There was a problem hiding this comment.
stable-patches/tests/rbash_test.patch:29: rbash is invoked by name, which may resolve to a system-installed rbash (or be missing) during make check, making the test non-hermetic. Consider invoking the just-built shell in restricted mode (e.g., via ${THIS_SH}) so the test validates the ported binary.
Severity: medium
Other Locations
stable-patches/tests/rbash_test.patch:69
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| +} | ||
| + | ||
| +# Test 1: Cannot change directory | ||
| +test_restriction "cd restriction" "cd /tmp" |
There was a problem hiding this comment.
stable-patches/tests/rbash_test.patch:44: Using hardcoded paths like /tmp and /bin/ls can make the restriction checks pass/fail for environmental reasons (missing directory/binary, permissions) rather than because the restriction is enforced. That can reduce the test’s ability to catch regressions.
Severity: medium
Other Locations
stable-patches/tests/rbash_test.patch:50stable-patches/tests/rbash_test.patch:53stable-patches/tests/rbash_test.patch:62stable-patches/tests/rbash_test.patch:65
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| + â PASS: Command properly restricted (exit code: 1) | ||
| + | ||
| +Testing: command with / | ||
| + â PASS: Command properly restricted (exit code: 127) |
There was a problem hiding this comment.
stable-patches/tests/rbash_test.patch:108: rbash.right expects a specific exit code (127) for the slash-in-command-name restriction, but that status can vary between bash versions/ports for the same restriction. Locking the exact code here could make the test flaky across environments.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| + | ||
| + # For restricted operations, we expect non-zero exit code | ||
| + if [ $exit_code -ne 0 ]; then | ||
| + echo " â PASS: Command properly restricted (exit code: $exit_code)" |
There was a problem hiding this comment.
stable-patches/tests/rbash_test.patch:34: The ✓/✗ Unicode markers in .tests/.right may not round-trip cleanly in environments that do ASCII↔EBCDIC conversion, leading to diffs even when behavior is correct. If z/OS builds run through such conversions, this could create false failures.
Severity: low
Other Locations
stable-patches/tests/rbash_test.patch:37stable-patches/tests/rbash_test.patch:71stable-patches/tests/rbash_test.patch:74stable-patches/tests/rbash_test.patch:87stable-patches/tests/rbash_test.patch:90stable-patches/tests/rbash_test.patch:102stable-patches/tests/rbash_test.patch:108stable-patches/tests/rbash_test.patch:114stable-patches/tests/rbash_test.patch:117stable-patches/tests/rbash_test.patch:120stable-patches/tests/rbash_test.patch:123stable-patches/tests/rbash_test.patch:126stable-patches/tests/rbash_test.patch:133
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| tests/quotearray3.sub f | ||
| tests/quotearray4.sub f | ||
| tests/quotearray5.sub f | ||
| +tests/rbash.tests f |
There was a problem hiding this comment.
stable-patches/MANIFEST.patch:9: The new MANIFEST entries use spaces before the f flag while surrounding entries are tab-delimited; if any tooling expects the exact tab format, these files might not be picked up. Worth matching the existing delimiter to avoid subtle packaging/test-list issues.
Severity: low
Other Locations
stable-patches/MANIFEST.patch:10stable-patches/MANIFEST.patch:18
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| + | ||
| + # For restricted operations, we expect non-zero exit code | ||
| + if [ $exit_code -ne 0 ]; then | ||
| + echo " â PASS: Command properly restricted (exit code: $exit_code)" |
There was a problem hiding this comment.
Just check on these characters in echo statements!
Augment has stated it in detail
Signed-off-by: sabi789 <sabithac6298@gmail.com>
Signed-off-by: sabi789 <sabithac6298@gmail.com>
Add rbash Test