From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.codeweavers.com (mail.codeweavers.com [65.103.31.132]) by sourceware.org (Postfix) with ESMTPS id 18380385843A for ; Wed, 21 Dec 2022 17:38:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18380385843A Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=codeweavers.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=codeweavers.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=6377696661; h=In-Reply-To:From:Cc:Subject:References:To: MIME-Version:Date:Message-ID:Content-Type:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HMgqmRKsIAu0xfXlb9GwymDGG+YVXyf8yqma+g7dbsg=; b=jQWlagKOGV2dMTGwLPIeRmo3AT GyeoP8qtmNmAZMhT+7cVxkl5fzGTGKPnhREP4bKRSwyHbFxXYsAFNiTbPBXxqKBjx11z6fpKctPt/ xzbZW7ZuHckgxiNakArzMWf+Ut/TUc9XIAWrkMD+tMQi6mfc60062nwEtpgoeP9TFyrc=; Received: from cw141ip133.vpn.codeweavers.com ([10.69.141.133]) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1p8336-00GlRL-2x; Wed, 21 Dec 2022 11:38:37 -0600 Content-Type: multipart/mixed; boundary="------------egzS5lFSWUaQe29VRVzMcAPt" Message-ID: <7cb45ab2-cc6e-c502-5592-51ffabcbc6f8@codeweavers.com> Date: Wed, 21 Dec 2022 18:37:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 To: jcb62281@gmail.com, fortran@gcc.gnu.org, NightStrike References: <639FE88D.7090408@gmail.com> Subject: Re: testsuite under wine Content-Language: en-GB Cc: Eric Pouech From: Jacek Caban In-Reply-To: <639FE88D.7090408@gmail.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multi-part message in MIME format. --------------egzS5lFSWUaQe29VRVzMcAPt Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi all, I'm responsible for Wine changes that cause your problems. I'm also CCing Eric, who is Wine console expert, maybe he has better ideas. Eric, see [1] if you're interested in the context. Recent Wine versions implement Windows pseudo-consoles, see [2] for a bit more details. It's generally Microsoft's semi-recent API that's intended to be more compatible with POSIX than what was present in previous versions of Windows. In theory, with that implemented, we could just plug tty fds that we get from Unix and have Unix consoles working using those Windows APIs. In practice, it's not quite as good as promised and we need some tweaks to make it work nicely. We could improve those tweaks, but there are architectural limitations that will come to play sooner or later. > I think that the long-term solution is that Wine should properly honor > the TERM environment variable and not produce escape codes that the > declared terminal does not support. I think that it would not be enough. The way Windows consoles work is that we manage complete internal screen buffer and emit output that synchronizes the buffer with Unix terminal inside conhost.exe process. It means that its output heavily processed and may be very different from what application writes to its console handle. While escape codes discussed in this thread are the most prominent difference (and that part could, in theory, be improved on our side), there are more differences. For example, if application writes "\rA\rB\rC", conhost will process it, update its internal buffer which changes just one character and cursor position, and emit sequence to update it in Unix terminal, which could be just "\rC" (or even "C" if cursor was already at the beginning of the line). Another example would be long lines: conhost will emit additional EOLs instead of depending on embedder to wrap the line. I'm not really familiar with DejaGnu, but if you want to match application output, that's probably not what you're looking for. The reason the previous workaround of compiling Wine without ncurses worked is that if made Wine treat tty stdin/stdout in a way very similar to regular pipes, so no extra processing was performed. This was more of a side effect than a design choice. It should be possible to provide some way to achieve that with the new Wine architecture. I'm attaching an example of Wine patch that would allow it. With that patch, you may disable conhost.exe (via winecfg or WINEDLLOVERRIDES=conhost.exe=d environment variable) and achieve something similar to previous workaround. Long term, I think that it would be best to get rid of console behaviour expectations by using Windows build of DejaGnu. My understanding is that it requires Cygwin, so the stack would be: Windows DejaGnu on Cygwin on Wine on Linux. This would make all similar mismatches in expectations non-existent. Cygwin is tricky to run on Wine, there are a few known problems like [3], but we're getting there. Jacek [1] https://gcc.gnu.org/pipermail/fortran/2022-December/058645.html [2] https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/ [3] https://bugs.winehq.org/show_bug.cgi?id=47808 --------------egzS5lFSWUaQe29VRVzMcAPt Content-Type: text/x-patch; charset=UTF-8; name="console.diff" Content-Disposition: attachment; filename="console.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2RsbHMva2VybmVsYmFzZS9jb25zb2xlLmMgYi9kbGxzL2tlcm5lbGJh c2UvY29uc29sZS5jCmluZGV4IDdjZDg3ZjUzYjNjLi42MTU2OWZkYTlhNiAxMDA2NDQKLS0t IGEvZGxscy9rZXJuZWxiYXNlL2NvbnNvbGUuYworKysgYi9kbGxzL2tlcm5lbGJhc2UvY29u c29sZS5jCkBAIC0yMzA3LDMzICsyMzA3LDQ1IEBAIHZvaWQgaW5pdF9jb25zb2xlKCB2b2lk ICkKICAgICAgICAgQ09PUkQgc2l6ZTsKIAogICAgICAgICBpZiAoaXNfdHR5X2hhbmRsZSgg cGFyYW1zLT5oU3RkSW5wdXQgKSkKLSAgICAgICAgewogICAgICAgICAgICAgdHR5X2luID0g cGFyYW1zLT5oU3RkSW5wdXQ7Ci0gICAgICAgICAgICBwYXJhbXMtPmhTdGRJbnB1dCA9IE5V TEw7Ci0gICAgICAgIH0KICAgICAgICAgaWYgKGlzX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tPkNv bnNvbGVIYW5kbGUgJiYgY3JlYXRlX2NvbnNvbGVfY29ubmVjdGlvbiggcGFyYW1zLT5Db25z b2xlSGFuZGxlICkpCisgICAgICAgIGlmIChwYXJhbXMtPkNvbnNvbGVIYW5kbGUpCisgICAg ICAgIHsKKyAgICAgICAgICAgIENsb3NlSGFuZGxlKCBwcm9jZXNzICk7CisKKyAgICAgICAg ICAgIGlmIChpc190dHlfaGFuZGxlKCBwYXJhbXMtPmhTdGRJbnB1dCApKQorICAgICAgICAg ICAgeworICAgICAgICAgICAgICAgIENsb3NlSGFuZGxlKCBwYXJhbXMtPmhTdGRJbnB1dCAp OworICAgICAgICAgICAgICAgIHBhcmFtcy0+aFN0ZElucHV0ID0gTlVMTDsKKyAgICAgICAg ICAgIH0KKyAgICAgICAgICAgIGlmIChpc190dHlfaGFuZGxlKCBwYXJhbXMtPmhTdGRPdXRw dXQgKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDbG9zZUhhbmRsZSggcGFy YW1zLT5oU3RkT3V0cHV0ICk7CisgICAgICAgICAgICAgICAgcGFyYW1zLT5oU3RkT3V0cHV0 ID0gTlVMTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpc190dHlfaGFuZGxl KCBwYXJhbXMtPmhTdGRFcnJvciApKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAg IENsb3NlSGFuZGxlKCBwYXJhbXMtPmhTdGRFcnJvciApOworICAgICAgICAgICAgICAgIHBh cmFtcy0+aFN0ZEVycm9yID0gTlVMTDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAg aWYgKHBhcmFtcy0+Q29uc29sZUhhbmRsZSAmJiBjcmVhdGVfY29uc29sZV9jb25uZWN0aW9u KCBwYXJhbXMtPkNvbnNvbGVIYW5kbGUgKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAg ICAgICBpbml0X2NvbnNvbGVfc3RkX2hhbmRsZXMoIEZBTFNFICk7CisgICAgICAgICAgICB9 CisgICAgICAgIH0KKyAgICAgICAgZWxzZQogICAgICAgICB7Ci0gICAgICAgICAgICBpbml0 X2NvbnNvbGVfc3RkX2hhbmRsZXMoIEZBTFNFICk7CisgICAgICAgICAgICBXQVJOKCAiRmFp bGVkIHRvIGNyZWF0ZSBjb25zb2xlIHByb2Nlc3NcbiIgKTsKKyAgICAgICAgICAgIHBhcmFt cy0+Q29uc29sZUhhbmRsZSA9IENPTlNPTEVfSEFORExFX1NIRUxMX05PX1dJTkRPVzsKICAg ICAgICAgfQogICAgIH0KICAgICBlbHNlIGlmIChwYXJhbXMtPkNvbnNvbGVIYW5kbGUgPT0g Q09OU09MRV9IQU5ETEVfQUxMT0MgfHwK --------------egzS5lFSWUaQe29VRVzMcAPt--