delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/05/15/08:41:29

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=YsrbYL
629Tlp/C/JIj2FzPNmhANPalnVhSrFjbgVdXy8itE4hVgISvpHA1FJo1wBfg2cbx
72n/4a8dFSBL09AXrSn9S9uuXFqOwetd03bmXIJPZ/PDsBCBemOrPVzc69UeQuTb
MuZg6iqgFTZV7yb8us6yhPQPduWZT9m4a055Q=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=36wrgnVtSdFN
cok8ND8wcR62n7s=; b=TAnp6IKHRux5XXQionOvfnTWpeLIRF0L2mZpoR6tRXb+
COq9Z2OMSRFxT7/BpMwf9Yw4uP+RcJSoH8p6Vl/EkalsQYIkuzbSUbaadd2sA/BL
4VQBnMgsasN26HYPDZKT95nreQ+CraWpdsn7Eb/LfeknJlxb1QjtD2PQN7ZVEFE=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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_00 autolearn=ham version=3.3.2
X-HELO: mail6.worldispnetwork.com
Message-ID: <5374B5C2.8010402@shaddybaddah.name>
Date: Thu, 15 May 2014 22:40:34 +1000
From: Shaddy Baddah <lithium-cygwin AT shaddybaddah DOT name>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.4.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: screen on 64-bit mangles mintty/buffer
References: <5370E144 DOT 4010905 AT shaddybaddah DOT name> <90t1n9l4g51dgrq060rc6ua48eog4178v8 AT 4ax DOT com> <5373AF2E DOT 5090402 AT shaddybaddah DOT name> <4jc7n9hsfrkh57dc5hlgb3tlrrasgo2v3m AT 4ax DOT com>
In-Reply-To: <4jc7n9hsfrkh57dc5hlgb3tlrrasgo2v3m@4ax.com>
X-IsSubscribed: yes

--------------090101030908000107060804
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

On 2014-05-15 04:15+1000, Andrew Schulman wrote:
> <snip>
<snip>
>>
>> I can't understand why the ./conftest.exe differ. Trying to emulate by
>> hand, I cannot reproduce it. But it is now very late here, and I can't
>> debug anymore.
>>
>> I'm hoping that I've provided enough of a lead for someone of authority
>> to decide where things are right, and where things are wrong.
>
> Yes, I think so!
>
> Thanks a lot, Shaddy.  That takes us a long way to a solution.  I'll look
> at it from there as soon as I can.

No problem. I am always happy when I can contribute to my favourite Open
Source project and community.

With regards to the conftest difference on 32-bit vs. 64-bit, I believe
I understand it now.

It seems the code configure generates for that little test fails to
#include definitions for tgoto() (amongst others).

In trying to emulate it, I had actually put them in my code. My method
wasn't exact.

If I understand correctly (and a subsequent gdb run seems to confirm it;
Value returned is $1 = 0x600096230 "1" becomes a pointer to 0x96230)
the difference comes about because without the prototype, gcc pins an
int as the return type of tgoto(). But being a pointer, char *, on
64-bit the size mismatch (8 byte pointers, vs 4 byte int) means that
the pointer passed into strcmp() (as return from tgoto()) has 4 random
bytes copied in, and points to a random location.

Does that sound plausible? I am not 100% sure, because considering this
I thought that a 64-bit Linux should be afflicted in the same way.

However despite gcc complaining as well over missing prototypes,
strcmp() is being passed the correct (char *) pointer from tgoto(). Is
this down to the difference in gcc (4.8 on cygwin, 4.7 on debian)? Or
just the difference in architecture?

In any case, I've tested the patch below, and it solves the immediate
problem with screen. It probably needs to go upstream too... I'd put
my hand up, but I'm unsure where upstream is exactly.

-- 
Regards,
Shaddy

--------------090101030908000107060804
Content-Type: text/x-patch;
 name="screen-terminfo-autoconf.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="screen-terminfo-autoconf.diff"

--- origsrc/screen/src/configure.in	2013-06-17 20:48:45.000000000 +1000
+++ src/screen/src/configure.in	2014-05-15 21:42:36.949278900 +1000
@@ -680,6 +680,9 @@
 AC_MSG_ERROR(!!! no tgetent - no screen)))))))
 
 AC_TRY_RUN([
+#include <term.h>
+#include <string.h>
+#include <stdlib.h>
 main()
 {
  exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);


--------------090101030908000107060804
Content-Type: text/plain; charset=us-ascii

--
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
--------------090101030908000107060804--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019