This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: screen on 64-bit mangles mintty/buffer
- From: Shaddy Baddah <lithium-cygwin at shaddybaddah dot name>
- To: cygwin at cygwin dot com
- Date: Thu, 15 May 2014 22:40:34 +1000
- Subject: Re: screen on 64-bit mangles mintty/buffer
- Authentication-results: sourceware.org; auth=none
- 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>
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
--- 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);
--
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