Description of problem: cat <<EOF | guestfish --remote upload - /tmp/somefile hello EOF Instead of uploading "hello" to /tmp/somefile, it just hangs when executed in a script. If I do the same interactively, I get "libguestfs: error: read: /dev/stdin: Input/output error". Looking a bit with strace, I see that the guestfish server process is trying to read from stdin which is the running terminal: accept4(4, 0, NULL, SOCK_CLOEXEC) = 5 recvmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"\0", 1}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {6}}, msg_flags=0}, 0) = 1 dup2(6, 1) = 1 close(6) = 0 fcntl(5, F_GETFL) = 0x2 (flags O_RDWR) fstat(5, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffc57828000 lseek(5, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) read(5, "\0\0\0\0061.26.9\0\0\0\0\0\6upload\0\0\0\0\0\2\0\0\0\1"..., 4096) = 84 stat("/dev/stdin", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 9), ...}) = 0 mmap(NULL, 4198400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffc50a78000 mremap(0x7ffc50a78000, 4198400, 4096, MREMAP_MAYMOVE) = 0x7ffc50a78000 poll([{fd=8, events=POLLIN}], 1, 0) = 0 (Timeout) poll([{fd=8, events=POLLOUT}, {fd=7, events=POLLIN}], 2, 4294967295) = 1 ([{fd=8, revents=POLLOUT}]) write(8, "\0\0\0T \0\365\365\0\0\0\4\0\0\0B\0\0\0\0\0\0224\1\0\0\0\0\0\0\0\0"..., 88) = 88 munmap(0x7ffc50a78000, 4096) = 0 open("/dev/stdin", O_RDONLY|O_CLOEXEC) = 6 fadvise64(6, 0, 0, POSIX_FADV_SEQUENTIAL) = 0 read(6, So, it doesn't read from the right spot. Version-Release number of selected component (if applicable): 1.26.9-3 (from Debian unstable)
The guestfish --listen/--remote options just send commands over a Unix domain socket. Since everything is on the same machine, you can just write what you want to upload to a temporary file, and then send the temporary filename over the socket. ie this should work instead: f=`mktemp` cat > $f <<EOF hello EOF guestfish --remote upload $f /tmp/somefile It would be possible to implement the same thing behind the scenes, by modifying fish/fish.c:file_in() and probably not a huge amount of work.
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.
Reopening because Virtualization Tools has not been discontinued.