This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /dev/tty does not work from shell


On 02/10/2015 09:46 AM, Helmut Karlowski wrote:
>> The same test from the command line:
>>
>> $ stat -c %i /dev/tty - 0>/dev/tty
>> 327680
>> 8912896
>>
>> use any other (already-existing) file to see that the two numbers should
>> normally be the same.
> 
> Don't know why, but cygwin is not the only OS that does that. I'd 
> suggest to check for terminal or something.

Umm, what other OS changes the inode from what you called stat() on to
what you open()d?  Okay, there are some special device files like
/dev/ptmx that intentionally create a new device (and therefore new
inode) every time it is opened, but is /dev/tty in that boat?  POSIX
requires /dev/tty to resolve to the process's controlling terminal.

If there _are_ other OS that change the inode of the fd returned by
opening /dev/tty, that argues that any change in bash to special-case
/dev/tty should be made upstream, so I'm reluctant to write a
cygwin-specific bash patch.  If there aren't other OS that change the
inode of /dev/tty, then it's better to figure out how to patch
cygwin1.dll to be more like Linux.

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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]