From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Bash uses lseek while reading from serial device
Date: Tue, 19 Aug 2014 08:35:00 -0000 [thread overview]
Message-ID: <20140819083529.GL2280@calimero.vinschen.de> (raw)
In-Reply-To: <20140819023953.61416351B0@mail.csclub.uwaterloo.ca>
[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]
On Aug 18 22:39, Ross Ridge wrote:
> Corinna Vinschen writes:
> > On Linux isatty on a descriptor connected to serial line returns 0,
> > on Cygwin it returned 1 so far. I fixed both problems here, isatty
> > on a serial line returns 0 now, and lseek on serial (and, FWIW,
> > sockets) don't simply return 0 anymore, but rather -1 with errno set
> > to ESPIPE, as on Linux.
>
> I'm not sure if Chet Ramey's suggestion that if isatty() returns 1
> then bash is allowed to assume reads are newline-delimited is correct.
> On Unix this would only be true if cannonical mode input processing was
> enabled (icanon), and Cygwin stty reports that this mode is disabled
> (-icanon) on serial devices. Or at least it used to, with the snapshot
> DLL it now complains "/dev/ttyS0: Inappropriate ioctl for device".
>
> For what its worth my tests on Linux shows that isatty() returns 1 on
> a serial device, namely /dev/ttyS0. Which is what I would expect given
> that serial devices have traditionally been synonymous with ttys on Unix.
I reverted this part of the patch. My test was flawed. The problem is
that on Linux, /dev/ttyS[0-3] exists even if they are not backed by
hardware. In this case, as is on my local machine, isatty returns 0.
However, if there's a device connected to /dev/ttySx, isatty returns 1.
So I just applied a patch which reverts the isatty status to /dev/ttySx
and thus, stty works as before.
> > Ross, please give it a try.
>
> The snapshot DLL solves the bug and the script runs without any data
> being lost. Thanks for looking into this.
Thanks for testing and discussing this problem.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-08-19 8:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 2:40 Ross Ridge
2014-08-19 8:35 ` Corinna Vinschen [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-08-16 18:47 Ross Ridge
2014-08-17 22:19 ` Linda Walsh
2014-08-18 11:21 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140819083529.GL2280@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).