Bug 708788

Summary: xwininfo -name finds empty-named window
Product: [Fedora] Fedora Reporter: Nadav Har'El <nyh>
Component: xorg-x11-utilsAssignee: X/OpenGL Maintenance List <xgl-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: mcepl, xgl-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-30 12:06:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Nadav Har'El 2011-05-29 15:12:10 UTC
Description of problem:
This is a new bug in xwininfo, created when this utility was translated from Xlib to XCB. "xwininfo -name ..." is supposed to find a window with the given name, but it can also find any window with an empty name.

The bug is in dsimple.c. All three calls to strncmp in that file should *not* use strlen(prop_name), but rather strlen(name). Otherwise, when any random window has an empty name, 0 characters are compared between this empty string and the looked-up name, and of course a match is found :-)

I also sent this bug upstream: https://bugs.freedesktop.org/show_bug.cgi?id=37710.

Version-Release number of selected component (if applicable):
Tested on xorg-x11-utils-7.5-2.fc15.x86_64

How reproducible:


Steps to Reproduce:
1. run Firefox              # this creates a window with an empty name)
2. xwininfo -name XYZ       # there isn't supposed to be a window with this name
  
Actual results:
xwininfo: Window id: 0x2a0006d (has no name)

  Absolute upper-left X:  0
  Absolute upper-left Y:  0
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 200
  Height: 200
...

Expected results:
xwininfo: error: No window with name "XYZ" exists!


Additional info:

Comment 1 Nadav Har'El 2011-05-29 15:20:46 UTC
Correction - switching to strlen(name) isn't accurate either.
I proposed a more accurate fix on the upstream bugzilla (see link above).

Comment 2 Matěj Cepl 2011-05-30 12:06:41 UTC
I believe that it is more appropriate to let this bug be resolved upstream.

We will continue to track the issue in the centralized upstream bug tracker, and will review any bug fixes that become available for consideration in future updates.

Thank you for helping to make free software better.