X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:date:to:subject:message-id; q=dns; s= default; b=eXI3p5cSrz2viRG3w4mqm16BoYheZS3YoQc6hsBZx8Tl+FZRKI7md AAXjmB0jj/MwR/oiLlUtFnm6UBE9ZcLM7T+7oU36Wnesr/p0edD1s+J2/FZni3jQ KH1WuIPfuMMSLc77jHcEzHgiB0K9Ye/kOimyclQc4IGB3T9Vb32M9s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:date:to:subject:message-id; s=default; bh=QvTm004oYe1Kpdn16NJVttUPbxc=; b=ODtJeb+1XKebgkEM4iDYVBqeB8R3 XflbBwzsSkzXu5gy6905Id7xKIgRbDRYv+eFO6HmxBmkRcouwSL2cYDcpuQ9kKcT RWgA4lp8FzIPW8Huwnh3ELdPb8Z7D5Uf25zLPItk4Xay0LxG180dsedssoGQcwnO lag6QYsOQwJ4fjw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_05,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail.csclub.uwaterloo.ca From: "Ross Ridge" Date: Mon, 18 Aug 2014 22:39:53 -0400 To: cygwin AT cygwin DOT com Subject: Re: Bash uses lseek while reading from serial device Message-Id: <20140819023953.61416351B0@mail.csclub.uwaterloo.ca> 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. > 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. Ross Ridge -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple