ismlsmile / parallel-ssh

Automatically exported from code.google.com/p/parallel-ssh
Other
0 stars 0 forks source link

reading from standard input is broken #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It turns out that reading from standard input (as currently implemented) 
only works under certain lucky situations.  It uses non-blocking mode, so 
the input will be truncated if reading blocks for any reason.  It's a 
silent loss of data, so it's kind of a scary bug.  Here's how to reproduce 
it:

cat some_big_file |bin/pssh -i -H localhost "cat >test_file"

In theory, this should make test_file identical to some_big_file.  However, 
since pssh has to read from a pipe from cat, it will usually block at some 
point (particularly if the file is big).

I'm concerned about how to fix this without breaking backwards 
compatibility.  Unfortunately, the current syntax tries to automatically 
detect whether input is available, but this isn't easy to do (if there's a 
delay in reading the input, is it really safe to assume that it won't be 
arriving shortly?).  There are some ways to reduce the severity of the bug, 
but I think that there isn't any way to really fix it without requiring the 
user to specify that they are passing input.

I'm inclined to add a new explicit command-line option (perhaps "-I") to 
indicate that pssh should read from standard input.  If we went this route, 
we could deprecate the current approach; for a few versions, we could 
continue to honor input but give an error message warning that the behavior 
is deprecated.  Any thoughts?

Original issue reported on code.google.com by amcna...@gmail.com on 19 Feb 2010 at 3:14

GoogleCodeExporter commented 9 years ago

Original comment by amcna...@gmail.com on 19 Feb 2010 at 3:14

GoogleCodeExporter commented 9 years ago
I have implemented the behavior described above.  The "-I" option makes pssh 
read from 
standard input.  If pssh reads from standard input without the "-I" option 
being 
given, it prints a deprecation warning.

Original comment by amcna...@gmail.com on 22 Feb 2010 at 11:25

GoogleCodeExporter commented 9 years ago
I haven't heard any complaints over the last week, so for now I'll assume that 
everyone is happy.  Please reopen the bug report if you have any problems.

Original comment by amcna...@gmail.com on 24 Feb 2010 at 7:11