From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7212 invoked by alias); 19 Aug 2014 08:35:34 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 7198 invoked by uid 89); 19 Aug 2014 08:35:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Aug 2014 08:35:31 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 2FD138E0789; Tue, 19 Aug 2014 10:35:29 +0200 (CEST) Date: Tue, 19 Aug 2014 08:35:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Bash uses lseek while reading from serial device Message-ID: <20140819083529.GL2280@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20140819023953.61416351B0@mail.csclub.uwaterloo.ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qo8f1a4rgWw9S/zY" Content-Disposition: inline In-Reply-To: <20140819023953.61416351B0@mail.csclub.uwaterloo.ca> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2014-08/txt/msg00361.txt.bz2 --Qo8f1a4rgWw9S/zY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1785 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. >=20 > 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". >=20 > 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. >=20 > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --Qo8f1a4rgWw9S/zY Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT8wxRAAoJEPU2Bp2uRE+gcUIP/2ZxAwW8jP/R9ppAmjYXJdef qX87hd5zGvUE8dKGPE66jRHjw4T8dkpu4Li/nX2q5EiSt8I3JoknOVhftqjJkjEG HD9a47H6pCV0SM2QPt9FceeiyAHzVbyHH39xM9cgVQ/8LEvIoSl1TIJLjSHMAXN3 Nolo6tF+hJJ4Zhx/54kCbfXiU7oH4flyQTr2Uvdk36YdzXNdvxQq4AqS3hu6dovv Xe8ivOVYP0Z8rauTa8Gqsqoz6Hp2sXDuzJloX1IjRVSxXlL6Lu44rfk6dj/gUcno BrsjfO/tDkXc7ZJGreoAIUauPW8JDMWKETnFTmpur7zPHhKTaLyFeLIhYuQV2taG 0LY4r4N6zhsUGL9H737jWVJS3P89W55VKZFh7x/L6/puAghB4Y6+637YeFlaX8oL S8QGJ8KWzokqCNMBJFb4rN8r/814CV7CJXsuv6JDHWhqB5I7vtE7zczbXaGMA/H2 GfOlUfx0UJ7anZXZE0wYZeCcF0tIjjUajUaX0BJW19RZNQiZqNj61ZRnh0CxiWe3 B4owaXcYNCBXbMZT8ku6J/3qvoxUkDlj7zm7Br7Xa+msRTJthKN+xCdfX81zI8SI H7dr3zAc7U3METThJlnb3eRWZQs9AMmCmQryPraLm7Rruu2BZ/NqffvvkH6geoQX sHPAAsrRYgXQCfnAPuO2 =ewW7 -----END PGP SIGNATURE----- --Qo8f1a4rgWw9S/zY--