Bug#276948: vncserver: Start of a solution

2005-12-17 Thread Ola Lundqvist
Hi

On Sat, Dec 17, 2005 at 11:06:58AM +0100, Sebastien Koechlin wrote:
> On 12/16/05, Ola Lundqvist <[EMAIL PROTECTED]> wrote:
> > I have nothing to test on so I can hardly make a working patch
> > but if you could create a patch for me, that would help a lot!
> 
> I have no hope of making Xvnc work. It's written as old K&R C coding
> style, lots of warning when compiled with -Wall. No automake, tons of
> ifdef, auto-rewriten Makefiles... Just adding -Wall -g to build was
> painfull.
> 
> I corrected all includes about functions returning pointers, there are
> other errors. If I patch code until I have a working binary for my
> needs; other peoples will have a lot of troubles with differents
> fonts, bpp, geometry or things like that, triggering bugs that I
> didn't. Also any patch I will write can broke non-amd64, non-linux,
> non-debian, non-sarge build because I don't know who is it supposed to
> be build.
> 
> I think you should update this code to a more recent and 64bits aware
> version; this code will not work unless lot and lot of work; and I
> don't think it worth it.

The packages vnc4server, xvnc4viewer is also available. There are even
amd64 version (not in Debian though) that can be downloaded. From what
I have heard it actually work. I do not remember where I found that
package but you want I can dig though my mailboxes to try to find it.

> I'm on a step where code jump to short, and I don't understand why.
> It is supposed inside InitKbdFeedbackClassDeviceStruct() to call NoopDDA()
> at 0x427b2d and it goes to 0x00427b26

I do not know the internals enough to tell you either... :)

Regards,

// Ola

> (gdb) break devices.c:666
> Breakpoint 1 at 0x41b86f: file devices.c, line 666.
> (gdb) run :6
> Starting program: /home/seb/build/vnc-3.3.7/Xvnc/programs/Xserver/Xvnc :6
> 17/12/05 10:15:28 Xvnc version 3.3.7 - built Dec 13 2005 16:44:32
> 17/12/05 10:15:28 Copyright (C) 2002-2003 RealVNC Ltd.
> 17/12/05 10:15:28 Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
> 17/12/05 10:15:28 All Rights Reserved.
> 17/12/05 10:15:28 See http://www.realvnc.com for information on VNC
> 17/12/05 10:15:28 Desktop name 'x11' (ramoth:6)
> 17/12/05 10:15:28 Protocol version supported 3.3
> 17/12/05 10:15:28 Listening for VNC connections on TCP port 5906
> 
> Breakpoint 1, InitKbdFeedbackClassDeviceStruct (dev=0x719680,
> bellProc=0x4b5e9e ,
> controlProc=0x427b2d ) at devices.c:666
> 666 if (!feedc)
> (gdb) s
> 668 feedc->BellProc = bellProc;
> (gdb) s
> 669 feedc->CtrlProc = controlProc;
> (gdb) s
> 673 feedc->ctrl = defaultKeyboardControl;
> (gdb) s
> 674 feedc->ctrl.id = 0;
> (gdb) s
> 675 if ((feedc->next = dev->kbdfeed) != 0)
> (gdb) s
> 677 dev->kbdfeed = feedc;
> (gdb) s
> 683 (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
> (gdb) print *feedc
> $1 = {BellProc = 0x4b5e9e , CtrlProc = 0x427b2d
> , ctrl = {click = 0,
> bell = 50, bell_pitch = 400, bell_duration = 100, autoRepeat = 1,
> autoRepeats = '\0' , leds = 0, id = 0 '\0'}, next = 0x0}
> (gdb) print dev
> $2 = 0x719680
> (gdb) print *dev
> $3 = {public = {devicePrivate = 0x0, processInputProc = 0x42c847
> ,
> realInputProc = 0x42c847 , enqueueInputProc
> = 0x4293de ,
> on = 0}, next = 0x0, grabTime = {months = 0, milliseconds =
> 1134810928573}, startup = 1,
>   deviceProc = 0x4a1c54 , inited = 0, grab = 0x0, sync =
> {frozen = 0, state = 0,
> other = 0x0, event = 0x0, evcount = 0}, type = 0, name = 0x719960
> "keyboard", id = 0 '\0',
>   activatingKey = 0 '\0', fromPassiveGrab = 0, activeGrab = {next =
> 0x0, resource = 0,
> device = 0x0, window = 0x0, ownerEvents = 0, keyboardMode = 0,
> pointerMode = 0, coreGrab = 0,
> coreMods = 0, type = 0 '\0', modifiersDetail = {exact = 0, pMask =
> 0x0}, modifierDevice = 0x0,
> detail = {exact = 0, pMask = 0x0}, confineTo = 0x0, cursor = 0x0,
> eventMask = 0},
>   ActivateGrab = 0x429e66 ,
>   DeactivateGrab = 0x42a079 , key = 0x71ab90,
> valuator = 0x0,
>   button = 0x0, focus = 0x71bcc0, proximity = 0x0, kbdfeed = 0x71bd00,
> ptrfeed = 0x0,
>   intfeed = 0x0, stringfeed = 0x0, bell = 0x0, leds = 0x0}
> (gdb) print &dev->kbdfeed->ctrl
> $4 = (KeybdCtrl *) 0x71bd10
> (gdb) print dev->kbdfeed->ctrl
> $5 = {click = 0, bell = 50, bell_pitch = 400, bell_duration = 100,
> autoRepeat = 1,
>   autoRepeats = '\0' , leds = 0, id = 0 '\0'}
> (gdb) print dev->kbdfeed->CtrlProc
> $6 = 0x427b2d 
> (gdb) print *dev->kbdfeed->CtrlProc
> $7 = {void (DeviceIntPtr, KeybdCtrl *)} 0x427b2d 
> (gdb) s
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00427957 in AlterSaveSetForClient (client=0x427aff,
> pWin=0x60, mode=1) at dixutils.c:343
> 343 while ((j < numnow) && (pTmp[j] != (pointer)pWin))
> (gdb) bt
> #0  0x00427957 in AlterSaveSetForClient (client=0x427aff,
> pWin=0x60, mode=1)
> at dixutils.c:343
> #1  0x00427b26 in DeleteWindowFromAnySaveSet (pWin=0x60)

Bug#276948: vncserver: Start of a solution

2005-12-17 Thread Sebastien Koechlin
On 12/16/05, Ola Lundqvist <[EMAIL PROTECTED]> wrote:
> I have nothing to test on so I can hardly make a working patch
> but if you could create a patch for me, that would help a lot!

I have no hope of making Xvnc work. It's written as old K&R C coding
style, lots of warning when compiled with -Wall. No automake, tons of
ifdef, auto-rewriten Makefiles... Just adding -Wall -g to build was
painfull.

I corrected all includes about functions returning pointers, there are
other errors. If I patch code until I have a working binary for my
needs; other peoples will have a lot of troubles with differents
fonts, bpp, geometry or things like that, triggering bugs that I
didn't. Also any patch I will write can broke non-amd64, non-linux,
non-debian, non-sarge build because I don't know who is it supposed to
be build.

I think you should update this code to a more recent and 64bits aware
version; this code will not work unless lot and lot of work; and I
don't think it worth it.

I'm on a step where code jump to short, and I don't understand why.
It is supposed inside InitKbdFeedbackClassDeviceStruct() to call NoopDDA()
at 0x427b2d and it goes to 0x00427b26

(gdb) break devices.c:666
Breakpoint 1 at 0x41b86f: file devices.c, line 666.
(gdb) run :6
Starting program: /home/seb/build/vnc-3.3.7/Xvnc/programs/Xserver/Xvnc :6
17/12/05 10:15:28 Xvnc version 3.3.7 - built Dec 13 2005 16:44:32
17/12/05 10:15:28 Copyright (C) 2002-2003 RealVNC Ltd.
17/12/05 10:15:28 Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
17/12/05 10:15:28 All Rights Reserved.
17/12/05 10:15:28 See http://www.realvnc.com for information on VNC
17/12/05 10:15:28 Desktop name 'x11' (ramoth:6)
17/12/05 10:15:28 Protocol version supported 3.3
17/12/05 10:15:28 Listening for VNC connections on TCP port 5906

Breakpoint 1, InitKbdFeedbackClassDeviceStruct (dev=0x719680,
bellProc=0x4b5e9e ,
controlProc=0x427b2d ) at devices.c:666
666 if (!feedc)
(gdb) s
668 feedc->BellProc = bellProc;
(gdb) s
669 feedc->CtrlProc = controlProc;
(gdb) s
673 feedc->ctrl = defaultKeyboardControl;
(gdb) s
674 feedc->ctrl.id = 0;
(gdb) s
675 if ((feedc->next = dev->kbdfeed) != 0)
(gdb) s
677 dev->kbdfeed = feedc;
(gdb) s
683 (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
(gdb) print *feedc
$1 = {BellProc = 0x4b5e9e , CtrlProc = 0x427b2d
, ctrl = {click = 0,
bell = 50, bell_pitch = 400, bell_duration = 100, autoRepeat = 1,
autoRepeats = '\0' , leds = 0, id = 0 '\0'}, next = 0x0}
(gdb) print dev
$2 = 0x719680
(gdb) print *dev
$3 = {public = {devicePrivate = 0x0, processInputProc = 0x42c847
,
realInputProc = 0x42c847 , enqueueInputProc
= 0x4293de ,
on = 0}, next = 0x0, grabTime = {months = 0, milliseconds =
1134810928573}, startup = 1,
  deviceProc = 0x4a1c54 , inited = 0, grab = 0x0, sync =
{frozen = 0, state = 0,
other = 0x0, event = 0x0, evcount = 0}, type = 0, name = 0x719960
"keyboard", id = 0 '\0',
  activatingKey = 0 '\0', fromPassiveGrab = 0, activeGrab = {next =
0x0, resource = 0,
device = 0x0, window = 0x0, ownerEvents = 0, keyboardMode = 0,
pointerMode = 0, coreGrab = 0,
coreMods = 0, type = 0 '\0', modifiersDetail = {exact = 0, pMask =
0x0}, modifierDevice = 0x0,
detail = {exact = 0, pMask = 0x0}, confineTo = 0x0, cursor = 0x0,
eventMask = 0},
  ActivateGrab = 0x429e66 ,
  DeactivateGrab = 0x42a079 , key = 0x71ab90,
valuator = 0x0,
  button = 0x0, focus = 0x71bcc0, proximity = 0x0, kbdfeed = 0x71bd00,
ptrfeed = 0x0,
  intfeed = 0x0, stringfeed = 0x0, bell = 0x0, leds = 0x0}
(gdb) print &dev->kbdfeed->ctrl
$4 = (KeybdCtrl *) 0x71bd10
(gdb) print dev->kbdfeed->ctrl
$5 = {click = 0, bell = 50, bell_pitch = 400, bell_duration = 100,
autoRepeat = 1,
  autoRepeats = '\0' , leds = 0, id = 0 '\0'}
(gdb) print dev->kbdfeed->CtrlProc
$6 = 0x427b2d 
(gdb) print *dev->kbdfeed->CtrlProc
$7 = {void (DeviceIntPtr, KeybdCtrl *)} 0x427b2d 
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00427957 in AlterSaveSetForClient (client=0x427aff,
pWin=0x60, mode=1) at dixutils.c:343
343 while ((j < numnow) && (pTmp[j] != (pointer)pWin))
(gdb) bt
#0  0x00427957 in AlterSaveSetForClient (client=0x427aff,
pWin=0x60, mode=1)
at dixutils.c:343
#1  0x00427b26 in DeleteWindowFromAnySaveSet (pWin=0x60) at
dixutils.c:396
#2  0x0041b98b in InitKbdFeedbackClassDeviceStruct (dev=0x719680,
bellProc=0x4b5e9e , controlProc=0x427b2d )
at devices.c:683
#3  0x0041bf6e in InitKeyboardDeviceStruct (device=0x719680,
pKeySyms=0x7fbfffef20,
pModifiers=0x7fbfffee20 "", bellProc=0x4b5e9e ,
controlProc=0x427b2d )
at devices.c:867
#4  0x004a1cec in rfbKeybdProc (pDevice=0x719680, onoff=0) at init.c:606
#5  0x0041a83c in InitAndStartDevices () at devices.c:171
#6  0x00403f61 in main (argc=2, argv=0x7fb0b8) at main.c:376


--
Seb, autocuiseur



Bug#276948: vncserver: Start of a solution

2005-12-16 Thread Ola Lundqvist
Hi 

Thanks a lot for the input.

I have nothing to test on so I can hardly make a working patch
but if you could create a patch for me, that would help a lot!

Regards,

// Ola

On Tue, Dec 13, 2005 at 12:38:03AM +0100, Sebastien Koechlin wrote:
> Package: vncserver
> Version: 3.3.7-7
> Followup-For: Bug #276948
> 
> I spend some time with a friend to find the problem.
> 
> In the default configuration, -Wall is not used for compilation.
> When I add it, I have warnings about implicit declaration of time, 
> strftime and localtime 
> 
> Implicit declaration means the function return int (it is not as
> localtime return a pointer struct tm *).
> 
> BUT! On amd64, we have sizeof(int) = 4 and sizeof(void *) = 8.
> 
> So we loose the upper 32 bits of the result, filled with uninitialized data
> instead.
> 
> I added '#include ' in Xvnc/programs/Xserver/hw/vnc/init.c,
> killed the boss monster and finished the first stage of having a working Xvnc 
> :
> 
> (gdb) run :2
> Starting program: /home/seb/build/vnc-3.3.7/Xvnc/programs/Xserver/Xvnc
> :2
> 13/12/05 00:32:39 Xvnc version 3.3.7 - built Dec 13 2005 00:32:04
> 13/12/05 00:32:39 Copyright (C) 2002-2003 RealVNC Ltd.
> 13/12/05 00:32:39 Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
> 13/12/05 00:32:39 All Rights Reserved.
> 13/12/05 00:32:39 See http://www.realvnc.com for information on VNC
> 13/12/05 00:32:39 Desktop name 'x11' (ramoth:2)
> 13/12/05 00:32:39 Protocol version supported 3.3
> 13/12/05 00:32:39 Listening for VNC connections on TCP port 5902
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00427afc in DeleteWindowFromAnySaveSet (pWin=0x60) at
> dixutils.c:394
> 394 client = clients[i];
> (gdb) bt
> #0  0x00427afc in DeleteWindowFromAnySaveSet (pWin=0x60) at
> dixutils.c:394
> #1  0x0041b98b in InitKbdFeedbackClassDeviceStruct
> (dev=0x719680, bellProc=0x4b5eae ,
> controlProc=0x427b2d ) at devices.c:683
> #2  0x0041bf6e in InitKeyboardDeviceStruct (device=0x719680,
> pKeySyms=0x7fbfffe630, pModifiers=0x7fbfffe530 "",
> bellProc=0x4b5eae , controlProc=0x427b2d )
> at devices.c:867
> #3  0x004a1cfc in rfbKeybdProc (pDevice=0x719680,
> onoff=0) at init.c:606
> #4  0x0041a83c in InitAndStartDevices () at
> devices.c:171
> #5  0x00403f61 in main (argc=2, argv=0x7fbfffe7c8) at main.c:376
> (gdb)   
> 
> 
> There are probably tons of similar problems because
> sizeof(int)!=sizeof(void*) :
> 
> access.c:701: attention : implicit declaration of function 
> `XdmcpRegisterConnection'
> access.c:730: attention : implicit declaration of function 
> `XdmcpRegisterBroadcastAddress'
> connection.c:317: attention : implicit declaration of function `atoi'
> utils.c:589: attention : implicit declaration of function `XdmcpUseMsg'
> utils.c:730: attention : implicit declaration of function 
> `ParseGlyphCachingMode'
> utils.c:911: attention : implicit declaration of function `XdmcpOptions'
> utils.c:1417: attention : implicit declaration of function `waitpid'
> dispatch.c:3509: attention : implicit declaration of function 
> `ProcessWorkQueueZombies'
> auth.c:207: attention : implicit declaration of function 
> `XdmcpRegisterAuthorization'
> xdmauth.c:76: attention : implicit declaration of function `XdmcpCompareKeys'
> xdmauth.c:91: attention : implicit declaration of function `XdmcpAllocARRAY8'
> xdmauth.c:159: attention : implicit declaration of function 
> `XdmcpRegisterAuthentication'
> xdmauth.c:312: attention : implicit declaration of function `time'
> xdmcp.c:289: attention : implicit declaration of function `atoi'
> xdmcp.c:379: attention : implicit declaration of function `XdmcpAllocARRAY8'
> xdmcp.c:390: attention : implicit declaration of function 
> `XdmcpReallocARRAYofARRAY8'
> xdmcp.c:465: attention : implicit declaration of function 
> `XdmcpReallocARRAY16'
> xdmcp.c:570: attention : implicit declaration of function 
> `XdmAuthenticationInit'
> xdmcp.c:1376: attention : implicit declaration of function `exit'
> ../../../lib/xtrans/Xtranssock.c:858: attention : implicit declaration of 
> function `atoi'
> ../../../lib/xtrans/Xtrans.c:305: attention : implicit declaration of 
> function `_XSERVTransGetHostname'
> dixfonts.c:1924: attention : implicit declaration of function 
> `PrinterFontRegisterFpeFunctions'
> dixfonts.c:1925: attention : implicit declaration of function 
> `FontFileCheckRegisterFpeFunctions'
> dixfonts.c:1926: attention : implicit declaration of function 
> `check_fs_register_fpe_functions'
> dixfonts.c:1928: attention : implicit declaration of function 
> `FontFileRegisterFpeFunctions'
> dixfonts.c:1929: attention : implicit declaration of function 
> `fs_register_fpe_functions'
> shm.c:282: attention : implicit declaration of function `geteuid'
> shm.c:283: attention : implicit declaration of function `getegid'
> mbuf.c:1315: attention : implicit declaration of function

Bug#276948: vncserver: Start of a solution

2005-12-12 Thread Sebastien Koechlin
Package: vncserver
Version: 3.3.7-7
Followup-For: Bug #276948

I spend some time with a friend to find the problem.

In the default configuration, -Wall is not used for compilation.
When I add it, I have warnings about implicit declaration of time, 
strftime and localtime 

Implicit declaration means the function return int (it is not as
localtime return a pointer struct tm *).

BUT! On amd64, we have sizeof(int) = 4 and sizeof(void *) = 8.

So we loose the upper 32 bits of the result, filled with uninitialized data
instead.

I added '#include ' in Xvnc/programs/Xserver/hw/vnc/init.c,
killed the boss monster and finished the first stage of having a working Xvnc :

(gdb) run :2
Starting program: /home/seb/build/vnc-3.3.7/Xvnc/programs/Xserver/Xvnc
:2
13/12/05 00:32:39 Xvnc version 3.3.7 - built Dec 13 2005 00:32:04
13/12/05 00:32:39 Copyright (C) 2002-2003 RealVNC Ltd.
13/12/05 00:32:39 Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
13/12/05 00:32:39 All Rights Reserved.
13/12/05 00:32:39 See http://www.realvnc.com for information on VNC
13/12/05 00:32:39 Desktop name 'x11' (ramoth:2)
13/12/05 00:32:39 Protocol version supported 3.3
13/12/05 00:32:39 Listening for VNC connections on TCP port 5902

Program received signal SIGSEGV, Segmentation fault.
0x00427afc in DeleteWindowFromAnySaveSet (pWin=0x60) at
dixutils.c:394
394 client = clients[i];
(gdb) bt
#0  0x00427afc in DeleteWindowFromAnySaveSet (pWin=0x60) at
dixutils.c:394
#1  0x0041b98b in InitKbdFeedbackClassDeviceStruct
(dev=0x719680, bellProc=0x4b5eae ,
controlProc=0x427b2d ) at devices.c:683
#2  0x0041bf6e in InitKeyboardDeviceStruct (device=0x719680,
pKeySyms=0x7fbfffe630, pModifiers=0x7fbfffe530 "",
bellProc=0x4b5eae , controlProc=0x427b2d )
at devices.c:867
#3  0x004a1cfc in rfbKeybdProc (pDevice=0x719680,
onoff=0) at init.c:606
#4  0x0041a83c in InitAndStartDevices () at
devices.c:171
#5  0x00403f61 in main (argc=2, argv=0x7fbfffe7c8) at main.c:376
(gdb)   


There are probably tons of similar problems because
sizeof(int)!=sizeof(void*) :

access.c:701: attention : implicit declaration of function 
`XdmcpRegisterConnection'
access.c:730: attention : implicit declaration of function 
`XdmcpRegisterBroadcastAddress'
connection.c:317: attention : implicit declaration of function `atoi'
utils.c:589: attention : implicit declaration of function `XdmcpUseMsg'
utils.c:730: attention : implicit declaration of function 
`ParseGlyphCachingMode'
utils.c:911: attention : implicit declaration of function `XdmcpOptions'
utils.c:1417: attention : implicit declaration of function `waitpid'
dispatch.c:3509: attention : implicit declaration of function 
`ProcessWorkQueueZombies'
auth.c:207: attention : implicit declaration of function 
`XdmcpRegisterAuthorization'
xdmauth.c:76: attention : implicit declaration of function `XdmcpCompareKeys'
xdmauth.c:91: attention : implicit declaration of function `XdmcpAllocARRAY8'
xdmauth.c:159: attention : implicit declaration of function 
`XdmcpRegisterAuthentication'
xdmauth.c:312: attention : implicit declaration of function `time'
xdmcp.c:289: attention : implicit declaration of function `atoi'
xdmcp.c:379: attention : implicit declaration of function `XdmcpAllocARRAY8'
xdmcp.c:390: attention : implicit declaration of function 
`XdmcpReallocARRAYofARRAY8'
xdmcp.c:465: attention : implicit declaration of function `XdmcpReallocARRAY16'
xdmcp.c:570: attention : implicit declaration of function 
`XdmAuthenticationInit'
xdmcp.c:1376: attention : implicit declaration of function `exit'
../../../lib/xtrans/Xtranssock.c:858: attention : implicit declaration of 
function `atoi'
../../../lib/xtrans/Xtrans.c:305: attention : implicit declaration of function 
`_XSERVTransGetHostname'
dixfonts.c:1924: attention : implicit declaration of function 
`PrinterFontRegisterFpeFunctions'
dixfonts.c:1925: attention : implicit declaration of function 
`FontFileCheckRegisterFpeFunctions'
dixfonts.c:1926: attention : implicit declaration of function 
`check_fs_register_fpe_functions'
dixfonts.c:1928: attention : implicit declaration of function 
`FontFileRegisterFpeFunctions'
dixfonts.c:1929: attention : implicit declaration of function 
`fs_register_fpe_functions'
shm.c:282: attention : implicit declaration of function `geteuid'
shm.c:283: attention : implicit declaration of function `getegid'
mbuf.c:1315: attention : implicit declaration of function `ClientSleepUntil'
xtest.c:262: attention : implicit declaration of function `ClientSleepUntil'
xtest1dd.c:411: attention : implicit declaration of function 
`XTestGetPointerPos'
xtest1dd.c:1316: attention : implicit declaration of function `XTestJumpPointer'
xtest1dd.c:1326: attention : implicit declaration of function 
`XTestGenerateEvent'
xprint.c:1075: attention : implicit declaration of function `XpUnsetFontResFunc'
xprint.c:2180: attention : impl