Bug 66862

Summary: X, Xephyr and Xnest fails to log error with Unsupported printf directive '*' when trying to report XDMCP fatal error: Session declined %*.*s
Product: xorg Reporter: Mateusz Korniak <mateusz-lists>
Component: Server/DDX/XephyrAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium CC: consume.noise, stuartl
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Mateusz Korniak 2013-07-12 18:44:55 UTC
Xephyr-1.14.2 and Xnest are failing to report XDMCP fatal error: Session declined reason:

$ Xephyr :20 -query localhost   -reset -terminate -from 127.0.0.1                                                                                                                                                   
                                                                                                                                                                                                                                            
Xephyr unable to use SHM XImages                                                                                                                                                                                                            
Initializing built-in extension Generic Event Extension                                                                                                                                                                                     
Initializing built-in extension SHAPE                                                                                                                                                                                                       
Initializing built-in extension MIT-SHM                                                                                                                                                                                                     
Initializing built-in extension XInputExtension                                                                                                                                                                                             
Initializing built-in extension XTEST                                                                                                                                                                                                       
Initializing built-in extension BIG-REQUESTS                                                                                                                                                                                                
Initializing built-in extension SYNC                                                                                                                                                                                                        
Initializing built-in extension XKEYBOARD                                                                                                                                                                                                   
Initializing built-in extension XC-MISC                                                                                                                                                                                                     
Initializing built-in extension XINERAMA                                                                                                                                                                                                    
Initializing built-in extension XFIXES                                                                                                                                                                                                      
Initializing built-in extension RENDER                                                                                                                                                                                                      
Initializing built-in extension RANDR                                                                                                                                                                                                       
Initializing built-in extension COMPOSITE                                                                                                                                                                                                   
Initializing built-in extension DAMAGE                                                                                                                                                                                                      
Initializing built-in extension MIT-SCREEN-SAVER                                                                                                                                                                                            
Initializing built-in extension DOUBLE-BUFFER                                                                                                                                                                                               
Initializing built-in extension RECORD                                                                                                                                                                                                      
Initializing built-in extension DPMS                                                                                                                                                                                                        
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
(EE) 
Fatal server error:
(EE) (EE) BUG: triggered 'if (f[f_idx])'
(EE) BUG: log.c:464 in pnprintf()
(EE) Unsupported printf directive '*'
(EE) 
(EE) Backtrace:
(EE) 0: Xephyr (xorg_backtrace+0x49) [0x81bbf49]
(EE) 1: Xephyr (LogVMessageVerbSigSafe+0x6fa) [0x81c6857]
(EE) 2: Xephyr (VErrorFSigSafe+0x33) [0x81c6985]
(EE) 3: Xephyr (FatalError+0x3d) [0x81c69c7]
(EE) 4: Xephyr (0x8048000+0x180b68) [0x81c8b68]
(EE) 5: Xephyr (0x8048000+0x180f35) [0x81c8f35]
(EE) 6: Xephyr (WakeupHandler+0x5e) [0x808e08b]
(EE) 7: Xephyr (WaitForSomething+0x187) [0x81b9a87]
(EE) 8: Xephyr (0x8048000+0x419fb) [0x80899fb]
(EE) 9: Xephyr (0x8048000+0x19255) [0x8061255]
(EE) 10: /lib/libc.so.6 (__libc_start_main+0xf5) [0xb732c8f1]
(EE) 11: Xephyr (0x8048000+0x19619) [0x8061619]
(EE) 
XDMCP fatal error: Session declined %*.*s
(EE) 


$ Xnest :20 -query localhost   -reset -terminate -from 127.0.0.1
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
(EE) 
Fatal server error:
(EE) (EE) BUG: triggered 'if (f[f_idx])'
(EE) BUG: log.c:464 in pnprintf()
(EE) Unsupported printf directive '*'
(EE) 
(EE) Backtrace:
(EE) 0: Xnest (xorg_backtrace+0x49) [0x813f5b9]
(EE) 1: Xnest (LogVMessageVerbSigSafe+0x6fa) [0x8149ec7]
(EE) 2: Xnest (VErrorFSigSafe+0x33) [0x8149ff5]
(EE) 3: Xnest (FatalError+0x3d) [0x814a037]
(EE) 4: Xnest (0x8048000+0x1041d8) [0x814c1d8]
(EE) 5: Xnest (0x8048000+0x1045a5) [0x814c5a5]
(EE) 6: Xnest (WakeupHandler+0x5e) [0x81115db]
(EE) 7: Xnest (WaitForSomething+0x187) [0x813d0f7]
(EE) 8: Xnest (0x8048000+0xc4f4b) [0x810cf4b]
(EE) 9: Xnest (0x8048000+0x15105) [0x805d105]
(EE) 10: /lib/libc.so.6 (__libc_start_main+0xf5) [0xb73818f1]
(EE) 11: Xnest (0x8048000+0x154c9) [0x805d4c9]
(EE) 
XDMCP fatal error: Session declined %*.*s
(EE)
Comment 1 Stuart Longland 2014-02-05 10:43:49 UTC
It's not just Xephyr/Xnest… I get it with straight plain X too.

stuartl@vk4msl-mb ~ $ X -query remotehost :1 -from 192.168.64.221

X.Org X Server 1.14.3
Release Date: 2013-09-12
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.5.4-beast x86_64 Gentoo
Current Operating System: Linux vk4msl-mb 3.12.0-vk4msl-mb #2 SMP PREEMPT Wed Jan 8 21:34:05 EST 2014 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.12.0-vk4msl-mb root=/dev/sda4 ro
Build Date: 18 November 2013  12:38:17AM
 
Current version of pixman: 0.32.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Feb  5 20:41:04 2014
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
setversion 1.4 failed
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension XFree86-VidModeExtension
Initializing built-in extension XFree86-DGA
Initializing built-in extension XFree86-DRI
Initializing built-in extension DRI2
Loading extension GLX
resize called 1280 800
setversion 1.4 failed
(EE) 
Fatal server error:
(EE) (EE) BUG: triggered 'if (f[f_idx])'
(EE) BUG: /var/tmp/portage/x11-base/xorg-server-1.14.3-r2/work/xorg-server-1.14.3/os/log.c:464 in pnprintf()
(EE) Unsupported printf directive '*'
(EE) 
(EE) Backtrace:
(EE) 0: X (xorg_backtrace+0x47) [0x7f42ae0dbdd7]
(EE) 1: X (LogVMessageVerbSigSafe+0x76b) [0x7f42ae0e922b]
(EE) 2: X (FatalError+0xe0) [0x7f42ae0e9490]
(EE) 3: X (0x7f42adf05000+0x1e6ba4) [0x7f42ae0ebba4]
(EE) 4: X (0x7f42adf05000+0x1e7095) [0x7f42ae0ec095]
(EE) 5: X (WakeupHandler+0x6d) [0x7f42adf6462d]
(EE) 6: X (WaitForSomething+0x1b4) [0x7f42ae0d8c54]
(EE) 7: X (0x7f42adf05000+0x5a7f1) [0x7f42adf5f7f1]
(EE) 8: X (0x7f42adf05000+0x471ea) [0x7f42adf4c1ea]
(EE) 9: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7f42abedbb95]
(EE) 10: X (0x7f42adf05000+0x47545) [0x7f42adf4c545]
(EE) 
XDMCP fatal error: Session failed %*.*s
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.1.log" for additional information.
(EE) 
(II) AIGLX: Suspending AIGLX clients for VT switch
(EE) Server terminated with error (1). Closing log file.
Comment 2 Daniel Martin 2014-12-11 14:38:17 UTC
Anyone has time to review/test the patch from Jon Turney?:
    http://lists.x.org/archives/xorg-devel/2014-November/044568.html
Comment 3 Igor Ulyanov 2015-02-12 10:43:40 UTC
Ive tested a patch with xorg version 1.17.99 with following results:

~ Xnest -query 10.10.10.199 :1
(EE) 
Fatal server error:
(EE) XDMCP fatal error: Session declined 
(EE)
Comment 4 voobscout+freedesktop 2015-02-18 13:54:29 UTC
After trying this patch http://patchwork.freedesktop.org/patch/40869/

(EE) 
Fatal server error:
(EE) XDMCP fatal error: Session declined 
(EE)

Xorg version 1.17.1
Comment 5 voobscout+freedesktop 2015-02-23 23:16:39 UTC
(In reply to voobscout+freedesktop from comment #4)
> After trying this patch http://patchwork.freedesktop.org/patch/40869/
> 
> (EE) 
> Fatal server error:
> (EE) XDMCP fatal error: Session declined 
> (EE)
> 
> Xorg version 1.17.1

Use "-listen tcp -query [XDMCP host IP]" and it should be fine.

"works for me"(tm)
Comment 6 Igor Ulyanov 2015-02-24 09:56:15 UTC
(In reply to voobscout+freedesktop from comment #5)
> (In reply to voobscout+freedesktop from comment #4)
> > After trying this patch http://patchwork.freedesktop.org/patch/40869/
> > 
> > (EE) 
> > Fatal server error:
> > (EE) XDMCP fatal error: Session declined 
> > (EE)
> > 
> > Xorg version 1.17.1
> 
> Use "-listen tcp -query [XDMCP host IP]" and it should be fine.
> 
> "works for me"(tm)

Indeed, adding -listen tcp removes "Session declined". So patch has fixed a problem for me.
Comment 7 Adam Jackson 2018-06-11 21:44:10 UTC
commit d3080d421bf0d91daea2e39bfc391c43d7fdad75
Author: Jon TURNEY <jon.turney@dronecode.org.uk>
Date:   Thu Feb 5 20:29:48 2015 +0000

    os: Teach vpnprintf() how to handle "%*.*s"
    
    XdmcpFatal uses the format specifier %*.*s, which vpnprintf() doesn't
    understand, which causes a backtrace and prevents the reason for the XDMCP
    failure being logged.
    
    See also:
    https://bugs.freedesktop.org/show_bug.cgi?id=66862
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758574
    
    "%*.*s" is also currently used in a few other places, so teach vpnprintf() how
    to handle it
    
    $ fgrep -r "%*.*s" *
    hw/dmx/config/scanner.l:    fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n",
    hw/dmx/dmxlog.c:        ErrorF("(%s) dmx[i%d/%*.*s]: ", type,
    hw/dmx/input/dmxinputinit.c:                dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
    os/access.c:        ErrorF("Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n",
    os/access.c:                ("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n",
    os/xdmcp.c:    FatalError("XDMCP fatal error: %s %*.*s\n", type,
    
    Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@virgin.net>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.