X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 691463858402
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=maxrnd.com
Authentication-Results: sourceware.org; spf=none smtp.mailfrom=maxrnd.com
Subject: Re: qt terminal for gnuplot on cygwin workaround)
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
References: <1001697724.215333.1639890003868.JavaMail.yahoo.ref@mail.yahoo.co.jp>
 <1001697724.215333.1639890003868.JavaMail.yahoo@mail.yahoo.co.jp>
From: Mark Geisert <mark@maxrnd.com>
Message-ID: <814adaab-12b9-8d9d-3a0b-4921dc1ba122@maxrnd.com>
Date: Sun, 9 Jan 2022 22:35:46 -0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Firefox/52.0 SeaMonkey/2.49.4
MIME-Version: 1.0
In-Reply-To: <1001697724.215333.1639890003868.JavaMail.yahoo@mail.yahoo.co.jp>
X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
 KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE,
 TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

Hi Tatsuro,

Tatsuro MATSUOKA wrote:
> A workaround for qt enables qt termnal on Cygwin is shown by  Enrico Forestieri
> https://sourceforge.net/p/gnuplot/mailman/gnuplot-beta/thread/16092.81463.qm@web103110.mail.kks.yahoo.co.jp/
> 
> --- a/qtbase-everywhere-src-5.10.1/src/network/socket/qlocalsocket_unix.cpp
> +++ b/qtbase-everywhere-src-5.10.1/src/network/socket/qlocalsocket_unix.cpp
> @@ -239,7 +239,7 @@ void QLocalSocket::connectToServer(OpenM
>       }
> 
>       // create the socket
> -    if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0,
> O_NONBLOCK))) {
> +    if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM,
> 0))) {
>           d->errorOccurred(UnsupportedSocketOperationError,
>                          
> QLatin1String("QLocalSocket::connectToServer"));
>           return;
> 
> I myself generate library libQt5Network as libQt5Network-gnuplot and used gnuplot  build.
> I dp not know that the modification avove is valid but enables me to use qt terminal on cygwin.

Apologies for the late response.  As quoted above, the patch changes the number of 
args passed to qt_safe_socket() so maybe that's incorrect?

In any case I think the intent was to change the call from nonblocking to 
blocking.  That seems likely to interfere with other socket or terminal I/O that 
may be expected asynchronously.

I investigated the gnuplot vs Qterm problem several years ago and found the root 
cause: deep within the Qt networking code a call to connect() wasn't expecting the 
error EINPROGRESS to be returned.  POSIX decrees this error when a nonblocking 
connect() cannot immediately be completed.  I opened a Qt BUG for this, but the Qt 
folks declined to fix.  I then tried making a Cygwin-only patch but was stymied by 
my inability to build Qt itself due to bit rot.

If we have or can get a recent Qt build completed, I can supply a patch to fix the 
issue.

..mark

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
