build-scripts/checker-buildbot.sh
author Ryan C. Gordon
Mon, 21 Aug 2017 00:42:06 -0400
changeset 11334 749cb40916f2
parent 11170 b5fe34e8401f
child 13815 8c7bf8f29b8c
permissions -rwxr-xr-x
x11: specify event mask for buttons when grabbing pointer (thanks, Stas!).

This fixes a strange corner case (notes appended below), and should be
safe to do anyhow.

Fixes Bugzilla #3674.

"I did more tests.
It appears the bug only happens if there is
another window on the screen that has "always
on top" property. For me it is xawtv - it is
always opened in a screen corner. Closing
xawtv or removing "always on top" property
from it makes the problem to go away.
Plus, it doesn't appear like the buttons are
not delivered at all. It appears that instead
the button presses are delivered on some mouse
positions, but not delivered when you move the
mouse to other part of the window... So this is
really weird and is likely somewhere deep in the
Xorg.
Maybe somehow it happens that the cursor is
actually above the xawtv window, but, because
my app uses grab, it is not visible there, and
in that case the events are not delivered to
my app?
But with my patch the button events are
always delivered flawlessly, it seems.

Hmm, and that indeed seems to explain my problem:
if the mask is set properly and my app uses
grab, then, even if the mouse is above some
other window, the events would still be delivered
to the grabbing app, which is what actually wanted
because my app uses relative mouse mode, so it
doesn't know the pointer can cross some other window
(my app draws the pointer itself).
So my current theory is that my patch only enforces
the mouse grab, which otherwise can be tricked by
some other window preventing the button events
delivery (but motion events are still delivered
via xinput2, which makes it all look very obscure)."
     1 #!/bin/bash
     2 
     3 # This is a script used by some Buildbot buildslaves to push the project
     4 #  through Clang's static analyzer and prepare the output to be uploaded
     5 #  back to the buildmaster. You might find it useful too.
     6 
     7 # Install Clang (you already have it on Mac OS X, apt-get install clang
     8 #  on Ubuntu, etc),
     9 # or download checker at http://clang-analyzer.llvm.org/ and unpack it in
    10 #  /usr/local ... update CHECKERDIR as appropriate.
    11 
    12 FINALDIR="$1"
    13 
    14 CHECKERDIR="/usr/local/checker-279"
    15 if [ ! -d "$CHECKERDIR" ]; then
    16     echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2
    17     CHECKERDIR="/usr/share/clang/scan-build"
    18 fi
    19 
    20 if [ ! -d "$CHECKERDIR" ]; then
    21     echo "$CHECKERDIR not found. Giving up." 1>&2
    22     exit 1
    23 fi
    24 
    25 if [ -z "$MAKE" ]; then
    26     OSTYPE=`uname -s`
    27     if [ "$OSTYPE" == "Linux" ]; then
    28         NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    29         let NCPU=$NCPU+1
    30     elif [ "$OSTYPE" = "Darwin" ]; then
    31         NCPU=`sysctl -n hw.ncpu`
    32     elif [ "$OSTYPE" = "SunOS" ]; then
    33         NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
    34     else
    35         NCPU=1
    36     fi
    37 
    38     if [ -z "$NCPU" ]; then
    39         NCPU=1
    40     elif [ "$NCPU" = "0" ]; then
    41         NCPU=1
    42     fi
    43 
    44     MAKE="make -j$NCPU"
    45 fi
    46 
    47 echo "\$MAKE is '$MAKE'"
    48 
    49 # Unset $MAKE so submakes don't use it.
    50 MAKECOMMAND="$MAKE"
    51 unset MAKE
    52 
    53 set -x
    54 set -e
    55 
    56 cd `dirname "$0"`
    57 cd ..
    58 
    59 rm -rf checker-buildbot analysis
    60 if [ ! -z "$FINALDIR" ]; then
    61     rm -rf "$FINALDIR"
    62 fi
    63 
    64 mkdir checker-buildbot
    65 cd checker-buildbot
    66 
    67 # We turn off deprecated declarations, because we don't care about these warnings during static analysis.
    68 # The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
    69 
    70 # You might want to do this for CMake-backed builds instead...
    71 PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" ..
    72 
    73 # ...or run configure without the scan-build wrapper...
    74 #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled
    75 
    76 rm -rf analysis
    77 PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECOMMAND
    78 
    79 if [ `ls -A analysis |wc -l` == 0 ] ; then
    80     mkdir analysis/zarro
    81     echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
    82 fi
    83 
    84 mv analysis/* ../analysis
    85 rmdir analysis   # Make sure this is empty.
    86 cd ..
    87 chmod -R a+r analysis
    88 chmod -R go-w analysis
    89 find analysis -type d -exec chmod a+x {} \;
    90 if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
    91 
    92 if [ ! -z "$FINALDIR" ]; then
    93     mv analysis "$FINALDIR"
    94 else
    95     FINALDIR=analysis
    96 fi
    97 
    98 rm -rf checker-buildbot
    99 
   100 echo "Done. Final output is in '$FINALDIR' ..."
   101 
   102 # end of checker-buildbot.sh ...
   103