/dev/stderr problem

Eric Blake eblake@redhat.com
Mon Oct 17 18:11:00 GMT 2016


On 10/17/2016 01:32 AM, Thorsten Kampe wrote:
> * Thorsten Kampe (Mon, 17 Oct 2016 08:25:13 +0200)
> 
>> the following bash script results in a different output when 
>> redirected to a file.
>>
>> ```
>> printf "FIRST LINE\n" > /dev/stderr
>> shopt -os xtrace
>> printf "SECOMD LINE\n" > /dev/stderr

Cygwin treats '> /dev/stderr' as a request to truncate /dev/stderr (or,
for that matter, any opening of a file under /proc/self/fd).  Other
platforms treat that as a special file that can never be truncated, but
is instead reopened at the same offset.

Maybe cygwin can be taught that opening a file through /proc/self/fd
should preserve rather than reset offsets, but it will be a tricky
patch, and someone has to write it.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20161017/c5da16ab/attachment.sig>


More information about the Cygwin mailing list