Skip to content

Commit

Permalink
Fix stdin handling when getting version number from benchmarked tool
Browse files Browse the repository at this point in the history
In the function that most tool-info modules use
for getting the version number from the tool,
we did not specify what stdin of the tool should be.
The unfortunate default for this is the same as stdin
of the calling tool, i.e., BenchExec.
This means that if a tool would read from stdin
while we call it to get its version,
it would either hang due to no input
or even read from what the user attempted to pass to BenchExec.
Both is not good and this happened in sosy-lab#1045.

Now we explicitly specify /dev/null as stdin,
such that when attempting to read the tool just gets EOF.
We also use /dev/null for stdin by default for the actual tool execution
since 564f18f (BenchExec 0.5), so I do not expect any problems.
Tools who do not read from stdin are not affected,
and for tools who do read it is just an improvement
that they get EOF instead of waiting for input.
  • Loading branch information
PhilippWendler authored and Po-Chun-Chien committed Jun 7, 2024
1 parent 93f23d5 commit bf74d32
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions benchexec/tools/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def _version_from_tool(
[executable, arg],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.DEVNULL,
universal_newlines=True,
)
except OSError as e:
Expand Down

0 comments on commit bf74d32

Please sign in to comment.