summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/loader/interpreter.go2
-rw-r--r--test/syscalls/linux/exec.cc13
2 files changed, 6 insertions, 9 deletions
diff --git a/pkg/sentry/loader/interpreter.go b/pkg/sentry/loader/interpreter.go
index 3886b4d33..3e302d92c 100644
--- a/pkg/sentry/loader/interpreter.go
+++ b/pkg/sentry/loader/interpreter.go
@@ -59,7 +59,7 @@ func parseInterpreterScript(ctx context.Context, filename string, f fsbridge.Fil
// Linux silently truncates the remainder of the line if it exceeds
// interpMaxLineLength.
i := bytes.IndexByte(line, '\n')
- if i > 0 {
+ if i >= 0 {
line = line[:i]
}
diff --git a/test/syscalls/linux/exec.cc b/test/syscalls/linux/exec.cc
index e0f3779a2..4df429ed8 100644
--- a/test/syscalls/linux/exec.cc
+++ b/test/syscalls/linux/exec.cc
@@ -278,15 +278,12 @@ TEST(ExecTest, InterpreterScriptArgNUL) {
// Trailing whitespace following interpreter path is ignored.
TEST(ExecTest, InterpreterScriptTrailingWhitespace) {
- // FIXME(b/190850365): This test case fails on Linux.
- SKIP_IF(!IsRunningOnGvisor());
-
// Symlink through /tmp to ensure the path is short enough.
TempPath link = ASSERT_NO_ERRNO_AND_VALUE(
TempPath::CreateSymlinkTo("/tmp", RunfilePath(kBasicWorkload)));
TempPath script = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFileWith(
- GetAbsoluteTestTmpdir(), absl::StrCat("#!", link.path(), " "), 0755));
+ GetAbsoluteTestTmpdir(), absl::StrCat("#!", link.path(), " \n"), 0755));
CheckExec(script.path(), {script.path()}, {}, ArgEnvExitStatus(1, 0),
absl::StrCat(link.path(), "\n", script.path(), "\n"));
@@ -306,11 +303,11 @@ TEST(ExecTest, InterpreterScriptArgWhitespace) {
}
TEST(ExecTest, InterpreterScriptNoPath) {
- // FIXME(b/190850365): This test case fails on Linux.
- SKIP_IF(!IsRunningOnGvisor());
-
TempPath script = ASSERT_NO_ERRNO_AND_VALUE(
- TempPath::CreateFileWith(GetAbsoluteTestTmpdir(), "#!", 0755));
+ TempPath::CreateFileWith(GetAbsoluteTestTmpdir(), "#!\n\n", 0755));
+
+ std::cerr << "path: " << script.path() << std::endl;
+ std::cerr << system(absl::StrCat("cat ", script.path()).c_str()) << std::endl;
int execve_errno;
ASSERT_NO_ERRNO_AND_VALUE(