St_size does not give a useful value for pipes:
root@devstack:/opt/stack/devstack/files# python -c 'import os; print os.fstat(0)' </etc/hostname posix.stat_result(st_mode=33188, st_ino=99893, st_dev=51713L, st_nlink=1, st_uid=0, st_gid=0, st_size=9, st_atime=1370096199, st_mtime=1370096199, st_ctime=1370096199)
root@devstack:/opt/stack/devstack/files# python -c 'import os; print os.fstat(0)' <(cat /etc/hostname) posix.stat_result(st_mode=8576, st_ino=26, st_dev=11L, st_nlink=1, st_uid=0, st_gid=5, st_size=0, st_atime=1370264462, st_mtime=1370264462, st_ctime=1370249304)
The test for this didn't pick this up as it read from a file rather than a pipe: https://github.com/openstack/python-glanceclient/blob/master/tests/v1/test_shell.py#L401-L426.
Will add another test involving reading from a pipe, and backout the st_size check.
St_size does not give a useful value for pipes:
root@devstack: /opt/stack/ devstack/ files# python -c 'import os; print os.fstat(0)' </etc/hostname result( st_mode= 33188, st_ino=99893, st_dev=51713L, st_nlink=1, st_uid=0, st_gid=0, st_size=9, st_atime= 1370096199, st_mtime= 1370096199, st_ctime= 1370096199)
posix.stat_
root@devstack: /opt/stack/ devstack/ files# python -c 'import os; print os.fstat(0)' <(cat /etc/hostname) result( st_mode= 8576, st_ino=26, st_dev=11L, st_nlink=1, st_uid=0, st_gid=5, st_size=0, st_atime= 1370264462, st_mtime= 1370264462, st_ctime= 1370249304)
posix.stat_
The test for this didn't pick this up as it read from a file rather than a pipe: https:/ /github. com/openstack/ python- glanceclient/ blob/master/ tests/v1/ test_shell. py#L401- L426.
Will add another test involving reading from a pipe, and backout the st_size check.