public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Pouech <eric.pouech@orange.fr>
To: NightStrike <nightstrike@gmail.com>, jcb62281@gmail.com
Cc: Jacek Caban <jacek@codeweavers.com>,
	fortran@gcc.gnu.org, "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	dejagnu@gnu.org
Subject: Re: testsuite under wine
Date: Fri, 23 Dec 2022 13:43:04 +0100	[thread overview]
Message-ID: <d74c475e-9f9d-c46c-21bf-b4b13a013739@orange.fr> (raw)
In-Reply-To: <CAF1jjLtyiZtm_CUT7x_qMbPYyGoSF=DGSLjKe1CaUWMvabsFOQ@mail.gmail.com>

Le 23/12/2022 à 11:36, NightStrike a écrit :
> On Wed, Dec 21, 2022 at 11:37 PM Jacob Bachmeyer <jcb62281@gmail.com> wrote:
>> NightStrike wrote:
>>> [...]
>>> Second, the problems with extra \r's still remain, but I think we've
>>> generally come to think that that part isn't Wine and is instead
>>> either the testsuite or deja.  So I'll keep those replies to Jacob's
>>> previous message.
>>>
>> Most likely, it is a combination of the MinGW libc (which emits "\r\n"
>> for end-of-line in accordance with Windows convention) and the kernel
>> terminal driver (which passes "\r" and translates "\n" to "\r\n" in
>> accordance with POSIX convention).  Wine, short of trying to translate
>> "\r\n" back to "\n" in accordance with POSIX conventions (and likely
>> making an even bigger mess---does Wine know if a handle is supposed to
>> be text or binary?) cannot really fix this, so the testsuite needs to
>> handle non-POSIX-standard line endings.  (The Rust tests probably have
>> an outright bug if the newlines are being duplicated.)
> You may be onto something here.  I ran wine under script as `script -c
> "wine64 ./a.exe" out` (thanks, Arsen!), and it had the same extra \r
> prepended to the \r\n.  I was making the mistake previously of running
> wine manually and capturing it to a file as `wine64 ./a.exe > out`,
> which as several have pointed out in this thread, that would disable
> the quirk, so of course it didn't reveal any problems.  I'm behind,
> but I'll catch up to you guys eventually :)
>
> So at least we know for sure that this particular instance of extra
> characters is coming from Wine.  Maybe Wine can be smart enough to
> only translate \n into \r\n instead of translating \r\n into \r\r\n.
> Jacek / Eric, comments here?  I'm happy to try another patch, the
> first one was great.
>
actually, it depends on how the file has been opened by the application. 
if it's done in binary mode, no \n => \r\n translation takes place

but it the file is opened in text mode, wine just does what the 
application requires, which is \n => \r\n translation

(and by default, stdout and stderr are opened in text mode)


IMO, you should not expect more from Wine. Wine's goal is to run windows 
application on Unix ; it's not to run windows applications on Unix and 
requiring that they behave as they had been written for Linux semantics


anyway, we (wine) have to go back to blackboard to figure out a solution 
for disabling nicely conhost


in the meantime, you could use (without any patch to wine), some wrapper 
(bash) script like:

#!/bin/bash

# assumes wine is in $PATH

case "$1" in
     --unix-raw) shift; cat | wine $* 1> >(tee /dev/null) 2> >(tee 
/dev/null >&2);;
     --unix-lf)  shift; cat | wine $* 1> >(tee /dev/null | sed 's/\r$//' 
) 2> >(tee /dev/null | sed 's/\r$//' >&2);;
     *) wine $*;;
esac

using --unix-raw will just disable conhost (hence shall remove most of 
the ansi sequences reported)

using --unix-lf will also disable conhost and replace \r\n with \n

this shall put wine in the behavior as you expect, and still allow using 
proper redirection and piping on the shell script if needed (without 
alterning wine's behavior)

(this could be further improved by not adding a pipe for fd:s that are 
not tty, or adapted to be triggered when, say, TERM=dumb)

HTH


  reply	other threads:[~2022-12-23 12:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAF1jjLtJW0juQR6L-VybJ8SSaqkfi=qN9FnxJVaY=oQBtkSLxA@mail.gmail.com>
     [not found] ` <3f62bac2-ac1b-5c55-2488-ede2389d35d2@netcologne.de>
     [not found]   ` <CAF1jjLvJU2fnU0u0p9SwPre5mnhFdmv9pm_OvZGOvjQApCROqw@mail.gmail.com>
2022-12-17 10:52     ` Thomas Koenig
2022-12-17 23:24       ` NightStrike
2022-12-18  3:44         ` Jacob Bachmeyer
2022-12-18 21:13           ` NightStrike
2022-12-19  4:29             ` Jacob Bachmeyer
2022-12-19 10:43               ` Torbjorn SVENSSON
2022-12-19 11:00                 ` NightStrike
2022-12-19 11:13               ` NightStrike
2022-12-20  3:51                 ` Jacob Bachmeyer
     [not found]               ` <7cb45ab2-cc6e-c502-5592-51ffabcbc6f8@codeweavers.com>
2022-12-22  1:01                 ` NightStrike
2022-12-22  4:37                   ` Jacob Bachmeyer
2022-12-23 10:36                     ` NightStrike
2022-12-23 12:43                       ` Eric Pouech [this message]
2022-12-24  4:00                       ` Jacob Bachmeyer
2022-12-24 11:05                         ` Mark Wielaard
2023-01-05  2:50                         ` NightStrike
2023-01-06  3:33                           ` Jacob Bachmeyer
2023-01-06  3:44                             ` Jerry D
2023-01-08  7:12                             ` NightStrike
2023-01-11  2:30                               ` Jacob Bachmeyer
2023-01-11  9:33                                 ` NightStrike
2023-01-12  4:11                                   ` Jacob Bachmeyer
2023-01-06  3:41                           ` Jerry D

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=d74c475e-9f9d-c46c-21bf-b4b13a013739@orange.fr \
    --to=eric.pouech@orange.fr \
    --cc=dejagnu@gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jacek@codeweavers.com \
    --cc=jcb62281@gmail.com \
    --cc=nightstrike@gmail.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).