New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qvm-run -p should redirect stdin and stdout separately #3074

Closed
3hhh opened this Issue Sep 2, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@3hhh

3hhh commented Sep 2, 2017

Every call to qvm-run -p redirects both stdin and stdout.

Especially stdin is usually not necessary and may lead to unexpected behavior or even unexpected leaks from dom0 code.

Simple example:

#!/bin/bash

list="super"$'\n'"secret"

while IFS= read -r item ; do
        echo "item: $item"
        qvm-run -p -u root sys-usb "true"
done <<< "$list"

This will break after the first run and make qvm-run read the entire list during the first iteration (I'm not sure whether it is actually passed to sys-usb?). It works without -p.

I'd recommend to introduce different flags for stdin and stdout or at least support a flag to disable the stdin redirect (ssh e.g. uses -n).

Similar issue with ssh: https://stackoverflow.com/questions/346445/bash-while-read-loop-breaking-early

Affects both 3.2 and 4.0rc1.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Sep 2, 2017

Member

If you don't want either stdin or stdout, use standard shell features: </dev/null or >/dev/null.

Member

marmarek commented Sep 2, 2017

If you don't want either stdin or stdout, use standard shell features: </dev/null or >/dev/null.

@marmarek marmarek closed this Sep 2, 2017

@3hhh

This comment has been minimized.

Show comment
Hide comment
@3hhh

3hhh Sep 7, 2017

True, but that makes e.g. bash aliases impossible.

In general I'd also recommend to opt-in to functionality rather than having to opt-out, but well...

3hhh commented Sep 7, 2017

True, but that makes e.g. bash aliases impossible.

In general I'd also recommend to opt-in to functionality rather than having to opt-out, but well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment