Re: SCM_RIGHTS: XTrans vs ssh forwarding with MIT-SHM clients

2023-01-18 Thread Jeremy Huddleston Sequoia
After implementing DetermineClientCmd for darwin 
(https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1040), we still 
have an issue.  We still do not know the pid of the peer (which we need to pass 
DetermineClientCmd).

We expect to determine the pid in GetLocalClientCreds().  Looking into that 
function, I expect it to be failing on other UNIX as well.  
GetLocalClientCreds() prefers getpeereid() if getpeereid() is available.  
getpeereid(), however, only returns uid and gid.  If getpeereid() is not 
available, the implementation will try getpeerucred() or SO_PEERCRED (both of 
which *DO* return the pid in addition to uid/gid).  So it looks like this 
should only be working if getpeereid() is NOT available and getpeerucred() or 
SO_PEERCRED are available.

Am I missing something?  How is this ssh detection working on other UNIX 
systems that have getpeereid right now (or is it not)?.

> On Jan 17, 2023, at 01:06, Jeremy Huddleston Sequoia  
> wrote:
> 
> Yep, thanks for the pointer.  Looks like DetermineClientCmd() needs to be 
> implemented for darwin.
> 
>> On Jan 16, 2023, at 01:14, Michel Dänzer  wrote:
>> 
>> On 1/16/23 06:31, Jeremy Huddleston Sequoia wrote:
>>> 
>>> How should this work?  Why hasn't this been reported as an issue on other 
>>> platforms?  This all seems pretty platform agnostic, so I'd expect this to 
>>> be an issue on other platforms as well.  Is it not?  If not, why not?
>> 
>> ComputeLocalClient attempts to detect SSH clients and treats them as 
>> non-local. Maybe this isn't working on macos for some reason?
>> 
>> 
>> -- 
>> Earthling Michel Dänzer|  https://redhat.com
>> Libre software enthusiast  | Mesa and Xwayland developer
>> 
> 



Re: SCM_RIGHTS: XTrans vs ssh forwarding with MIT-SHM clients

2023-01-17 Thread Jeremy Huddleston Sequoia
Yep, thanks for the pointer.  Looks like DetermineClientCmd() needs to be 
implemented for darwin.

> On Jan 16, 2023, at 01:14, Michel Dänzer  wrote:
> 
> On 1/16/23 06:31, Jeremy Huddleston Sequoia wrote:
>> 
>> How should this work?  Why hasn't this been reported as an issue on other 
>> platforms?  This all seems pretty platform agnostic, so I'd expect this to 
>> be an issue on other platforms as well.  Is it not?  If not, why not?
> 
> ComputeLocalClient attempts to detect SSH clients and treats them as 
> non-local. Maybe this isn't working on macos for some reason?
> 
> 
> -- 
> Earthling Michel Dänzer|  https://redhat.com
> Libre software enthusiast  | Mesa and Xwayland developer
> 



SCM_RIGHTS: XTrans vs ssh forwarding with MIT-SHM clients

2023-01-16 Thread Jeremy Huddleston Sequoia
A user reported (https://github.com/XQuartz/XQuartz/issues/314) that running 
`feh` on a remote system would hang the process without producing any windows 
when they updated from an older XQuartz server to a newer one.

I traced this to a difference in autoconf vs meson builds.  With meson, we're 
setting XTRANS_SEND_FDS whereas with autoconf, we weren't:

if cc.has_header_symbol('sys/socket.h', 'SCM_RIGHTS')
  conf_data.set('XTRANS_SEND_FDS', '1')
endif

vs 

linux*|solaris*|freebsd*|dragonfly*|openbsd*)
XTRANS_SEND_FDS=yes
;;
*)
XTRANS_SEND_FDS=no
;;

This change certainly looks fine to me.  darwin supports SCM_RIGHTS.  It was 
probably just overlooked in that configure.ac condition, and it never caused 
enough of a problem for someone to notice.

So I turned my attention to figuring out why things aren't working with 
XTRANS_SEND_FDS set...

Soon after launching `feh`, it enters ProcShmCreateSegment.  With local and 
unix connections, we try using SCM_RIGHTS to send an fd in the reply 
(_XSERVTransSocketSendFd).  With inet, inet6, and tcp, we skip sending the FD 
(_XSERVTransSocketSendFdInvalid). This all sounds fine and good except that ssh 
forwarding throws a wrench into things...

When we use ssh forwarding with a local DISPLAY (eg: `DISPLAY=:0 ssh -Y 
some.host`), the X11 server ends up seeing this as a local connection (thus 
using _XSERVTransSocketLocalFuncs) and uses SCM_RIGHTS to send a fd.  On the 
server, we successfully send the message with FDs attached.  On the client, we 
receive a reply, but there is no fd, so xcb continues to wait (specifically, 
read_fds() fails and we end up stuck in wait_for_reply()).

Now, I haven't dug into what's happening between the server and client, but I 
suspect OpenSSH just drops the FDs on the floor without logging a warning to 
the user and passes the rest of the message along.

So there seem to be two issues here:

1 - libxcb should recover from this.
2 - The server should be able to determine that the transport does not support 
SCM_RIGHTS.

---

How should this work?  Why hasn't this been reported as an issue on other 
platforms?  This all seems pretty platform agnostic, so I'd expect this to be 
an issue on other platforms as well.  Is it not?  If not, why not?

Thanks,
Jeremy

Future of ROOTLESS

2023-01-02 Thread Jeremy Huddleston Sequoia
Hi folks,

XQuartz is the only DDX using miext/rootless.  This code doesn't play well with 
modern X servers.  For example, it is incompatible with COMPOSITE (cf 
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1409), other rootless DDXs 
(eg: xwin, xwayland) don't make use of it, and we carry some hacks to 
miPaintWindow() in XQuartz that are too messy to upstream just to get it to 
work.

I'd like to remove miext/rootless.  Specifically, I want to move it into 
hw/xquartz and begin code-folding it away.

Is there anyone that sees any value in keeping the miext/rootless generic 
support around?



Re: GetScratchPixmapHeader / FreeScratchPixmapHeader

2022-12-21 Thread Jeremy Huddleston Sequoia
Alrighty, then here it is:

   
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1032?commit_id=5781ffcf5f3c918a97fe590ddb605fe0fefdb6ca

Thanks,
Jeremy

> On Dec 21, 2022, at 13:24, Keith Packard  wrote:
> 
> Jeremy Huddleston Sequoia  writes:
> 
>> Is there any real benefit to maintaining this released pixmap for
>> future re-use on modern hardware?  It seems like it's a bunch of code
>> complexity without much benefit.  I'm happy to nuke it completely
>> unless there are objections...
> 
> Seems reasonable -- it's just a CPU time optimization that probably
> doesn't matter much anymore. It is often used for PutImage, but that
> probably has enough overhead elsewhere to swamp malloc/free costs.
> 
> -- 
> -keith



GetScratchPixmapHeader / FreeScratchPixmapHeader

2022-12-21 Thread Jeremy Huddleston Sequoia
In triaging some issues related to pixmaps in XQuartz / rootlesss these past 
few weeks, I found it useful to just disable recycling the scratch pixmap 
header.  Specifically, in my debug build, GetScratchPixmapHeader() just does 
CreatePixmap + ModifyPixmapHeader and FreeScratchPixmapHeader() just does 
DestroyPixmap.

The reason for this is that recycling this pixmap header makes it harder for 
memory analysis tools to track the lifecycle of the allocation.  ASan, malloc 
history, et al see its lifecycle from malloc() to free(), but its real 
lifecycle is between GetScratchPixmapHeader() and FreeScratchPixmapHeader().

Is there any real benefit to maintaining this released pixmap for future re-use 
on modern hardware?  It seems like it's a bunch of code complexity without much 
benefit.  I'm happy to nuke it completely unless there are objections...

--Jeremy



Re: Making new releases of X.Org modules

2022-12-11 Thread Jeremy Huddleston Sequoia



> On Dec 8, 2022, at 16:22, Peter Hutterer  wrote:
> 
> On Thu, Dec 08, 2022 at 12:34:33PM -0800, Alan Coopersmith wrote:
>> On 12/7/22 19:07, Peter Hutterer wrote:
>>> fwiw, I've done similar things in the past, pushing a release out just
>>> to make some internal processes easier. It's simpler to update to a new
>>> version than shipping the one patch that's actually needed (and all
>>> other patches are just readme changes and whatnot).
>>> 
>>> But for me, the threshold is the tarball, not the installed files.
>>> The only time I wouldn't create a release is when the tarball is
>>> effectively identical. Which is basically anything that's CI-only.
>>> But anything that affects the delivered tarball can be subjected to a
>>> release.
>> 
>> Fair enough.
>> 
>>> This goes doubly now that many repos have changed to xz so we have a mix
>>> of tarball types too. Releasing everything in one group to get some
>>> consistency is useful.
>> 
>> That almost sounds katamari-like. Fortunately, we're getting most things
>> released without the overhead of a katamari release anyway.
> 
> biggest difference between now and the katamaris is that while 
> consistency is useful, if it takes a few months to get every package to
> catch up it's not a big deal, no need for the flag-day stress of the
> katamari.
> 
> Also for clarification, I meant "releasing everything that belongs to
> one group", e.g. releasing all the font modules so they are consistent
> with each other. I didn't mean release everything *as* one group, too
> much effort, that :)

While we're on the topic of fonts, I think it would actually be great to merge 
all the fonts into a single package like we did for all the protos.  If we 
could eliminate the configure time for ~35 packages, it would certainly help 
build times.

> 
>>> And as the font bugs show, sometimes a release is warranted just to
>>> update the tarball with more modern generated files.
>> 
>> Yeah - I know they can just run autogen.sh or autoreconf to get their
>> builds to work, but I know it's less work to just have upstream usable
>> right out of the tarball.  (And of course, once everything builds with
>> meson and the autoconf infrastructure is removed, that goes away, but
>> we don't have enough people converting modules to meson to see that yet.)
> 
> Given that there's still too much documentation that refers to only
> running configure on tarballs, I agree, they should be usable as-is
> without autoreconf.
> 
> Cheers,
>  Peter
> 
>>> IOW, let's not worry about whether releases happen too often, it's a lot
>>> easier for distributions to ignore a released tarball than it is to wish
>>> a newer one into existence :) Especially since "too often" here still
>>> means years in between the releases anyway.
>> 
>> Okay - I guess I just see things like
>> https://repology.org/project/fonts:adobe-100dpi/versions
>> or
>> https://repology.org/project/libx11/versions
>> and think about how many different packagers I'm making do work, but
>> if that work is just changing the version number of the tarball they
>> download, they should have that pretty well automated by now.
> 



Xlib contract for XEvent up/down-casting

2022-12-03 Thread Jeremy Huddleston Sequoia
I've been running XQuartz with ASan+UBSan to try to catch some issues some 
users have reported, and I stumbled across something below GLUT (specifically, 
freeglut 2.8.1), which does:

XConfigureEvent fakeEvent = {0};
...
XPutBackEvent(fgDisplay.Display, (XEvent*));

and XPutBackEvent eventually does:

XEvent store = *event;

which overflows the stack on read because:

sizeof(XConfigureEvent) == 88
sizeof(XEvent) == 192

So the problem is clear, but I'm not sure which side needs to change.

What is the contract for Xlib's APIs that take XEvent *?  Is Xlib expected to 
handle any XEvent "subtype", or does it need to be exactly an XEvent (ie: is it 
the client's responsibility to pad it)?

Xlib.h says that the XEvent union "is defined so Xlib can always use the same 
sized event structure *internally* (emphasis added), to avoid memory 
fragmentation."  This makes me think that clients should not use XEvent (and 
perhaps XEvent itself should not be API beyond being an opaque pointer).

With a quick grep through our source code, I see some (XEvent *) casting in 
many other locations (xterm, cairo, libXt, ...).  So is the burden on the 
caller to ensure that their events are properly padded into an XEvent, or is 
the burden on the recipient of an XEvent to ensure that they determine the 
event type before reading the event?

Or is this unique to XPutBackEvent(), and freeglut is abusing XPutBackEvent() 
since XPutBackEvent() should be use to "push an event back onto the head of the 
display's event queue" (meaning the event should have previously been popped 
from the queue and thus be appropriately sized, not something created on the 
stack of arbitrary size?

--Jeremy



Re: [PATCH v2 xserver 4/7] configure.ac: factor out xquartz bundle destdir

2017-04-04 Thread Jeremy Huddleston Sequoia
I'm not familiar with the problem.  Is this the canonical way to actually do 
this?  It seems a bit odd, but it looks fine to me if just a bit quirky:

Reviewed-by: Jeremy Sequoia 

> On Apr 4, 2017, at 4:49 PM, Mihail Konev  wrote:
> 
> Fixes DESTDIR not being included in x11appdir, allowing to run distcheck
> as non-root.
> 
> Signed-off-by: Mihail Konev 
> ---
> v2: Move DESTDIR to configure. Add missing Cc.
> 
> configure.ac  | 4 ++--
> hw/xquartz/bundle/Makefile.am | 8 
> 2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 3196e42df16a..7e44f2c3166c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -566,8 +566,8 @@ AC_ARG_WITH(serverconfig-path, 
> AS_HELP_STRING([--with-serverconfig-path=PATH],
>   [ SERVERCONFIG="$withval" ],
>   [ SERVERCONFIG="${libdir}/xorg" ])
> AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH],
>  [Path to the Applications directory (default: /Applications/Utilities)]),
> - [ APPLE_APPLICATIONS_DIR="${withval}" ],
> - [ 
> APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
> + [ 
> APPLE_APPLICATIONS_DIR='$(DESTDIR)'"${withval}" ],
> + [ 
> APPLE_APPLICATIONS_DIR='$(DESTDIR)'"/Applications/Utilities" ])
> AC_SUBST([APPLE_APPLICATIONS_DIR])
> AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME],
>  [Name for the .app (default: X11)]),
>   [ APPLE_APPLICATION_NAME="${withval}" ],
> diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
> index 424a7475f063..c8d29e6718c0 100644
> --- a/hw/xquartz/bundle/Makefile.am
> +++ b/hw/xquartz/bundle/Makefile.am
> @@ -11,12 +11,12 @@ CPP_FILES_FLAGS += -DXQUARTZ_SPARKLE 
> -DXQUARTZ_SPARKLE_FEED_URL="$(XQUARTZ_SPARK
> endif
> 
> install-data-hook:
> - $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) 
> $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install
> + $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) 
> $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install
> 
> uninstall-hook:
> - $(RM) -rf 
> $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/Resources
> - $(RM) -rf 
> $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/Info.plist
> - $(RM) -rf 
> $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/PkgInfo
> + $(RM) -rf 
> $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/Resources
> + $(RM) -rf 
> $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/Info.plist
> + $(RM) -rf 
> $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/PkgInfo
> 
> noinst_PRE = Info.plist.cpp
> noinst_DATA = $(noinst_PRE:plist.cpp=plist)
> -- 
> 2.9.2
> 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH v2 xserver 5/7] hw/xquartz: fix path to pseudoramiX headers

2017-04-04 Thread Jeremy Huddleston Sequoia
Thanks.

Reviewed-by: Jeremy Sequoia 

> On Apr 4, 2017, at 4:49 PM, Mihail Konev  wrote:
> 
> Fixes out-of-source XQuartz build.
> 
> Fixes: 39c548da ("XQuartz: Fix build with moved pseudoramiX")
> Signed-off-by: Mihail Konev 
> ---
> v2: Reword. Add missing Cc.
> 
> hw/xquartz/Makefile.am | 2 +-
> hw/xquartz/xpr/Makefile.am | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
> index 4da896d76173..5ccbe48917bc 100644
> --- a/hw/xquartz/Makefile.am
> +++ b/hw/xquartz/Makefile.am
> @@ -8,7 +8,7 @@ AM_CPPFLAGS = \
>   -DUSE_NEW_CLUT \
>   -DXFree86Server \
>   -I$(top_srcdir)/miext/rootless \
> - -I$(top_builddir)/pseudoramiX \
> + -I$(top_srcdir)/pseudoramiX \
>   -DX11LIBDIR=\"$(libdir)\"
> 
> if GLX
> diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am
> index c654ee595cb9..e4b138617805 100644
> --- a/hw/xquartz/xpr/Makefile.am
> +++ b/hw/xquartz/xpr/Makefile.am
> @@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libXquartzXpr.la
> AM_CFLAGS =  $(DIX_CFLAGS)
> AM_CPPFLAGS = \
>   -I$(srcdir) -I$(srcdir)/.. \
> - -I$(top_builddir)/pseudoramiX \
> + -I$(top_srcdir)/pseudoramiX \
>   -I$(top_srcdir)/miext \
>   -I$(top_srcdir)/miext/rootless
> 
> -- 
> 2.9.2
> 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [ANNOUNCE] xorg-server 1.19.2

2017-03-03 Thread Jeremy Huddleston Sequoia

> On Mar 3, 2017, at 08:50, Adam Jackson  wrote:
> 
> On Thu, 2017-03-02 at 18:13 -0500, Adam Jackson wrote:
>> A collection of stability fixes here across glamor, Xwayland, input,
>> and Prime support. Also a security fix for CVE-2017-2624, a timing
>> attack which can brute-force MIT-MAGIC-COOKIE authentication. Everybody
>> is encouraged to upgrade. Thanks to all who contributed fixes!
> 
> As several people have noticed, this tarballs is missing some of
> the standard buildsystem bits, such that you need to run autoreconf
> before ./configure. This is partly my fault for driving the release
> script incorrectly, and mostly autotools' fault for being sheer
> garbage. (Seriously, dear gnu project, please sunset autotools. It is a
> net loss to humanity at this point.)

What do you propose instead of autotools?  I agree that it is utter garbage, 
and I dislike the license ... but I certainly don't like any of the 
alternatives either.  CMake, JAM, and the rest are pretty much all crap for one 
reason or another.  And hopefully you agree that it's at least leagues better 
than imake!  If there was a good alternative, I'd be happy to help with 
transitioning us away from autotools, but I just don't see any good option.

> Once I beat the release tools into submission I'll upload 1.19.3 with
> otherwise the same content. Sorry for the mess.
> 
> - ajax
> ___
> x...@lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: https://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] inputthread: leave the main thread's name as-is

2016-10-18 Thread Jeremy Huddleston Sequoia
Shouldn't glibc be fixed instead?  Why punish the platforms that do it right?

--Jeremy

> On Oct 17, 2016, at 21:13, Peter Hutterer  wrote:
> 
> On Linux, setting the main thread's name changes the program name
> (/proc/self/comm). Setting it to MainThread breaks scripts that rely on
> the command name, e.g. ps -C Xorg.
> 
> Signed-off-by: Peter Hutterer 
> ---
> os/inputthread.c | 6 --
> 1 file changed, 6 deletions(-)
> 
> diff --git a/os/inputthread.c b/os/inputthread.c
> index 4980502..65247b4 100644
> --- a/os/inputthread.c
> +++ b/os/inputthread.c
> @@ -433,12 +433,6 @@ InputThreadPreInit(void)
> }
> hotplugPipeWrite = hotplugPipe[1];
> 
> -#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
> -pthread_setname_np (pthread_self(), "MainThread");
> -#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
> -pthread_setname_np ("MainThread");
> -#endif
> -
> }
> 
> /**
> -- 
> 2.7.4
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 3/3] glx: Initialize glx even if there are currently no screens attached

2016-10-10 Thread Jeremy Huddleston Sequoia

> On Oct 10, 2016, at 10:16, Adam Jackson <a...@nwnk.net> wrote:
> 
> On Sun, 2016-10-09 at 12:51 -0700, Jeremy Huddleston Sequoia wrote:
>> Failure to do so causes an overvlow in glxClientCallback
> 
> This patch makes no sense at all. glxClientCallback is only added to
> the call chain _after_ we check for a GL-capable visual. If that check
> is preventing GLX from initializing, then it also prevents
> glxClientCallback being called.
> 
> More to the point, the check is still correct, Mesa still needs a TC/DC
> visual to work. I suppose non-Mesa systems might not have that
> property, but a) OSX doesn't support pseudocolor GL rendering I am like
> 99% sure and b) that just means the check belongs in screen init
> instead of being deleted entirely.
> 
> What are you trying to do here?

As I mentioned in the other thread, I agree that this shouldn't do anything wrt 
to ASan report, so I'm a bit confused by that and will dig into it.

However, from a correctness standpoint, I think this is still the right 
approach.

Yes, GLX requires a GL-capable visual in order to work, but that doesn't mean 
that it needs to be present at the time that the extension is initialized.  We 
be able to start with 0 screens attached and then treat adding #1 the same as 
we would adding #2.

I agree with you that these should probably be moved into RRScreenInit / 
__glXScreenInit and will make such a change in the next round.  I want to spend 
some more time trying to figure out what was going on with the ASan report 
because indeed it doesn't make sense that this should cause it to go away.

--Jeremy

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 2/3] randr: Initialize RandR even if there are currently no screens attached

2016-10-10 Thread Jeremy Huddleston Sequoia

> On Oct 10, 2016, at 03:33, Emil Velikov <emil.l.veli...@gmail.com> wrote:
> 
> Hi Jeremy,
> 
> On 9 October 2016 at 20:51, Jeremy Huddleston Sequoia
> <jerem...@apple.com> wrote:
>> Failure to do so causes an overvlow in RRClientCallback().
>> 
> s/overvlow/overflow/

Doh, corrected the typo, thanks.

> Perhaps a slightly silly question:
> How can one end up in the callback if we haven't executed
> AddCallback(, fooCallback... ?

Not silly at all, and actually quite pointed.  The same basic question applies 
to this and the third patch in the series.

From a correctness standpoint, it makes sense that GLX and RandR should 
initialize even when the first display hasn't yet been configured.  They should 
handle attachment of the first display in much the same way they'd handle 
attaching the second or third display.

Looking at the actual change, I agree with you that one should not expect the 
change to have any impact on the reported problem because the removed 
early-exit was before AddCallback() in both cases.  I developed these changes 
against the commit that introduced the regression 
(30ac7567980a1eb79d084a63e0e74e1d9a3af673), so I just took a look at the tree 
back at that time to see if maybe something else had changed between then and 
current master to explain this.  Nothing obvious stands out, which begs the 
question of why this had any impact whatsoever on this issue.

I'm curious and will trace through it more when I get some cycles to figure out 
what's actually going on there.

In the mean time, this is still valid for correctness reasons, so I'd like to 
get some feedback on it from that angle while I try to figure out what was 
really going on in those reported overflows.

Thanks,
Jeremy



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 2/3] randr: Initialize RandR even if there are currently no screens attached

2016-10-09 Thread Jeremy Huddleston Sequoia
Failure to do so causes an overvlow in RRClientCallback().

=
==41262==ERROR: AddressSanitizer: global-buffer-overflow on address 
0x000103ccfbc8 at pc 0x0001034f32b9 bp 0x735a94c0 sp 0x735a94b8
WRITE of size 4 at 0x000103ccfbc8 thread T6
#0 0x1034f32b8 in RRClientCallback randr.c:72
#1 0x1038c75e3 in _CallCallbacks dixutils.c:737
#2 0x10388f406 in CallCallbacks callback.h:83
#3 0x1038bc49a in NextAvailableClient dispatch.c:3562
#4 0x103ad094c in AllocNewConnection connection.c:777
#5 0x103ad1695 in EstablishNewConnections connection.c:863
#6 0x1038c6630 in ProcessWorkQueue dixutils.c:523
#7 0x103ab2dbf in WaitForSomething WaitFor.c:175
#8 0x103880836 in Dispatch dispatch.c:411
#9 0x1038c2141 in dix_main main.c:301
#10 0x1032ac75a in server_thread quartzStartup.c:66
#11 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#12 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#13 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 randr/randr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/randr/randr.c b/randr/randr.c
index 0138dc1..efd3859 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -387,9 +387,6 @@ RRExtensionInit(void)
 {
 ExtensionEntry *extEntry;
 
-if (RRNScreens == 0)
-return;
-
 if (!dixRegisterPrivateKey(, PRIVATE_CLIENT,
sizeof(RRClientRec) +
screenInfo.numScreens * sizeof(RRTimesRec)))
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 3/3] glx: Initialize glx even if there are currently no screens attached

2016-10-09 Thread Jeremy Huddleston Sequoia
Failure to do so causes an overvlow in glxClientCallback

Application Specific Information:
X.Org X Server 1.18.99.1 Build Date: 20160911
=
==52118==ERROR: AddressSanitizer: SEGV on unknown address 0x000102b27b80 (pc 
0x000103433245 bp 0x7de67c20 sp 0x7de67c00 T6)
#0 0x103433244 in __asan::asan_free(void*, 
__sanitizer::BufferedStackTrace*, __asan::AllocType) 
(libclang_rt.asan_osx_dynamic.dylib+0x3244)
#1 0x10347aeee in wrap_free (libclang_rt.asan_osx_dynamic.dylib+0x4aeee)
#2 0x102e6a5ed in glxClientCallback glxext.c:301
#3 0x102b672a3 in _CallCallbacks dixutils.c:737
#4 0x102b2f0c6 in CallCallbacks callback.h:83
#5 0x102b5c15a in NextAvailableClient dispatch.c:3562
#6 0x102d7060c in AllocNewConnection connection.c:777
#7 0x102d71355 in EstablishNewConnections connection.c:863
#8 0x102b662f0 in ProcessWorkQueue dixutils.c:523
#9 0x102d52a7f in WaitForSomething WaitFor.c:175
#10 0x102b204f6 in Dispatch dispatch.c:411
#11 0x102b61e01 in dix_main main.c:301
#12 0x10254c42a in server_thread quartzStartup.c:66
#13 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#14 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#15 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 glx/glxext.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/glx/glxext.c b/glx/glxext.c
index d595a05..d216c9d 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -319,23 +319,6 @@ GlxPushProvider(__GLXprovider * provider)
 __glXProviderStack = provider;
 }
 
-static Bool
-checkScreenVisuals(void)
-{
-int i, j;
-
-for (i = 0; i < screenInfo.numScreens; i++) {
-ScreenPtr screen = screenInfo.screens[i];
-for (j = 0; j < screen->numVisuals; j++) {
-if (screen->visuals[j].class == TrueColor ||
-screen->visuals[j].class == DirectColor)
-return True;
-}
-}
-
-return False;
-}
-
 static void
 GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
 {
@@ -371,10 +354,6 @@ GlxExtensionInit(void)
 *stack = &__glXDRISWRastProvider;
 }
 
-/* Mesa requires at least one True/DirectColor visual */
-if (!checkScreenVisuals())
-return;
-
 __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
 "GLXContext");
 __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/3] os/connection: Improve abstraction for launchd secure sockets

2016-10-09 Thread Jeremy Huddleston Sequoia
This changes away from hard-coding the /tmp/launch-* path to now
supporting a generic [.]
format for $DISPLAY.

cf-libxcb: d978a4f69b30b630f28d07f1003cf290284d24d8

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Adam Jackson <a...@kemper.freedesktop.org>
---
 os/connection.c | 31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/os/connection.c b/os/connection.c
index a901ebf..0d42184 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -79,6 +79,8 @@ SOFTWARE.
 #include 
 #include 
 
+#include 
+
 #ifndef WIN32
 #include 
 
@@ -1112,15 +1114,34 @@ MakeClientGrabPervious(ClientPtr client)
 void
 ListenOnOpenFD(int fd, int noxauth)
 {
-char port[256];
+char port[PATH_MAX];
 XtransConnInfo ciptr;
 const char *display_env = getenv("DISPLAY");
 
-if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
-/* Make the path the launchd socket if our DISPLAY is set right */
-strcpy(port, display_env);
+/* First check if display_env matches a [.] scheme (eg: launchd) */
+if (display_env && display_env[0] == '/') {
+struct stat sbuf;
+
+strlcpy(port, display_env, sizeof(port));
+
+/* If the path exists, we don't have do do anything else.
+ * If it doesn't, we need to check for a . to strip off 
and recheck.
+ */
+if (0 != stat(port, )) {
+char *dot = strrchr(port, '.');
+if (dot) {
+*dot = '\0';
+
+if (0 != stat(port, )) {
+display_env = NULL;
+}
+} else {
+display_env = NULL;
+}
+}
 }
-else {
+
+if (!display_env) {
 /* Just some default so things don't break and die. */
 snprintf(port, sizeof(port), ":%d", atoi(display));
 }
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PULL] XQuartz cleanup related to inputthread changes

2016-09-22 Thread Jeremy Huddleston Sequoia
Thanks for the reviews.  Here is a pull request for the changes I've got lined 
up for XQuartz.  Note that I still have a few pending patches out for review 
(which aren't part of this PR):

  os/connection: Improve abstraction for launchd secure sockets
  randr: Initialize RandR even if there are currently no screens attached
  glx: Initialize glx even if there are currently no screens attached

Thanks,
Jeremy

---

The following changes since commit d0c5d205a919fc1d2eb599356090b58b1bf0176d:

  dix: Make InitCoreDevices() failures more verbose. (2016-09-21 21:11:40 +1000)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to f72ff1f7ac784f3911fe2f8d746f62f7709f0edc:

  XQuartz: Silence an expected TSan warning (2016-09-22 14:55:03 -0700)


Jeremy Huddleston Sequoia (6):
  dix: Silence TSan warnings when checking for pending input
  XQuartz: Don't respond to SIGALRM on the AppKit thread
  XQuartz: Remove X11ApplicationFatalError
  XQuartz: pbproxy shouldn't need to wait for server initialization.
  XQuartz: Adopt input_lock() and input_unlock()
  XQuartz: Silence an expected TSan warning

Keith Packard (2):
  os: Ready clients with pending output aren't flushed, so set 
NewOutputPending
  os: Clear saved poll events in listen so that edge triggering works

 configure.ac  |   2 +-
 dix/dispatch.c|   7 +++
 dix/main.c|  21 -
 hw/xquartz/X11Application.h   |   3 ---
 hw/xquartz/X11Application.m   |  55 
++-
 hw/xquartz/darwin.c   |   1 -
 hw/xquartz/darwinEvents.c | 125 
+
 hw/xquartz/pbproxy/app-main.m |   3 ---
 hw/xquartz/pbproxy/main.m |  18 --
 hw/xquartz/quartzStartup.c|   9 +
 include/dix.h |   6 ++
 mi/mieq.c |  22 --
 mi/mipointer.c|  12 
 os/WaitFor.c  |   2 +-
 os/io.c   |   3 ++-
 os/ospoll.c   |   8 ++--
 test/ddxstubs.c   |  16 
 17 files changed, 71 insertions(+), 242 deletions(-)



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] dix: Silence TSan warnings when checking for pending input

2016-09-22 Thread Jeremy Huddleston Sequoia

> On Sep 22, 2016, at 11:26, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> I would've but we're post API freeze at this point, yes?  Would that be ok?
> 
> Yeah, better than duplicating, and it doesn't affect the actual ABI/API
> seen to drivers.

Ok, sent update for a final r-b.

This also requires an updated release of xproto for the macros.  I sent that 
series out a few days ago but haven't had a review yet.

Are there any other changes to xproto that might be useful to make at the same 
time?  If not, I'll tag and release xproto once I get feedback on the xproto 
series.

Thanks,
Jeremy




smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] dix: Silence TSan warnings when checking for pending input

2016-09-22 Thread Jeremy Huddleston Sequoia
 pthread_mutex_init :144 
(libclang_rt.tsan_osx_dynamic.dylib+0x000253c3)
#1 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
#2 TimerSet WaitFor.c:348 (X11.bin+0x0001004926c2)
#3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d3f)
#4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069eda)
#5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467075)
#6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440379)
#7 DarwinScreenInit darwin.c:285 (X11.bin+0x00010003036b)
#8 AddScreen dispatch.c:3914 (X11.bin+0x00010036c3f7)
#9 InitOutput darwin.c:671 (X11.bin+0x00010002fd9b)
#10 dix_main main.c:197 (X11.bin+0x00010036e208)
#11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Thread T7 (tid=4257217, running) created by main thread at:
#0 pthread_create :144 
(libclang_rt.tsan_osx_dynamic.dylib+0x00024490)
#1 create_thread quartzStartup.c:78 (X11.bin+0x000100039d6d)
#2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039bd6)
#3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cd94)
#4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
#5 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
#6 do_start_x11_server bundle-main.c:436 (X11.bin+0x00012e65)
#7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x00014e49)
#8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000156e4)
#9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x00012186)
#10 start :29 (libdyld.dylib+0x5254)

SUMMARY: ThreadSanitizer: data race mieq.c:263 in mieqEnqueue
==

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Keith Packard <kei...@keithp.com>
---
 configure.ac   | 2 +-
 dix/dispatch.c | 7 +++
 include/dix.h  | 6 ++
 os/WaitFor.c   | 2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index c09b854..922ee0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -812,7 +812,7 @@ APPLEWMPROTO="applewmproto >= 1.4"
 LIBXSHMFENCE="xshmfence >= 1.1"
 
 dnl Required modules
-XPROTO="xproto >= 7.0.28"
+XPROTO="xproto >= 7.0.30"
 RANDRPROTO="randrproto >= 1.5.0"
 RENDERPROTO="renderproto >= 0.11"
 XEXTPROTO="xextproto >= 7.2.99.901"
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 26a461b..adcc9cf 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -195,7 +195,7 @@ UpdateCurrentTime(void)
 systime.milliseconds = GetTimeInMillis();
 if (systime.milliseconds < currentTime.milliseconds)
 systime.months++;
-if (*checkForInput[0] != *checkForInput[1])
+if (InputCheckPending())
 ProcessInputEvents();
 if (CompareTimeStamps(systime, currentTime) == LATER)
 currentTime = systime;
@@ -395,7 +395,6 @@ Dispatch(void)
 {
 int result;
 ClientPtr client;
-HWEventQueuePtr *icheck = checkForInput;
 long start_tick;
 
 nextFreeClientID = 1;
@@ -405,7 +404,7 @@ Dispatch(void)
 init_client_ready();
 
 while (!dispatchException) {
-if (*icheck[0] != *icheck[1]) {
+if (InputCheckPending()) {
 ProcessInputEvents();
 FlushIfCriticalOutputPending();
 }
@@ -425,7 +424,7 @@ Dispatch(void)
 
 start_tick = SmartScheduleTime;
 while (!isItTimeToYield) {
-if (*icheck[0] != *icheck[1])
+if (InputCheckPending())
 ProcessInputEvents();
 
 FlushIfCriticalOutputPending();
diff --git a/include/dix.h b/include/dix.h
index ae9719a..240018b 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -136,6 +136,12 @@ typedef HWEventQueueType *HWEventQueuePtr;
 
 extern _X_EXPORT HWEventQueuePtr checkForInput[2];
 
+static inline _X_NOTSAN Bool
+InputCheckPending(void)
+{
+return (*checkForInput[0] != *checkForInput[1]);
+}
+
 typedef struct _TimeStamp {
 CARD32 months;  /* really ~49.7 days */
 CARD32 milliseconds;
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 024df35..7d5aa32 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -234,7 +234,7 @@ WaitForSomething(Bool are_ready)
 } else
 are_ready = clients_are_ready();
 
-if (*checkForInput[0] != *checkForInput[1])
+if (InputCheckPending())
 return FALSE;
 
 if (are_ready) {
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 0/2] os: Fix write block handling in poll(2) path

2016-09-22 Thread Jeremy Huddleston Sequoia
Series is:

Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

I'd still like to get rid of the large NewOutputPending hammer, but this is 
good for now.

Thanks,
Jeremy

> On Sep 21, 2016, at 16:53, Keith Packard <kei...@keithp.com> wrote:
> 
> My previous attempt to fix this just hit the wrong variable to fix
> edge triggering; it should have reset the POLLOUT bit in
> ospoll->osfds[pos].revents instead of ospoll->fds[pos].revents. With
> that fixed, it looks like the poll(2) path is working.
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] dix: Silence TSan warnings when checking for pending input

2016-09-22 Thread Jeremy Huddleston Sequoia

> On Sep 22, 2016, at 00:22, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> +static inline _X_NOTSAN Bool
>> +InputCheckPending(void)
>> +{
>> +return (*checkForInput[0] != *checkForInput[1]);
>> +}
> 
>> +static inline _X_NOTSAN Bool
>> +InputCheckPending(void)
>> +{
>> +return (*checkForInput[0] != *checkForInput[1]);
>> +}
> 
> You should stick this in dix.h, or some other suitable header
> file.

I would've but we're post API freeze at this point, yes?  Would that be ok?



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] dix: Silence TSan warnings when checking for pending input

2016-09-19 Thread Jeremy Huddleston Sequoia
 
(libclang_rt.tsan_osx_dynamic.dylib+0x000253c3)
#1 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
#2 TimerSet WaitFor.c:348 (X11.bin+0x0001004926c2)
#3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d3f)
#4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069eda)
#5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467075)
#6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440379)
#7 DarwinScreenInit darwin.c:285 (X11.bin+0x00010003036b)
#8 AddScreen dispatch.c:3914 (X11.bin+0x00010036c3f7)
#9 InitOutput darwin.c:671 (X11.bin+0x00010002fd9b)
#10 dix_main main.c:197 (X11.bin+0x00010036e208)
#11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Thread T7 (tid=4257217, running) created by main thread at:
#0 pthread_create :144 
(libclang_rt.tsan_osx_dynamic.dylib+0x00024490)
#1 create_thread quartzStartup.c:78 (X11.bin+0x000100039d6d)
#2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039bd6)
#3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cd94)
#4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
#5 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
#6 do_start_x11_server bundle-main.c:436 (X11.bin+0x00012e65)
#7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x00014e49)
#8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000156e4)
#9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x00012186)
#10 start :29 (libdyld.dylib+0x5254)

SUMMARY: ThreadSanitizer: data race mieq.c:263 in mieqEnqueue
==

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 configure.ac   |  2 +-
 dix/dispatch.c | 13 +
 os/WaitFor.c   |  8 +++-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 190e473..349c46a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -812,7 +812,7 @@ APPLEWMPROTO="applewmproto >= 1.4"
 LIBXSHMFENCE="xshmfence >= 1.1"
 
 dnl Required modules
-XPROTO="xproto >= 7.0.28"
+XPROTO="xproto >= 7.0.30"
 RANDRPROTO="randrproto >= 1.5.0"
 RENDERPROTO="renderproto >= 0.11"
 XEXTPROTO="xextproto >= 7.2.99.901"
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 26a461b..0a50182 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -183,6 +183,12 @@ SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
 checkForInput[1] = c1;
 }
 
+static inline _X_NOTSAN Bool
+InputCheckPending(void)
+{
+return (*checkForInput[0] != *checkForInput[1]);
+}
+
 void
 UpdateCurrentTime(void)
 {
@@ -195,7 +201,7 @@ UpdateCurrentTime(void)
 systime.milliseconds = GetTimeInMillis();
 if (systime.milliseconds < currentTime.milliseconds)
 systime.months++;
-if (*checkForInput[0] != *checkForInput[1])
+if (InputCheckPending())
 ProcessInputEvents();
 if (CompareTimeStamps(systime, currentTime) == LATER)
 currentTime = systime;
@@ -395,7 +401,6 @@ Dispatch(void)
 {
 int result;
 ClientPtr client;
-HWEventQueuePtr *icheck = checkForInput;
 long start_tick;
 
 nextFreeClientID = 1;
@@ -405,7 +410,7 @@ Dispatch(void)
 init_client_ready();
 
 while (!dispatchException) {
-if (*icheck[0] != *icheck[1]) {
+if (InputCheckPending()) {
 ProcessInputEvents();
 FlushIfCriticalOutputPending();
 }
@@ -425,7 +430,7 @@ Dispatch(void)
 
 start_tick = SmartScheduleTime;
 while (!isItTimeToYield) {
-if (*icheck[0] != *icheck[1])
+if (InputCheckPending())
 ProcessInputEvents();
 
 FlushIfCriticalOutputPending();
diff --git a/os/WaitFor.c b/os/WaitFor.c
index cde2c8c..8db8307 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -134,6 +134,12 @@ first_timer(void)
 return xorg_list_first_entry(, struct _OsTimerRec, list);
 }
 
+static inline _X_NOTSAN Bool
+InputCheckPending(void)
+{
+return (*checkForInput[0] != *checkForInput[1]);
+}
+
 /*
  * Compute timeout until next timer, running
  * any expired timers
@@ -234,7 +240,7 @@ WaitForSomething(Bool are_ready)
 } else
 are_ready = clients_are_ready();
 
-if (*checkForInput[0] != *checkForInput[1])
+if (InputCheckPending())
 return FALSE;
 
 if (are_ready) {
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xproto 3/4] Xfuncproto: Add support for _X_DEPRECATED_MSG() macro

2016-09-19 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xfuncproto.h.in | 8 
 1 file changed, 8 insertions(+)

diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index 7f06e99..8a9530a 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -137,6 +137,14 @@ in this Software without prior written authorization from 
The Open Group.
 # define _X_DEPRECATED
 #endif
 
+/* requires xproto >= 7.0.30 */
+#if __has_extension(attribute_deprecated_with_message) || \
+(defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && 
(__GNUC_MINOR__ >= 5
+# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg)))
+#else
+# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED
+#endif
+
 /* requires xproto >= 7.0.17 */
 #if __has_attribute(noreturn) \
 || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xproto 1/4] Xfuncproto.h: Define __has_feature() if it isn't already

2016-09-19 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xfuncproto.h.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index 5daa83e..8556c27 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -79,6 +79,9 @@ in this Software without prior written authorization from The 
Open Group.
 #ifndef __has_attribute
 # define __has_attribute(x) 0  /* Compatibility with non-clang compilers. */
 #endif
+#ifndef __has_feature
+# define __has_feature(x) 0/* Compatibility with non-clang compilers. */
+#endif
 
 /* Added in X11R6.9, so available in any version of modular xproto */
 #if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xproto 4/4] Xfuncproto: Add support for _X_NOTSAN macro

2016-09-19 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xfuncproto.h.in | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index 8a9530a..8715c9d 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -210,4 +210,11 @@ in this Software without prior written authorization from 
The Open Group.
 # endif
 #endif
 
+/* requires xproto >= 7.0.30 */
+#if __has_attribute(no_sanitize_thread)
+# define _X_NOTSAN __attribute__((no_sanitize_thread))
+#else
+# define _X_NOTSAN
+#endif
+
 #endif /* _XFUNCPROTO_H_ */
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xproto 2/4] Xfuncproto.h: Define __has_extension() if it isn't already

2016-09-19 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xfuncproto.h.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index 8556c27..7f06e99 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -82,6 +82,9 @@ in this Software without prior written authorization from The 
Open Group.
 #ifndef __has_feature
 # define __has_feature(x) 0/* Compatibility with non-clang compilers. */
 #endif
+#ifndef __has_extension
+# define __has_extenstion(x) 0 /* Compatibility with non-clang compilers. */
+#endif
 
 /* Added in X11R6.9, so available in any version of modular xproto */
 #if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] dix: Hold the input_lock() when accessing the miEventQueue through checkForInput

2016-09-19 Thread Jeremy Huddleston Sequoia

> On Sep 19, 2016, at 09:52, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> Yeah, I made the change mainly to shutup the analyzer while I was
>> looking for other races.  I decided to propose it in case we want to
>> be strict here.
> 
> Thanks. Keeping our request processing overhead low seems important
> enough to me that we should skip this patch, although perhaps adding a
> comment before the test noting that we are intentionally not holding the
> input lock.
> 
> Is there some way we can annotate the code to silence the analyzer in
> these cases?

The annotation is at a per-function level.  We can basically say "if you notice 
data races in this funciton, don't bother reporting them".  I'm doing this for 
a similar case where we want to limit overhead on the fastpath in 
darwinEvents.c.  In the code below, TSan would normally complain about the read 
of mieqInitialized without holding the mieqInitializedMutex, but we know it's 
actually safe in this case.

We could add something like _X_NOTSAN to Xfuncproto.h to cover this and then 
break out the actual comparisons into an inline function with that attribute.  
Breaking that out into separate inline functions allows us to surgically apply 
no_sanitize_thread. 

Thoughts?


static BOOL mieqInitialized;
static pthread_mutex_t mieqInitializedMutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t mieqInitializedCond = PTHREAD_COND_INITIALIZER;

#ifdef __has_feature
# if __has_feature(thread_sanitizer)
#  define __tsan_ignore __attribute__((no_sanitize_thread))
# else
#  define __tsan_ignore /**/
# endif
#else
# define __tsan_ignore /**/
#endif

__tsan_ignore
extern inline void
wait_for_mieq_init(void)
{
if (!mieqInitialized) {
pthread_mutex_lock();
while (!mieqInitialized) {
pthread_cond_wait(, );
}
pthread_mutex_unlock();
}
}

__tsan_ignore
static inline void
signal_mieq_init(void)
{
pthread_mutex_lock();
mieqInitialized = TRUE;
pthread_cond_broadcast();
pthread_mutex_unlock();
}



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] dix: Hold the input_lock() when accessing the miEventQueue through checkForInput

2016-09-19 Thread Jeremy Huddleston Sequoia

> On Sep 19, 2016, at 08:30, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> ==
>> WARNING: ThreadSanitizer: data race (pid=4943)
>>  Read of size 4 at 0x00010c4e3854 by thread T8:
>>#0 WaitForSomething WaitFor.c:237 (X11.bin+0x00010049216c)
>>#1 Dispatch dispatch.c:413 (X11.bin+0x000100352ed9)
>>#2 dix_main main.c:287 (X11.bin+0x00010036e894)
>>#3 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)
>> 
>>  Previous write of size 4 at 0x00010c4e3854 by thread T12 (mutexes: write 
>> M856, write M1976):
>>#0 mieqEnqueue mieq.c:263 (X11.bin+0x000100448d14)
>>#1 DarwinSendDDXEvent darwinEvents.c:641 (X11.bin+0x000100033613)
>>#2 DarwinProcessFDAdditionQueue_thread darwinEvents.c:338 
>> (X11.bin+0x000100032039)
> 
> I'm not sure I want to resolve this "bug" -- the event queue has been
> designed to be safe in a lockless threaded environment as it was originally
> designed to directly map a kernel address which would be modified at
> interrupt time. Is there an actual issue with the design?

Yeah, I made the change mainly to shutup the analyzer while I was looking for 
other races.  I decided to propose it in case we want to be strict here.

I don't see an absolute need to do this.  The code looks perfectly safe to me 
without this change because the data is only read and compared.  There could be 
issues with reads being nonatomic and getting back some meaningless value, but 
the outcome of that failure would just be an extra unneeded call into 
ProcessInputEvents(), which is perfectly safe.



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: os/log.c thread safety

2016-09-19 Thread Jeremy Huddleston Sequoia

> On Sep 18, 2016, at 21:58, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> [ Unknown signature status ]
>> I noticed a data race in XQuartz.  We call ErrorF in a couple places off of 
>> the main server thread.  I could fix it by simply moving this logging onto 
>> the server thread (or not doing it with os/log), but with the split of 
>> InputThread off of MainThread, I'm wondering if it would be better to 
>> instead make ErrorF thread safe.
>> 
>> Thoughts?
> 
> If we use ErrorF in server abort paths, then any thread safety might
> block the server shutdown, which would be bad...

Yeah, good point.

So then what should be the logging story for things on the input thread?  
XQuartz's AppKit thread is basically in the same boat, so I'd prefer to not do 
two different things.  Should we just use TLS and expect collisions to resolve 
unfortunately?

FWIW, the issues surround these globals:
bufferUnused
bufferPos
LogSWrite.newline



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] dix: Hold the input_lock() when accessing the miEventQueue through checkForInput

2016-09-19 Thread Jeremy Huddleston Sequoia
 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
#2 TimerSet WaitFor.c:348 (X11.bin+0x0001004926c2)
#3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d3f)
#4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069eda)
#5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467075)
#6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440379)
#7 DarwinScreenInit darwin.c:285 (X11.bin+0x00010003036b)
#8 AddScreen dispatch.c:3914 (X11.bin+0x00010036c3f7)
#9 InitOutput darwin.c:671 (X11.bin+0x00010002fd9b)
#10 dix_main main.c:197 (X11.bin+0x00010036e208)
#11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Thread T7 (tid=4257217, running) created by main thread at:
#0 pthread_create :144 
(libclang_rt.tsan_osx_dynamic.dylib+0x00024490)
#1 create_thread quartzStartup.c:78 (X11.bin+0x000100039d6d)
#2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039bd6)
#3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cd94)
#4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
#5 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
#6 do_start_x11_server bundle-main.c:436 (X11.bin+0x00012e65)
#7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x00014e49)
#8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000156e4)
#9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x00012186)
#10 start :29 (libdyld.dylib+0x5254)

SUMMARY: ThreadSanitizer: data race mieq.c:263 in mieqEnqueue
==

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 dix/dispatch.c | 21 ++---
 os/WaitFor.c   |  7 ++-
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 26a461b..dbf7f97 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -186,6 +186,7 @@ SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
 void
 UpdateCurrentTime(void)
 {
+Bool input_pending;
 TimeStamp systime;
 
 /* To avoid time running backwards, we must call GetTimeInMillis before
@@ -195,7 +196,12 @@ UpdateCurrentTime(void)
 systime.milliseconds = GetTimeInMillis();
 if (systime.milliseconds < currentTime.milliseconds)
 systime.months++;
-if (*checkForInput[0] != *checkForInput[1])
+
+input_lock();
+input_pending = (*checkForInput[0] != *checkForInput[1]);
+input_unlock();
+
+if (input_pending)
 ProcessInputEvents();
 if (CompareTimeStamps(systime, currentTime) == LATER)
 currentTime = systime;
@@ -397,6 +403,7 @@ Dispatch(void)
 ClientPtr client;
 HWEventQueuePtr *icheck = checkForInput;
 long start_tick;
+Bool input_pending;
 
 nextFreeClientID = 1;
 nClients = 0;
@@ -405,7 +412,11 @@ Dispatch(void)
 init_client_ready();
 
 while (!dispatchException) {
-if (*icheck[0] != *icheck[1]) {
+input_lock();
+input_pending = (*icheck[0] != *icheck[1]);
+input_unlock();
+
+if (input_pending) {
 ProcessInputEvents();
 FlushIfCriticalOutputPending();
 }
@@ -425,7 +436,11 @@ Dispatch(void)
 
 start_tick = SmartScheduleTime;
 while (!isItTimeToYield) {
-if (*icheck[0] != *icheck[1])
+input_lock();
+input_pending = (*icheck[0] != *icheck[1]);
+input_unlock();
+
+if (input_pending)
 ProcessInputEvents();
 
 FlushIfCriticalOutputPending();
diff --git a/os/WaitFor.c b/os/WaitFor.c
index cde2c8c..a559ec3 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -186,6 +186,7 @@ WaitForSomething(Bool are_ready)
 int pollerr;
 static Bool were_ready;
 Bool timer_is_running;
+Bool input_pending;
 
 timer_is_running = were_ready;
 
@@ -234,7 +235,11 @@ WaitForSomething(Bool are_ready)
 } else
 are_ready = clients_are_ready();
 
-if (*checkForInput[0] != *checkForInput[1])
+input_lock();
+input_pending = (*checkForInput[0] != *checkForInput[1]);
+input_unlock();
+
+if (input_pending)
 return FALSE;
 
 if (are_ready) {
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] dix: Make InitCoreDevices() failures more verbose.

2016-09-19 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 dix/devices.c | 37 ++---
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index 56aae85..ea3c6c8 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -709,17 +709,32 @@ CorePointerProc(DeviceIntPtr pDev, int what)
 void
 InitCoreDevices(void)
 {
-if (AllocDevicePair(serverClient, "Virtual core",
-, ,
-CorePointerProc, CoreKeyboardProc, TRUE) != Success)
- FatalError("Failed to allocate core devices");
-
-if (ActivateDevice(inputInfo.pointer, TRUE) != Success ||
-ActivateDevice(inputInfo.keyboard, TRUE) != Success)
- FatalError("Failed to activate core devices.");
-if (!EnableDevice(inputInfo.pointer, TRUE) ||
-!EnableDevice(inputInfo.keyboard, TRUE))
- FatalError("Failed to enable core devices.");
+int result;
+
+result = AllocDevicePair(serverClient, "Virtual core",
+ , ,
+ CorePointerProc, CoreKeyboardProc, TRUE);
+if (result != Success) {
+FatalError("Failed to allocate virtual core devices: %d", result);
+}
+
+result = ActivateDevice(inputInfo.pointer, TRUE);
+if (result != Success) {
+FatalError("Failed to activate virtual core pointer: %d", result);
+}
+
+result = ActivateDevice(inputInfo.keyboard, TRUE);
+if (result != Success) {
+FatalError("Failed to activate virtual core keyboard: %d", result);
+}
+
+if (!EnableDevice(inputInfo.pointer, TRUE)) {
+ FatalError("Failed to enable virtual core pointer.");
+}
+
+if (!EnableDevice(inputInfo.keyboard, TRUE)) {
+ FatalError("Failed to enable virtual core keyboard.");
+}
 
 InitXTestDevices();
 }
-- 
2.10.0 (Apple Git-77)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

os/log.c thread safety

2016-09-18 Thread Jeremy Huddleston Sequoia
I noticed a data race in XQuartz.  We call ErrorF in a couple places off of the 
main server thread.  I could fix it by simply moving this logging onto the 
server thread (or not doing it with os/log), but with the split of InputThread 
off of MainThread, I'm wondering if it would be better to instead make ErrorF 
thread safe.

Thoughts?

--Jeremy




smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/2] os/connection: Call ClientReady() based on a level trigger rather than an edge trigger

2016-09-18 Thread Jeremy Huddleston Sequoia

> On Sep 18, 2016, at 09:58, Keith Packard  wrote:
> 
> Matthieu Herrb  writes:
> 
>> this doesn't fix an issue I'm seeing on OpenBSD with xterm not beeing
>> able to start (it makes the X server spin at 100% CPU in
>> WaitForSomething()), while Jeremy's patches do fix the issue for me.
> 
> I think Jeremy's patch will cause the server to spin while any client is
> not writable, which isn't good.

I don't believe that is the case because ClientReady does:

ospoll_mute(server_poll, fd, X_NOTIFY_WRITE);

If I read the flow right, the level trigger causes WaitForSomething to spin up 
only when a client is ready to receive data.  ClientReady then mutes the 
trigger.  FlushClient then possibly re-enables it if we EAGAIN.  If/when the 
client is ready again (level trigger), ClientReady will fire again.

If the client is not ready to receive data, ClientReady won't fire.

My patch does indeed cause us to needlessly FlushAllOutput() if something else 
(eg: a new connection, new request) causes WaitForSomething() to spin up, but 
that's no different than someone currently just setting NewOutputPending=YES 
even though there is no pending output.

>> I've not been able to really understand the issue yet, but that's a
>> data point. (And I'm glad to see that it doesn't seem to be an OpenBSD
>> specific issue :)
> 
> I'd bet anyone using poll(2) instead of epoll(2) will see the same
> problems. It should be possible to reproduce this on Linux by using the
> poll path instead of epoll.




smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 2/2] os/connection: Remove NewOutputPending

2016-09-18 Thread Jeremy Huddleston Sequoia

> On Sep 18, 2016, at 08:51, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> Use any_output_pending() instead.
> 
> These aren't equivalent -- NewOutputPending is set when there is output
> pending and we haven't detected that all of the clients with output
> are blocked.

The comment says that NewOutputPending is set when there is output that hasn't 
been attempted yet, which is slightly different.  The usage doesn't match the 
name/comment, so it is a tad confusing trying to see where it should or should 
not be set.

> There's a patch for a bug in FlushAllOutput to set NewOutputPending when
> we skip a client that has pending input. I attached that to my previous
> message in this thread.
> 
> I think an alternative would be to remove write blocked clients from the
> output pending list and re-add them when they became writable
> again. Then we could use any_output_pending() instead of NewOutputPending.

Yeah, I was not liking the behavior of "something is ready, so try everything" 
that NewOutputPending is part of.

I like the idea of only iterating over a list of clients that are expected to 
be unblocked.

---

> On Sep 18, 2016, at 08:42, Keith Packard <kei...@keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jerem...@apple.com> writes:
> 
>> On encountering an EAGAIN, FlushClient() re-adds the client to the
>> pending list and returns, but FlushClient() doesn't get called again.
>> We would expect it to be called via FlushAllOutput() via
>> WaitForSomething(), but that only happens when NewOutputPending is
>> set.  FlushAllOutput() also early-exits if NewOutputPending is not
>> set.
>> 
>> The only place that is setting NewOutputPending is ClientReady().  The
>> problem there is that ClientReady() is called based on an edge trigger
>> and not a level trigger.
> 
> Hrm. I think this is a problem with our emulation of edge triggers as we
> don't tell the ospoll layer when we've detected that the client is not
> writable.
> 
> This should fix that; it makes the edge re-trigger whenever we start
> listening again:
> 
> diff --git a/os/ospoll.c b/os/ospoll.c
> index b00d422..8c99501 100644
> --- a/os/ospoll.c
> +++ b/os/ospoll.c
> @@ -352,10 +352,14 @@ ospoll_listen(struct ospoll *ospoll, int fd, int 
> xevents)
> epoll_mod(ospoll, osfd);
> #endif
> #if POLL
> -if (xevents & X_NOTIFY_READ)
> +if (xevents & X_NOTIFY_READ) {
> ospoll->fds[pos].events |= POLLIN;
> -if (xevents & X_NOTIFY_WRITE)
> +ospoll->fds[pos].revents &= ~POLLIN;
> +}
> +if (xevents & X_NOTIFY_WRITE) {
> ospoll->fds[pos].events |= POLLOUT;
> +ospoll->fds[pos].revents &= ~POLLOUT;
> +}
> #endif
> }
> }
> 
> I did find a bug with the NewOutputPending flag. We don't actually flush
> the client's buffer if there are still requests queued. This is a change
> From the previous behavior.
> 
> diff --git a/os/io.c b/os/io.c
> index ff0ec3d..c6db028 100644
> --- a/os/io.c
> +++ b/os/io.c
> @@ -615,6 +615,8 @@ FlushAllOutput(void)
> if (!client_is_ready(client)) {
> oc = (OsCommPtr) client->osPrivate;
> (void) FlushClient(client, oc, (char *) NULL, 0);
> +} else {
> +NewOutputPending = TRUE;
> }
> }
> }

The issue remains with just these two changes applied.

In my particular case, !client_is_ready(client), so we're not hitting that 
second bug, but yes, it would definitely be an issue.

IMO, it would be best to not have a NewOutputPending boolean at all and base it 
solely on the list of pending clients (with the optimization of removing 
EWOULDBLOCK clients until they are ready for data).



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

CARD32 vs uint32_t

2016-09-17 Thread Jeremy Huddleston Sequoia
libXfont2's _xfont2_client_funcs struct has a get_time_in_millis entry that is 
declared as 'uint32_t (*get_time_in_millis)(void);'

xserver tries to use GetTimeInMillis for this, but it is declared as 'CARD32 
GetTimeInMillis(void)'.  The issue is that CARD32 is actually 'unsigned long' 
on i386, so the compiler complains about the possible mismatch (even though int 
and long are the same in such a configuration).

dixfonts.c:2028:27: warning: incompatible pointer types initializing 'uint32_t 
(*)(void)' (aka 'unsigned int (*)(void)') with an expression of type 'CARD32 
(void)'
  (aka 'unsigned long (void)') [-Wincompatible-pointer-types,Semantic Issue]
.get_time_in_millis = GetTimeInMillis,
  ^~~
1 warning generated.


I'd really like to see us use stdint.h in Xmd.h.  Are there any arguments 
against doing such a change?



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: XLoadQueryFont() not returning with recent xserver master

2016-09-17 Thread Jeremy Huddleston Sequoia
I tracked it down to _XSERVTransWritev returning -1 with errno=EAGAIN within 
FlushClient().  I was able to workaround the issue by immediately retrying 
(usually once, sometimes twice).

The problem is with the existing EAGAIN error handling.  FlushClient() re-adds 
the client to the pending list and returns, but FlushClient() doesn't get 
called again.  We would expect it to be called via FlushAllOutput() via 
WaitForSomething(), but that only happens when NewOutputPending is set.  
FlushAllOutput() also early-exits if NewOutputPending is not set.

The only place that is setting NewOutputPending is ClientReady().  The problem 
there is that ClientReady() is called based on an edge trigger and not a level 
trigger.  I'll be sending a patch for that in a moment, but I have a followup 
question from all of this...  should we even have NewOutputPending any more?  
Should we just check any_output_pending()?

The following two patches for consideration address these points.

Thanks,
Jeremy


> On Sep 16, 2016, at 23:16, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> I bisected the issue to:
> 
> f993091e7db81b0420e23c485378cba112278839 is the first bad commit
> commit f993091e7db81b0420e23c485378cba112278839
> Author: Keith Packard <kei...@keithp.com>
> Date:   Thu May 26 10:40:44 2016 -0700
> 
>os: Switch server to poll(2) [v3]
> 
>Eliminates all of the fd_set mangling in the server main thread
> 
>v2: Listen for POLLOUT while writes are blocked.
> 
>v3: Only mark client not ready on EAGAIN return from read
> 
>Signed-off-by: Keith Packard <kei...@keithp.com>
>Reviewed-by: Adam Jackson <a...@redhat.com>
> 
> ---
> 
> I'll see if I can dig into it a bit later, but my time is a bit thin.  If 
> anyone else has a hunch as to what might be going on to narrow my search, I'd 
> appreciate it.  If not, I'll probably start by taking a closer look at this 
> particular change to understand what's going wrong.
> 
> Thanks,
> Jeremy
> 
>> On Sep 11, 2016, at 16:54, Jeremy Huddleston Sequoia <jerem...@apple.com> 
>> wrote:
>> 
>> Upon a bit more digging, it looks like the clients are listed in 
>> output_pending_clients, but it's not getting delivered.
>> 
>> This situation reveals another issue with a use-after-free during 
>> CloseDownClient() in which a client will get re-added to the 
>> output_pending_clients during FlushClient() as part of CloseDownConnection().
>> 
>> See https://bugs.freedesktop.org/show_bug.cgi?id=97770 for more details on 
>> that.
>> 
>>> On Sep 11, 2016, at 12:24, Jeremy Huddleston Sequoia <jerem...@apple.com> 
>>> wrote:
>>> 
>>> Using current master plus the various patches I submitted to the list last 
>>> night, I'm able to launch the server fairly reliably under ASan again, but 
>>> some clients are getting wedged.  Most notably, xterm gets stuck waiting 
>>> for a reply from XLoadQueryFont().  Looking at the state of the server 
>>> threads, it looks fine.  It's processing other requests just fine from 
>>> other clients.
>>> 
>>> Has anyone noticed anything odd like this or have some hunch as to where I 
>>> might start looking other than to do yet another bisect? =/
>>> 
>>> Thread 0x344e96   DispatchQueue 1   1000 samples (1-1000)   
>>>   priority 31 (base 31)
>>> 1000  start + 52 (xterm + 6312) [0x10d3bf8a8]
>>>  1000  main + 3752 (xterm + 146228) [0x10d3e1b34]
>>>1000  spawnXTerm + 977 (xterm + 148776) [0x10d3e2528]
>>>  1000  VTInit + 22 (xterm + 68248) [0x10d3cea98]
>>>1000  XtRealizeWidget + 135 (libXt.6.dylib + 84572) [0x10d4ffa5c]
>>>  1000  RealizeWidget + 871 (libXt.6.dylib + 85805) [0x10d4fff2d]
>>>1000  RealizeWidget + 365 (libXt.6.dylib + 85299) [0x10d4ffd33]
>>>  1000  VTRealize + 324 (xterm + 82404) [0x10d3d21e4]
>>>1000  SetVTFont + 335 (xterm + 121728) [0x10d3dbb80]
>>>  1000  xtermLoadFont + 514 (xterm + 114081) [0x10d3d9da1]
>>>1000  xtermOpenFont + 86 (xterm + 112342) [0x10d3d96d6]
>>>  1000  XLoadQueryFont + 311 (libX11.6.dylib + 29419) 
>>> [0x10d54f2eb]
>>>1000  _XQueryFont + 163 (libX11.6.dylib + 32127) 
>>> [0x10d54fd7f]
>>>  1000  _XReply + 279 (libX11.6.dylib + 143484) 
>>> [0x10d56b07c]
>>>1000  xcb_wait_for_reply + 103 (libxcb.1.dylib + 
>>> 8247) [0x10d711037]
>>>   

[PATCH 1/2] os/connection: Call ClientReady() based on a level trigger rather than an edge trigger

2016-09-17 Thread Jeremy Huddleston Sequoia
On encountering an EAGAIN, FlushClient() re-adds the client to the pending list
and returns, but FlushClient() doesn't get called again.  We would expect it to
be called via FlushAllOutput() via WaitForSomething(), but that only happens
when NewOutputPending is set.  FlushAllOutput() also early-exits if
NewOutputPending is not set.

The only place that is setting NewOutputPending is ClientReady().  The problem
there is that ClientReady() is called based on an edge trigger and not a level
trigger.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Keith Packard <kei...@keithp.com>
---
 os/connection.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/os/connection.c b/os/connection.c
index 0d42184..4630438 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -749,7 +749,7 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, 
CARD32 conn_time)
 SetConnectionTranslation(fd, client->index);
 #endif
 ospoll_add(server_poll, fd,
-   ospoll_trigger_edge,
+   ospoll_trigger_level,
ClientReady,
client);
 set_poll_client(client);
-- 
2.10.0 (Apple Git-99)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 2/2] os/connection: Remove NewOutputPending

2016-09-17 Thread Jeremy Huddleston Sequoia
Use any_output_pending() instead.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Keith Packard <kei...@keithp.com>
---
 os/WaitFor.c| 2 +-
 os/connection.c | 2 --
 os/io.c | 5 +
 os/osdep.h  | 2 --
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/os/WaitFor.c b/os/WaitFor.c
index 024df35..cde2c8c 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -213,7 +213,7 @@ WaitForSomething(Bool are_ready)
 timeout = check_timers();
 
 BlockHandler();
-if (NewOutputPending)
+if (any_output_pending())
 FlushAllOutput();
 /* keep this check close to select() call to minimize race */
 if (dispatchException)
diff --git a/os/connection.c b/os/connection.c
index 4630438..dd0a25a 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -123,7 +123,6 @@ SOFTWARE.
 struct ospoll   *server_poll;
 
 int MaxClients = 0;
-Bool NewOutputPending;  /* not yet attempted to write some new output 
*/
 Bool NoListenAll;   /* Don't establish any listening sockets */
 
 static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
@@ -714,7 +713,6 @@ ClientReady(int fd, int xevents, void *data)
 mark_client_ready(client);
 if (xevents & X_NOTIFY_WRITE) {
 ospoll_mute(server_poll, fd, X_NOTIFY_WRITE);
-NewOutputPending = TRUE;
 }
 }
 
diff --git a/os/io.c b/os/io.c
index ff0ec3d..0ebff08 100644
--- a/os/io.c
+++ b/os/io.c
@@ -596,7 +596,7 @@ FlushAllOutput(void)
 {
 OsCommPtr oc;
 register ClientPtr client, tmp;
-Bool newoutput = NewOutputPending;
+Bool newoutput = any_output_pending();
 
 if (!newoutput)
 return;
@@ -607,7 +607,6 @@ FlushAllOutput(void)
  * simply wait for the select to tell us when he's ready to receive.
  */
 CriticalOutputPending = FALSE;
-NewOutputPending = FALSE;
 
 xorg_list_for_each_entry_safe(client, tmp, _pending_clients, 
output_pending) {
 if (client->clientGone)
@@ -761,13 +760,11 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
 output_pending_clear(who);
 if (!any_output_pending()) {
 CriticalOutputPending = FALSE;
-NewOutputPending = FALSE;
 }
 
 return FlushClient(who, oc, buf, count);
 }
 
-NewOutputPending = TRUE;
 output_pending_mark(who);
 memmove((char *) oco->buf + oco->count, buf, count);
 oco->count += count;
diff --git a/os/osdep.h b/os/osdep.h
index 90a247f..9c8bd48 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -165,8 +165,6 @@ extern void SetConnectionTranslation(int conn, int client);
 extern void ClearConnectionTranslation(void);
 #endif
 
-extern Bool NewOutputPending;
-
 extern WorkQueuePtr workQueue;
 
 /* in WaitFor.c */
-- 
2.10.0 (Apple Git-99)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: XLoadQueryFont() not returning with recent xserver master

2016-09-17 Thread Jeremy Huddleston Sequoia
I bisected the issue to:

f993091e7db81b0420e23c485378cba112278839 is the first bad commit
commit f993091e7db81b0420e23c485378cba112278839
Author: Keith Packard <kei...@keithp.com>
Date:   Thu May 26 10:40:44 2016 -0700

os: Switch server to poll(2) [v3]

Eliminates all of the fd_set mangling in the server main thread

v2: Listen for POLLOUT while writes are blocked.

v3: Only mark client not ready on EAGAIN return from read

Signed-off-by: Keith Packard <kei...@keithp.com>
Reviewed-by: Adam Jackson <a...@redhat.com>

---

I'll see if I can dig into it a bit later, but my time is a bit thin.  If 
anyone else has a hunch as to what might be going on to narrow my search, I'd 
appreciate it.  If not, I'll probably start by taking a closer look at this 
particular change to understand what's going wrong.

Thanks,
Jeremy

> On Sep 11, 2016, at 16:54, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> Upon a bit more digging, it looks like the clients are listed in 
> output_pending_clients, but it's not getting delivered.
> 
> This situation reveals another issue with a use-after-free during 
> CloseDownClient() in which a client will get re-added to the 
> output_pending_clients during FlushClient() as part of CloseDownConnection().
> 
> See https://bugs.freedesktop.org/show_bug.cgi?id=97770 for more details on 
> that.
> 
>> On Sep 11, 2016, at 12:24, Jeremy Huddleston Sequoia <jerem...@apple.com> 
>> wrote:
>> 
>> Using current master plus the various patches I submitted to the list last 
>> night, I'm able to launch the server fairly reliably under ASan again, but 
>> some clients are getting wedged.  Most notably, xterm gets stuck waiting for 
>> a reply from XLoadQueryFont().  Looking at the state of the server threads, 
>> it looks fine.  It's processing other requests just fine from other clients.
>> 
>> Has anyone noticed anything odd like this or have some hunch as to where I 
>> might start looking other than to do yet another bisect? =/
>> 
>> Thread 0x344e96   DispatchQueue 1   1000 samples (1-1000)
>>  priority 31 (base 31)
>> 1000  start + 52 (xterm + 6312) [0x10d3bf8a8]
>>   1000  main + 3752 (xterm + 146228) [0x10d3e1b34]
>> 1000  spawnXTerm + 977 (xterm + 148776) [0x10d3e2528]
>>   1000  VTInit + 22 (xterm + 68248) [0x10d3cea98]
>> 1000  XtRealizeWidget + 135 (libXt.6.dylib + 84572) [0x10d4ffa5c]
>>   1000  RealizeWidget + 871 (libXt.6.dylib + 85805) [0x10d4fff2d]
>> 1000  RealizeWidget + 365 (libXt.6.dylib + 85299) [0x10d4ffd33]
>>   1000  VTRealize + 324 (xterm + 82404) [0x10d3d21e4]
>> 1000  SetVTFont + 335 (xterm + 121728) [0x10d3dbb80]
>>   1000  xtermLoadFont + 514 (xterm + 114081) [0x10d3d9da1]
>> 1000  xtermOpenFont + 86 (xterm + 112342) [0x10d3d96d6]
>>   1000  XLoadQueryFont + 311 (libX11.6.dylib + 29419) 
>> [0x10d54f2eb]
>> 1000  _XQueryFont + 163 (libX11.6.dylib + 32127) 
>> [0x10d54fd7f]
>>   1000  _XReply + 279 (libX11.6.dylib + 143484) 
>> [0x10d56b07c]
>> 1000  xcb_wait_for_reply + 103 (libxcb.1.dylib + 
>> 8247) [0x10d711037]
>>   1000  wait_for_reply + 251 (libxcb.1.dylib + 
>> 8521) [0x10d711149]
>> 1000  _xcb_conn_wait + 466 (libxcb.1.dylib + 
>> 4166) [0x10d710046]
>>   1000  _xcb_in_read + 1051 (libxcb.1.dylib 
>> + 12750) [0x10d7121ce]
>> 1000  __select + 10 
>> (libsystem_kernel.dylib + 106318) [0x7fffc5e2df4e]
>>  *1000  _sleep_continue + 0 
>> (kernel.development + 7459248) [0xff800091d1b0]
>> 
>> 
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [ANNOUNCE] xorg-server 1.18.99.2

2016-09-16 Thread Jeremy Huddleston Sequoia

> On Sep 16, 2016, at 13:57, Keith Packard  wrote:
> 
> 
> I think we're ready for RC1 at this point, but wanted to give people a
> chance to scream about "just one more API change" until tomorrow. Let me
> know if there's something I'm missing; if I don't hear anything, I'll be
> tagging RC1 in the morning.

IMO, we're not quite RC quality on master, so tagging it that way feels a bit 
premature.  ASan trips over a bunch of issues still.  I'd like to land the 
patches that I sent out over the weekend that address memory corruption issues 
if the server is started without any screens attached.  That issue was made 
obvious due to the input thread changes which altered our initialization order 
to reveal the issue.

We should also address the use-after-free in CloseDownClient that I discussed 
in https://bugs.freedesktop.org/show_bug.cgi?id=97770 and figure out what's 
causing replies to get stuck unsent in the first place (cf 9/11: Re: 
XLoadQueryFont() not returning with recent xserver master).

Thanks,
Jeremy



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] randr: Initialize RandR even if there are currently no screens attached

2016-09-16 Thread Jeremy Huddleston Sequoia
Ping.

> On Sep 11, 2016, at 02:23, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> Failure to do so causes an overvlow in RRClientCallback().
> 
> =
> ==41262==ERROR: AddressSanitizer: global-buffer-overflow on address 
> 0x000103ccfbc8 at pc 0x0001034f32b9 bp 0x735a94c0 sp 0x735a94b8
> WRITE of size 4 at 0x000103ccfbc8 thread T6
>#0 0x1034f32b8 in RRClientCallback randr.c:72
>#1 0x1038c75e3 in _CallCallbacks dixutils.c:737
>#2 0x10388f406 in CallCallbacks callback.h:83
>#3 0x1038bc49a in NextAvailableClient dispatch.c:3562
>#4 0x103ad094c in AllocNewConnection connection.c:777
>#5 0x103ad1695 in EstablishNewConnections connection.c:863
>#6 0x1038c6630 in ProcessWorkQueue dixutils.c:523
>#7 0x103ab2dbf in WaitForSomething WaitFor.c:175
>#8 0x103880836 in Dispatch dispatch.c:411
>#9 0x1038c2141 in dix_main main.c:301
>#10 0x1032ac75a in server_thread quartzStartup.c:66
>#11 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
>#12 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
>#13 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)
> 
> Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
> ---
> randr/randr.c | 3 ---
> 1 file changed, 3 deletions(-)
> 
> diff --git a/randr/randr.c b/randr/randr.c
> index 0138dc1..efd3859 100644
> --- a/randr/randr.c
> +++ b/randr/randr.c
> @@ -387,9 +387,6 @@ RRExtensionInit(void)
> {
> ExtensionEntry *extEntry;
> 
> -if (RRNScreens == 0)
> -return;
> -
> if (!dixRegisterPrivateKey(, PRIVATE_CLIENT,
>sizeof(RRClientRec) +
>screenInfo.numScreens * sizeof(RRTimesRec)))
> -- 
> 2.9.3
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] glx: Initialize glx even if there are currently no screens attached

2016-09-16 Thread Jeremy Huddleston Sequoia
Ping.

> On Sep 11, 2016, at 03:44, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> Failure to do so causes an overvlow in glxClientCallback
> 
> Application Specific Information:
> X.Org X Server 1.18.99.1 Build Date: 20160911
> =
> ==52118==ERROR: AddressSanitizer: SEGV on unknown address 0x000102b27b80 (pc 
> 0x000103433245 bp 0x7de67c20 sp 0x7de67c00 T6)
>#0 0x103433244 in __asan::asan_free(void*, 
> __sanitizer::BufferedStackTrace*, __asan::AllocType) 
> (libclang_rt.asan_osx_dynamic.dylib+0x3244)
>#1 0x10347aeee in wrap_free (libclang_rt.asan_osx_dynamic.dylib+0x4aeee)
>#2 0x102e6a5ed in glxClientCallback glxext.c:301
>#3 0x102b672a3 in _CallCallbacks dixutils.c:737
>#4 0x102b2f0c6 in CallCallbacks callback.h:83
>#5 0x102b5c15a in NextAvailableClient dispatch.c:3562
>#6 0x102d7060c in AllocNewConnection connection.c:777
>#7 0x102d71355 in EstablishNewConnections connection.c:863
>#8 0x102b662f0 in ProcessWorkQueue dixutils.c:523
>#9 0x102d52a7f in WaitForSomething WaitFor.c:175
>#10 0x102b204f6 in Dispatch dispatch.c:411
>#11 0x102b61e01 in dix_main main.c:301
>#12 0x10254c42a in server_thread quartzStartup.c:66
>#13 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
>#14 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
>    #15 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)
> 
> Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
> ---
> glx/glxext.c | 21 -
> 1 file changed, 21 deletions(-)
> 
> diff --git a/glx/glxext.c b/glx/glxext.c
> index d595a05..d216c9d 100644
> --- a/glx/glxext.c
> +++ b/glx/glxext.c
> @@ -319,23 +319,6 @@ GlxPushProvider(__GLXprovider * provider)
> __glXProviderStack = provider;
> }
> 
> -static Bool
> -checkScreenVisuals(void)
> -{
> -int i, j;
> -
> -for (i = 0; i < screenInfo.numScreens; i++) {
> -ScreenPtr screen = screenInfo.screens[i];
> -for (j = 0; j < screen->numVisuals; j++) {
> -if (screen->visuals[j].class == TrueColor ||
> -screen->visuals[j].class == DirectColor)
> -return True;
> -}
> -}
> -
> -return False;
> -}
> -
> static void
> GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
> {
> @@ -371,10 +354,6 @@ GlxExtensionInit(void)
> *stack = &__glXDRISWRastProvider;
> }
> 
> -/* Mesa requires at least one True/DirectColor visual */
> -if (!checkScreenVisuals())
> -return;
> -
> __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
> "GLXContext");
> __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
> -- 
> 2.9.3
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] os/connection: Improve abstraction for launchd secure sockets

2016-09-13 Thread Jeremy Huddleston Sequoia
This changes away from hard-coding the /tmp/launch-* path to now
supporting a generic [.]
format for $DISPLAY.

cf-libxcb: d978a4f69b30b630f28d07f1003cf290284d24d8

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Adam Jackson <a...@kemper.freedesktop.org>
---
 os/connection.c | 31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/os/connection.c b/os/connection.c
index a901ebf..0d42184 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -79,6 +79,8 @@ SOFTWARE.
 #include 
 #include 
 
+#include 
+
 #ifndef WIN32
 #include 
 
@@ -1112,15 +1114,34 @@ MakeClientGrabPervious(ClientPtr client)
 void
 ListenOnOpenFD(int fd, int noxauth)
 {
-char port[256];
+char port[PATH_MAX];
 XtransConnInfo ciptr;
 const char *display_env = getenv("DISPLAY");
 
-if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
-/* Make the path the launchd socket if our DISPLAY is set right */
-strcpy(port, display_env);
+/* First check if display_env matches a [.] scheme (eg: launchd) */
+if (display_env && display_env[0] == '/') {
+struct stat sbuf;
+
+strlcpy(port, display_env, sizeof(port));
+
+/* If the path exists, we don't have do do anything else.
+ * If it doesn't, we need to check for a . to strip off 
and recheck.
+ */
+if (0 != stat(port, )) {
+char *dot = strrchr(port, '.');
+if (dot) {
+*dot = '\0';
+
+if (0 != stat(port, )) {
+display_env = NULL;
+}
+} else {
+display_env = NULL;
+}
+}
 }
-else {
+
+if (!display_env) {
 /* Just some default so things don't break and die. */
 snprintf(port, sizeof(port), ":%d", atoi(display));
 }
-- 
2.10.0 (Apple Git-99)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PULL] XQuartz {Add,Remove}EnabledDevice build fixes and other cleanup

2016-09-13 Thread Jeremy Huddleston Sequoia

> On Sep 13, 2016, at 07:48, Adam Jackson <a...@redhat.com> wrote:
> 
> On Sun, 2016-09-11 at 00:03 -0700, Jeremy Huddleston Sequoia wrote:
> 
>>   os/connection: Improve abstraction for launchd secure sockets
> 
> Mmm, not a huge fan of this one. You're not requiring that $DISPLAY be
> an absolute path, so now server startup might fail if there's a file in
> cwd named ":0.0". Unlikely I admit but still a dumb reason to fail, and
> I can't think of a good reason to want relative paths to work here.

Whoops, I didn't mean to include that one in the pull request as I hadn't 
received review feedback from it yet.  Sorry about that.  I've removed it from 
the PR (updated below to also include 2 patches that I got review on over the 
weekend).

Regarding the change in question, it's not requiring DISPLAY to be an absolute 
path.  If it isn't a path at all, it falls through to the "not a path" case.

Yes, if it is a relative path, things might not go the way we want them to, so 
that's a good point.  The related logic in libxcb has the same issue.  If this 
is something we want to squash, we should do it in both places by changing 'if 
(display_env)' to 'if (display_env && *display_env == '/')'

Would that make you feel more comfortable?



The updated PR without that change is:


The following changes since commit d8e05c04758cbcd7b5c11362cb28ce017d50098b:

  modesetting: Fall back to primary crtc for vblank for drawables on slave 
outputs (2016-09-13 11:18:43 -0400)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to 6c0641c7e843182d860c593bf48a88f38bedb291:

  os/inputthread: Fix setting of cloexec on file descriptors (2016-09-13 
10:00:51 -0700)

----
Jeremy Huddleston Sequoia (5):
  XQuartz: Fix the issue where the h key could be come "stuck" after hiding 
XQuartz with cmd-h
  XQuartz: Cleanup CPPFLAGS that are no longer necessary on darwin
  Xquartz: Update for removal of AddEnabledDevice and RemoveEnabledDevice
  Xext/shm: Fix usage of F_GETFD to match standard
  os/inputthread: Fix setting of cloexec on file descriptors

 Xext/shm.c |  3 ++-
 hw/xquartz/X11Application.m|  9 +
 hw/xquartz/darwin.c| 17 +++--
 hw/xquartz/pbproxy/Makefile.am |  5 ++---
 os/inputthread.c   | 15 +--
 5 files changed, 37 insertions(+), 12 deletions(-)




smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 2/3] Xext/shm: Better support cases where O_CLOEXEC is not defined

2016-09-12 Thread Jeremy Huddleston Sequoia

> On Sep 12, 2016, at 04:33, Julien Cristau <jcris...@debian.org> wrote:
> 
> On Sun, Sep 11, 2016 at 20:01:50 -0700, Jeremy Huddleston Sequoia wrote:
> 
>> Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
>> ---
>> Xext/shm.c | 6 +-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>> 
> Does anything have O_TMPFILE but not O_CLOEXEC?

Not sure, but I figured it'd be good to be on the safe side.  Snow Leopard (OS 
X 10.6) doesn't have either.  I saw this when making the change to check for 
O_CLOEXEC in os/inputthread and thought I'd bring it up for consideration.

If you don't think that O_TMPFILE && !O_CLOEXEC is something we'll see in the 
wild, I'm happy to just leave it as is.

--Jeremy

> Cheers,
> Julien
> 
>> diff --git a/Xext/shm.c b/Xext/shm.c
>> index 125000f..7a45dbd 100644
>> --- a/Xext/shm.c
>> +++ b/Xext/shm.c
>> @@ -1202,7 +1202,11 @@ shm_tmpfile(void)
>>  int flags;
>>  chartemplate[] = SHMDIR "/shmfd-XX";
>> #ifdef O_TMPFILE
>> -fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
>> +flags = O_TMPFILE|O_RDWR|O_EXCL;
>> +#ifdef O_CLOEXEC
>> +flags |= O_CLOEXEC;
>> +#endif
>> +fd = open(SHMDIR, flags, 0666);
>>  if (fd >= 0) {
>>  ErrorF ("Using O_TMPFILE\n");
>>  return fd;
>> -- 
>> 2.10.0 (Apple Git-99)
>> 
>> ___
>> xorg-devel@lists.x.org: X.Org development
>> Archives: http://lists.x.org/archives/xorg-devel
>> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/3] Xext/shm: Fix usage of F_GETFD to match standard

2016-09-11 Thread Jeremy Huddleston Sequoia
flags = fcntl(fd, F_GETFD) is compliant.

fcntl(fd, F_GETFD, ) is non-compliant (Linux extension?)

cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xext/shm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Xext/shm.c b/Xext/shm.c
index 0557538..125000f 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1213,7 +1213,8 @@ shm_tmpfile(void)
if (fd < 0)
return -1;
unlink(template);
-   if (fcntl(fd, F_GETFD, ) >= 0) {
+   flags = fcntl(fd, F_GETFD);
+   if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, );
}
-- 
2.10.0 (Apple Git-99)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 3/3] os/inputthread: Fix setting of cloexec on file descriptors

2016-09-11 Thread Jeremy Huddleston Sequoia
O_CLOEXEC is not a file bit.  It is not setable with F_SETFL.  One must use it
when calling open(2).  To set it cloexec on an existing fd, F_SETFD and
FD_CLOEXEC must be used.

This also fixes a build failure regression on configurations that don't have
O_CLOEXEC defined.

cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
Regressed-in: 30ac7567980a1eb79d084a63e0e74e1d9a3af673
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 os/inputthread.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/os/inputthread.c b/os/inputthread.c
index 2ea39e7..6aa0a9c 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -385,6 +385,7 @@ void
 InputThreadPreInit(void)
 {
 int fds[2], hotplugPipe[2];
+int flags;
 
 if (!InputThreadEnable)
 return;
@@ -408,13 +409,23 @@ InputThreadPreInit(void)
  * in parallel.
  */
 inputThreadInfo->readPipe = fds[0];
-fcntl(inputThreadInfo->readPipe, F_SETFL, O_NONBLOCK | O_CLOEXEC);
+fcntl(inputThreadInfo->readPipe, F_SETFL, O_NONBLOCK);
+flags = fcntl(inputThreadInfo->readPipe, F_GETFD);
+if (flags != -1) {
+flags |= FD_CLOEXEC;
+(void)fcntl(inputThreadInfo->readPipe, F_SETFD, );
+}
 SetNotifyFd(inputThreadInfo->readPipe, InputThreadNotifyPipe, 
X_NOTIFY_READ, NULL);
 
 inputThreadInfo->writePipe = fds[1];
 
 hotplugPipeRead = hotplugPipe[0];
-fcntl(hotplugPipeRead, F_SETFL, O_NONBLOCK | O_CLOEXEC);
+fcntl(hotplugPipeRead, F_SETFL, O_NONBLOCK);
+flags = fcntl(hotplugPipeRead, F_GETFD);
+if (flags != -1) {
+flags |= FD_CLOEXEC;
+(void)fcntl(hotplugPipeRead, F_SETFD, );
+}
 hotplugPipeWrite = hotplugPipe[1];
 
 #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
-- 
2.10.0 (Apple Git-99)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 2/3] Xext/shm: Better support cases where O_CLOEXEC is not defined

2016-09-11 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xext/shm.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Xext/shm.c b/Xext/shm.c
index 125000f..7a45dbd 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1202,7 +1202,11 @@ shm_tmpfile(void)
int flags;
chartemplate[] = SHMDIR "/shmfd-XX";
 #ifdef O_TMPFILE
-   fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
+   flags = O_TMPFILE|O_RDWR|O_EXCL;
+#ifdef O_CLOEXEC
+   flags |= O_CLOEXEC;
+#endif
+   fd = open(SHMDIR, flags, 0666);
if (fd >= 0) {
ErrorF ("Using O_TMPFILE\n");
return fd;
-- 
2.10.0 (Apple Git-99)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: XLoadQueryFont() not returning with recent xserver master

2016-09-11 Thread Jeremy Huddleston Sequoia
Upon a bit more digging, it looks like the clients are listed in 
output_pending_clients, but it's not getting delivered.

This situation reveals another issue with a use-after-free during 
CloseDownClient() in which a client will get re-added to the 
output_pending_clients during FlushClient() as part of CloseDownConnection().

See https://bugs.freedesktop.org/show_bug.cgi?id=97770 for more details on that.

> On Sep 11, 2016, at 12:24, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> Using current master plus the various patches I submitted to the list last 
> night, I'm able to launch the server fairly reliably under ASan again, but 
> some clients are getting wedged.  Most notably, xterm gets stuck waiting for 
> a reply from XLoadQueryFont().  Looking at the state of the server threads, 
> it looks fine.  It's processing other requests just fine from other clients.
> 
> Has anyone noticed anything odd like this or have some hunch as to where I 
> might start looking other than to do yet another bisect? =/
> 
>  Thread 0x344e96   DispatchQueue 1   1000 samples (1-1000)
>  priority 31 (base 31)
>  1000  start + 52 (xterm + 6312) [0x10d3bf8a8]
>1000  main + 3752 (xterm + 146228) [0x10d3e1b34]
>  1000  spawnXTerm + 977 (xterm + 148776) [0x10d3e2528]
>1000  VTInit + 22 (xterm + 68248) [0x10d3cea98]
>  1000  XtRealizeWidget + 135 (libXt.6.dylib + 84572) [0x10d4ffa5c]
>1000  RealizeWidget + 871 (libXt.6.dylib + 85805) [0x10d4fff2d]
>  1000  RealizeWidget + 365 (libXt.6.dylib + 85299) [0x10d4ffd33]
>1000  VTRealize + 324 (xterm + 82404) [0x10d3d21e4]
>  1000  SetVTFont + 335 (xterm + 121728) [0x10d3dbb80]
>1000  xtermLoadFont + 514 (xterm + 114081) [0x10d3d9da1]
>  1000  xtermOpenFont + 86 (xterm + 112342) [0x10d3d96d6]
>1000  XLoadQueryFont + 311 (libX11.6.dylib + 29419) 
> [0x10d54f2eb]
>  1000  _XQueryFont + 163 (libX11.6.dylib + 32127) 
> [0x10d54fd7f]
>1000  _XReply + 279 (libX11.6.dylib + 143484) 
> [0x10d56b07c]
>  1000  xcb_wait_for_reply + 103 (libxcb.1.dylib + 
> 8247) [0x10d711037]
>1000  wait_for_reply + 251 (libxcb.1.dylib + 
> 8521) [0x10d711149]
>  1000  _xcb_conn_wait + 466 (libxcb.1.dylib + 
> 4166) [0x10d710046]
>1000  _xcb_in_read + 1051 (libxcb.1.dylib 
> + 12750) [0x10d7121ce]
>  1000  __select + 10 
> (libsystem_kernel.dylib + 106318) [0x7fffc5e2df4e]
>   *1000  _sleep_continue + 0 
> (kernel.development + 7459248) [0xff800091d1b0]
> 
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

XLoadQueryFont() not returning with recent xserver master

2016-09-11 Thread Jeremy Huddleston Sequoia
Using current master plus the various patches I submitted to the list last 
night, I'm able to launch the server fairly reliably under ASan again, but some 
clients are getting wedged.  Most notably, xterm gets stuck waiting for a reply 
from XLoadQueryFont().  Looking at the state of the server threads, it looks 
fine.  It's processing other requests just fine from other clients.

Has anyone noticed anything odd like this or have some hunch as to where I 
might start looking other than to do yet another bisect? =/

  Thread 0x344e96   DispatchQueue 1   1000 samples (1-1000) 
priority 31 (base 31)
  1000  start + 52 (xterm + 6312) [0x10d3bf8a8]
1000  main + 3752 (xterm + 146228) [0x10d3e1b34]
  1000  spawnXTerm + 977 (xterm + 148776) [0x10d3e2528]
1000  VTInit + 22 (xterm + 68248) [0x10d3cea98]
  1000  XtRealizeWidget + 135 (libXt.6.dylib + 84572) [0x10d4ffa5c]
1000  RealizeWidget + 871 (libXt.6.dylib + 85805) [0x10d4fff2d]
  1000  RealizeWidget + 365 (libXt.6.dylib + 85299) [0x10d4ffd33]
1000  VTRealize + 324 (xterm + 82404) [0x10d3d21e4]
  1000  SetVTFont + 335 (xterm + 121728) [0x10d3dbb80]
1000  xtermLoadFont + 514 (xterm + 114081) [0x10d3d9da1]
  1000  xtermOpenFont + 86 (xterm + 112342) [0x10d3d96d6]
1000  XLoadQueryFont + 311 (libX11.6.dylib + 29419) 
[0x10d54f2eb]
  1000  _XQueryFont + 163 (libX11.6.dylib + 32127) 
[0x10d54fd7f]
1000  _XReply + 279 (libX11.6.dylib + 143484) 
[0x10d56b07c]
  1000  xcb_wait_for_reply + 103 (libxcb.1.dylib + 
8247) [0x10d711037]
1000  wait_for_reply + 251 (libxcb.1.dylib + 
8521) [0x10d711149]
  1000  _xcb_conn_wait + 466 (libxcb.1.dylib + 
4166) [0x10d710046]
1000  _xcb_in_read + 1051 (libxcb.1.dylib + 
12750) [0x10d7121ce]
  1000  __select + 10 
(libsystem_kernel.dylib + 106318) [0x7fffc5e2df4e]
   *1000  _sleep_continue + 0 
(kernel.development + 7459248) [0xff800091d1b0]




smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] glx: Initialize glx even if there are currently no screens attached

2016-09-11 Thread Jeremy Huddleston Sequoia
Failure to do so causes an overvlow in glxClientCallback

Application Specific Information:
X.Org X Server 1.18.99.1 Build Date: 20160911
=
==52118==ERROR: AddressSanitizer: SEGV on unknown address 0x000102b27b80 (pc 
0x000103433245 bp 0x7de67c20 sp 0x7de67c00 T6)
#0 0x103433244 in __asan::asan_free(void*, 
__sanitizer::BufferedStackTrace*, __asan::AllocType) 
(libclang_rt.asan_osx_dynamic.dylib+0x3244)
#1 0x10347aeee in wrap_free (libclang_rt.asan_osx_dynamic.dylib+0x4aeee)
#2 0x102e6a5ed in glxClientCallback glxext.c:301
#3 0x102b672a3 in _CallCallbacks dixutils.c:737
#4 0x102b2f0c6 in CallCallbacks callback.h:83
#5 0x102b5c15a in NextAvailableClient dispatch.c:3562
#6 0x102d7060c in AllocNewConnection connection.c:777
#7 0x102d71355 in EstablishNewConnections connection.c:863
#8 0x102b662f0 in ProcessWorkQueue dixutils.c:523
#9 0x102d52a7f in WaitForSomething WaitFor.c:175
#10 0x102b204f6 in Dispatch dispatch.c:411
#11 0x102b61e01 in dix_main main.c:301
#12 0x10254c42a in server_thread quartzStartup.c:66
#13 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#14 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#15 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 glx/glxext.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/glx/glxext.c b/glx/glxext.c
index d595a05..d216c9d 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -319,23 +319,6 @@ GlxPushProvider(__GLXprovider * provider)
 __glXProviderStack = provider;
 }
 
-static Bool
-checkScreenVisuals(void)
-{
-int i, j;
-
-for (i = 0; i < screenInfo.numScreens; i++) {
-ScreenPtr screen = screenInfo.screens[i];
-for (j = 0; j < screen->numVisuals; j++) {
-if (screen->visuals[j].class == TrueColor ||
-screen->visuals[j].class == DirectColor)
-return True;
-}
-}
-
-return False;
-}
-
 static void
 GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
 {
@@ -371,10 +354,6 @@ GlxExtensionInit(void)
 *stack = &__glXDRISWRastProvider;
 }
 
-/* Mesa requires at least one True/DirectColor visual */
-if (!checkScreenVisuals())
-return;
-
 __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
 "GLXContext");
 __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] dix/dispatch: Fix SmartScheduleClient interval adjustment to use best rather than pClient

2016-09-11 Thread Jeremy Huddleston Sequoia
pClient does not contain a live value after the transition to lists

https://bugs.freedesktop.org/show_bug.cgi?id=97765

Application Specific Information:
X.Org X Server 1.18.99.1 Build Date: 20160910
=
==16921==ERROR: AddressSanitizer: global-buffer-overflow on address 
0x000108ce3834 at pc 0x000108880766 bp 0x745f76c0 sp 0x745f76b8
READ of size 4 at 0x000108ce3834 thread T6
#0 0x108880765 in SmartScheduleClient dispatch.c:365
#1 0x10887ecc5 in Dispatch dispatch.c:422
#2 0x1088c05f1 in dix_main main.c:301
#3 0x1082aabba in server_thread quartzStartup.c:66
#4 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#5 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#6 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Regressed-in: 8f1edf4bd3a1f050ce9eeb5eac45dd1a8f7a6d5e
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 dix/dispatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 3b9600e..f1a074d 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -360,7 +360,7 @@ SmartScheduleClient(void)
  * has run, bump the slice up to get maximal
  * performance from a single client
  */
-if ((now - pClient->smart_start_tick) > 1000 &&
+if ((now - best->smart_start_tick) > 1000 &&
 SmartScheduleSlice < SmartScheduleMaxSlice) {
 SmartScheduleSlice += SmartScheduleInterval;
 }
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] randr: Initialize RandR even if there are currently no screens attached

2016-09-11 Thread Jeremy Huddleston Sequoia
Failure to do so causes an overvlow in RRClientCallback().

=
==41262==ERROR: AddressSanitizer: global-buffer-overflow on address 
0x000103ccfbc8 at pc 0x0001034f32b9 bp 0x735a94c0 sp 0x735a94b8
WRITE of size 4 at 0x000103ccfbc8 thread T6
#0 0x1034f32b8 in RRClientCallback randr.c:72
#1 0x1038c75e3 in _CallCallbacks dixutils.c:737
#2 0x10388f406 in CallCallbacks callback.h:83
#3 0x1038bc49a in NextAvailableClient dispatch.c:3562
#4 0x103ad094c in AllocNewConnection connection.c:777
#5 0x103ad1695 in EstablishNewConnections connection.c:863
#6 0x1038c6630 in ProcessWorkQueue dixutils.c:523
#7 0x103ab2dbf in WaitForSomething WaitFor.c:175
#8 0x103880836 in Dispatch dispatch.c:411
#9 0x1038c2141 in dix_main main.c:301
#10 0x1032ac75a in server_thread quartzStartup.c:66
#11 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#12 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#13 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 randr/randr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/randr/randr.c b/randr/randr.c
index 0138dc1..efd3859 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -387,9 +387,6 @@ RRExtensionInit(void)
 {
 ExtensionEntry *extEntry;
 
-if (RRNScreens == 0)
-return;
-
 if (!dixRegisterPrivateKey(, PRIVATE_CLIENT,
sizeof(RRClientRec) +
screenInfo.numScreens * sizeof(RRTimesRec)))
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH:xserver] Use pthread_setname_np to set thread names if available

2016-09-11 Thread Jeremy Huddleston Sequoia
Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
(on current macOS)

> On Sep 10, 2016, at 21:14, Alan Coopersmith <alan.coopersm...@oracle.com> 
> wrote:
> 
> Autoconf logic borrowed from glib
> 
> Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
> ---
> configure.ac| 20 
> include/dix-config.h.in |  6 ++
> os/inputthread.c| 12 
> 3 files changed, 38 insertions(+)
> 
> I have only tested this on Solaris, not MacOS or Linux, but since the
> similar code in glib works on both, hope this will too.
> 
> diff --git a/configure.ac b/configure.ac
> index e206e0f..4ff317f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -870,6 +870,26 @@ if test "x$INPUTTHREAD" = "xyes" ; then
> SYS_LIBS="$SYS_LIBS $PTHREAD_LIBS"
> CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
> AC_DEFINE(INPUTTHREAD, 1, [Use a separate input thread])
> +
> +save_LIBS="$LIBS"
> +LIBS="$LIBS $SYS_LIBS"
> +dnl MacOS X 10.6 & higher
> +AC_MSG_CHECKING(for pthread_setname_np(const char*))
> +AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],
> + [pthread_setname_np("example")])],
> +   [AC_MSG_RESULT(yes)
> + AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
> +   [Have function pthread_setname_np(const char*)])],
> +   [AC_MSG_RESULT(no)])
> +dnl GNU libc 2.12 & higher, Solaris 11.3 & higher
> +AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
> +AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],
> + [pthread_setname_np(pthread_self(), 
> "example")])],
> +   [AC_MSG_RESULT(yes)
> + AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
> +   [Have function pthread_setname_np(pthread_t, 
> const char*)])],
> +[AC_MSG_RESULT(no)])
> +LIBS="$save_LIBS"
> fi
> 
> REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO 
> $SDK_REQUIRED_MODULES"
> diff --git a/include/dix-config.h.in b/include/dix-config.h.in
> index d49af92..4f020e5 100644
> --- a/include/dix-config.h.in
> +++ b/include/dix-config.h.in
> @@ -143,6 +143,12 @@
> /* Define to 1 if you have the `mmap' function. */
> #undef HAVE_MMAP
> 
> +/* Define to 1 if you have the function pthread_setname_np(const char*) */
> +#undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
> +
> +/* Define to 1 if you have the function pthread_setname_np(pthread_t, const 
> char*) */
> +#undef HAVE_PTHREAD_SETNAME_NP_WITH_TID
> +
> /* Define to 1 if you have the  header file. */
> #undef HAVE_NDBM_H
> 
> diff --git a/os/inputthread.c b/os/inputthread.c
> index 1cd1c2a..2ea39e7 100644
> --- a/os/inputthread.c
> +++ b/os/inputthread.c
> @@ -310,6 +310,12 @@ InputThreadDoWork(void *arg)
> 
> inputThreadInfo->running = TRUE;
> 
> +#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
> +pthread_setname_np (pthread_self(), "InputThread");
> +#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
> +pthread_setname_np ("InputThread");
> +#endif
> +
> ospoll_add(inputThreadInfo->fds, hotplugPipeRead,
>ospoll_trigger_level,
>InputThreadPipeNotify,
> @@ -411,6 +417,12 @@ InputThreadPreInit(void)
> fcntl(hotplugPipeRead, F_SETFL, O_NONBLOCK | O_CLOEXEC);
> hotplugPipeWrite = hotplugPipe[1];
> 
> +#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
> +pthread_setname_np (pthread_self(), "MainThread");
> +#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
> +pthread_setname_np ("MainThread");
> +#endif
> +
> }
> 
> /**
> -- 
> 2.7.4
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PULL] XQuartz {Add, Remove}EnabledDevice build fixes and other cleanup

2016-09-11 Thread Jeremy Huddleston Sequoia
The following changes since commit 527c6baa294d17c5eca1d87ac941844872e90dac:

  xkb: fix check for appending '|' character when applying rules (2016-09-07 
15:16:13 +1000)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to dd85834e3995671da908e825eaa7a228d11f0b3d:

  xquartz: Update for removal of AddEnabledDevice and RemoveEnabledDevice 
(2016-09-10 23:37:46 -0700)


Jeremy Huddleston Sequoia (4):
  XQuartz: Fix the issue where the h key could be come "stuck" after hiding 
XQuartz with cmd-h
  XQuartz: Cleanup CPPFLAGS that are no longer necessary on darwin
  os/connection: Improve abstraction for launchd secure sockets
  xquartz: Update for removal of AddEnabledDevice and RemoveEnabledDevice

 hw/xquartz/X11Application.m|  9 +
 hw/xquartz/darwin.c| 17 +++--
 hw/xquartz/pbproxy/Makefile.am |  5 ++---
 os/connection.c| 31 ++-
 4 files changed, 48 insertions(+), 14 deletions(-)



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libXfont 3/4] fserve: Silence a -Wformat warning

2016-05-30 Thread Jeremy Huddleston Sequoia
src/fc/fserve.c:653:32: warning: format specifies type 'int' but the argument 
has type 'CARD32' (aka 'unsigned long') [-Wformat]
   " from font server\n", rep->length);
  ^~~
1 warning generated.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 src/fc/fserve.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/fc/fserve.c b/src/fc/fserve.c
index 42c4028..fb1941d 100644
--- a/src/fc/fserve.c
+++ b/src/fc/fserve.c
@@ -649,8 +649,8 @@ fs_get_reply (FSFpePtr conn, int *error)
  */
 if (rep->length > MAX_REPLY_LENGTH)
 {
-   ErrorF("fserve: reply length %d > MAX_REPLY_LENGTH, disconnecting"
-  " from font server\n", rep->length);
+   ErrorF("fserve: reply length %ld > MAX_REPLY_LENGTH, disconnecting"
+  " from font server\n", (long)rep->length);
_fs_connection_died (conn);
*error = FSIO_ERROR;
return 0;
-- 
2.8.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libXfont 4/4] fstrans: Remove unused foo() function

2016-05-30 Thread Jeremy Huddleston Sequoia
The point of it seems to have been to silence an unused function warning, but
there's no point if we're just transitioning that to another unused function
warning.

src/fc/fstrans.c:32:20: warning: unused function 'foo' [-Wunused-function]
static inline void foo(void) { (void) is_numeric("a"); }
   ^
1 warning generated.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Keith Packard <kei...@keithp.com>
---
 src/fc/fstrans.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/fc/fstrans.c b/src/fc/fstrans.c
index 66bc978..902ef36 100644
--- a/src/fc/fstrans.c
+++ b/src/fc/fstrans.c
@@ -28,5 +28,3 @@
 #define FONT_t
 #define TRANS_CLIENT
 #include 
-/* inhibit warning about is_numeric */
-static inline void foo(void) { (void) is_numeric("a"); }
-- 
2.8.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libXfont 2/4] bitmap: Bail out on invalid input to FontFileMakeDir instead of calling calloc for 0 bytes

2016-05-30 Thread Jeremy Huddleston Sequoia
Found by clang static analysis:
Call to 'calloc' has an allocation size of 0 bytes

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 src/bitmap/bitscale.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
index 22747a9..00adcc6 100644
--- a/src/bitmap/bitscale.c
+++ b/src/bitmap/bitscale.c
@@ -1477,6 +1477,10 @@ BitmapScaleBitmaps(FontPtr pf,  /* scaled font */
 lastRow = pfi->lastRow;
 
 nchars = (lastRow - firstRow + 1) * (lastCol - firstCol + 1);
+if (nchars <= 0) {
+goto bail;
+}
+
 glyph = pf->glyph;
 for (i = 0; i < nchars; i++)
 {
-- 
2.8.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libXfont 1/4] FreeType: Correct an allocation size

2016-05-30 Thread Jeremy Huddleston Sequoia
Found by clang static analysis:
Result of 'calloc' is converted to a pointer of type 'int', which is
incompatible with sizeof operand type 'int *'

This is likely benign because the old size was larger on any platform where
sizeof(int) <= sizeof(void *), which is everywhere.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 src/FreeType/ftfuncs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index bbd4db4..e7c8026 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -623,7 +623,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, 
FTInstancePtr instance,
 offset = idx - segment * FONTSEGMENTSIZE;
 
 if((*available)[segment] == NULL) {
-(*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int *));
+(*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int));
 if((*available)[segment] == NULL)
 return AllocError;
 }
-- 
2.8.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libXfont 1/1] fserve: Fix a buffer read overrun in _fs_client_access

2016-05-30 Thread Jeremy Huddleston Sequoia
https://bugs.freedesktop.org/show_bug.cgi?id=83224

Found by clang's Address Sanitizer

crac.num_auths = set_font_authorizations(, ,
 client);
/* Work around bug in xfs versions up through modular release 1.0.8
   which rejects CreateAC packets with num_auths = 0 & authlen < 4 */
if (crac.num_auths == 0) {
authorizations = padding;
authlen = 4;
} else {
authlen = (authlen + 3) & ~0x3;
}
crac.length = (sizeof (fsCreateACReq) + authlen) >> 2;
crac.acid = cur->acid;
_fs_add_req_log(conn, FS_CreateAC);
_fs_write(conn, (char *) , sizeof (fsCreateACReq));
_fs_write(conn, authorizations, authlen);

In the case in the report, set_font_authorizations setup authorizations as a
34 byte buffer (and authlen set to 34 as one would expect). The following
block changed authlen to 36 to make it 4byte aligned and the final _fs_write()
caused us to read 36 bytes from this 34 byte buffer.

This changes the incorrect size increase to instead use _fs_write_pad which
takes care of the padding for us.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 src/fc/fserve.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/fc/fserve.c b/src/fc/fserve.c
index fb1941d..708fc35 100644
--- a/src/fc/fserve.c
+++ b/src/fc/fserve.c
@@ -2856,14 +2856,12 @@ _fs_client_access (FSFpePtr conn, pointer client, Bool 
sync)
if (crac.num_auths == 0) {
authorizations = padding;
authlen = 4;
-   } else {
-   authlen = (authlen + 3) & ~0x3;
}
crac.length = (sizeof (fsCreateACReq) + authlen) >> 2;
crac.acid = cur->acid;
_fs_add_req_log(conn, FS_CreateAC);
_fs_write(conn, (char *) , sizeof (fsCreateACReq));
-   _fs_write(conn, authorizations, authlen);
+   _fs_write_pad(conn, authorizations, authlen);
/* ignore reply; we don't even care about it */
conn->curacid = 0;
cur->auth_generation = client_auth_generation(client);
-- 
2.8.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PULL 1.18] XQuartz configure cherry-picks

2016-05-18 Thread Jeremy Huddleston Sequoia
The following changes since commit 9454cd51da9b38b974cff7c8b7125901f6403848:

  xserver 1.18.3 (2016-04-04 14:39:36 -0400)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to 98499770640c747128f212b1ebb6bd42775f3b72:

  XQuartz: Fix default CFBundleVersion (2016-05-18 14:13:04 -0700)


Jeremy Huddleston Sequoia (7):
  XQuartz: Remove --with-launchd-id-prefix
  XQuartz: Fix the help text for --with-bundle-id-prefix
  XQuartz: Update release feed URL to use new https URL
  XQuartz: Add --with-sparkle-feed-url configure option
  XQuartz: Add --with-bundle-version and --with-bundle-version-string 
configure options
  XQuartz: Update copyright years
  XQuartz: Fix default CFBundleVersion

 configure.ac | 18 ++
 hw/xquartz/bundle/Info.plist.cpp | 23 +--
 hw/xquartz/bundle/Makefile.am|  6 --
 3 files changed, 23 insertions(+), 24 deletions(-)



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PULL] XQuartz configure.ac fix for default CFBundleVersion

2016-05-18 Thread Jeremy Huddleston Sequoia
The following changes since commit 2fbf5c2f91d33efbda573c4be036248b1d8ed7f1:

  Input: Send XI2 FocusOut NotifyPointer events to the pointer window. 
(2016-05-16 15:19:54 +1000)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to e6ac87cd05b459598e69eebee92bfd2f28292dae:

  XQuartz: Fix default CFBundleVersion (2016-05-18 09:56:33 -0700)


Jeremy Huddleston Sequoia (1):
  XQuartz: Fix default CFBundleVersion

 configure.ac | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] Use separate name for --with-bundle-version help variable

2016-05-12 Thread Jeremy Huddleston Sequoia
I actually already had a patch for that on my branch and just hadn't gotten 
around to sending it, sorry:


https://github.com/XQuartz/xorg-server/commit/eb7c1e7fb16338d8fc03a0bb0f9bb53eb99ee139

I ended up just getting rid of the shell variable and only using the m4 
variable.  I don't think we should be using AC_ as that should be seen as a 
restricted namespace (like m4_, AS_, and AM_).  If you change the m4 variable 
name, then 'Reviewed-by: Jeremy Sequoia <jerem...@apple.com>' or you can merge 
mine:

The following changes since commit 7f0494671f95cfa33f6f2c7c74b20a21f239f8c5:

  modesetting: fix build with glamor disabled. (2016-05-06 08:59:45 +1000)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to eb7c1e7fb16338d8fc03a0bb0f9bb53eb99ee139:

  XQuartz: Fix default CFBundleVersion (2016-05-07 00:43:36 -0700)

----
Jeremy Huddleston Sequoia (1):
  XQuartz: Fix default CFBundleVersion

 configure.ac | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


> On May 12, 2016, at 10:35, Keith Packard <kei...@keithp.com> wrote:
> 
> The help string for --with-bundle-version can't have any shell
> variable expansion, so it uses an m4 variable instead. Using the same
> name as the shell variable causes the configure script to end up with
> the expanded string (1.18.99\n) instead of the variable name
> (DEFAULT_BUNDLE_VERSION).
> 
> Using AC_DEFAULT_BUNDLE_VERSION for the m4 variable avoids this
> problem. At the same time, remove an extra newline in the m4 value.
> 
> Signed-off-by: Keith Packard <kei...@keithp.com>
> ---
> configure.ac | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 59619ae..d310140 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -553,8 +553,8 @@ AC_ARG_WITH(bundle-id-prefix,  
> AS_HELP_STRING([--with-bundle-id-prefix=RDNS_PREF
> AC_SUBST([BUNDLE_ID_PREFIX])
> AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for 
> bundle identifiers])
> DEFAULT_BUNDLE_VERSION=`echo ${PACKAGE_VERSION} | cut -f1-3 -d.`
> -m4_define(DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | 
> cut -f1-3 -d.]))
> -AC_ARG_WITH(bundle-version,
> AS_HELP_STRING([--with-bundle-version=VERSION], [Version to use for X11.app's 
> CFBundleVersion (default: ]DEFAULT_BUNDLE_VERSION[)]),
> +m4_define(AC_DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | 
> cut -f1-3 -d. | tr -d '\n']))
> +AC_ARG_WITH(bundle-version,
> AS_HELP_STRING([--with-bundle-version=VERSION], [Version to use for X11.app's 
> CFBundleVersion (default: ]AC_DEFAULT_BUNDLE_VERSION[)]),
>[ BUNDLE_VERSION="${withval}" ],
>[ BUNDLE_VERSION="${DEFAULT_BUNDLE_VERSION}" ])
> AC_SUBST([BUNDLE_VERSION])
> -- 
> 2.8.0.rc3
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PULL] XQuartz configure options

2016-05-04 Thread Jeremy Huddleston Sequoia
The following changes since commit 2285fe78c04714561a0d1a164a41a38c48263f89:

  xfree86: add support for MatchIsTabletPad (2016-05-03 16:15:51 +1000)

are available in the git repository at:

  https://github.com/XQuartz/xorg-server.git 

for you to fetch changes up to 059d5ef30490233f410ca87084c7697b87e5b05e:

  XQuartz: Update copyright years (2016-05-04 00:08:34 -0700)


Jeremy Huddleston Sequoia (6):
  XQuartz: Remove --with-launchd-id-prefix
  XQuartz: Fix the help text for --with-bundle-id-prefix
  XQuartz: Update release feed URL to use new https URL
  XQuartz: Add --with-sparkle-feed-url configure option
  XQuartz: Add --with-bundle-version and --with-bundle-version-string 
configure options
  XQuartz: Update copyright years

 configure.ac | 19 +++
 hw/xquartz/bundle/Info.plist.cpp | 23 +--
 hw/xquartz/bundle/Makefile.am|  6 --
 3 files changed, 24 insertions(+), 24 deletions(-)



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Clang Static Analysis

2016-04-03 Thread Jeremy Huddleston Sequoia
Hey folks,

I just wanted to let you all know that I made some updates to my OS X tinderbox 
(yuffie).  It's has been updated to use clang 3.8.  You can find the static 
analysis results at https://people.freedesktop.org/~jeremyhu/analyzer/yuffie

--Jeremy



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH rendercheck 3/5] Use ELF sections to make test setup easier.

2016-04-03 Thread Jeremy Huddleston Sequoia
The use of __attribute(section()), __start_test_section, and 
__stop_test_section is not portable.  Could you please follow this up with a 
change that allows rendercheck to continue to function on non-ELF platforms as 
well? Preferably by just having alternate implementations of the 
DECLARE_RENDERCHECK_ARG_TEST and for_each_test macros.

Thanks,
Jeremy

> On Feb 1, 2016, at 13:48, Eric Anholt  wrote:
> 
> Managing the group logic was really error-prone (forget to edit
> success_mask when copy and pasting?  Forget to printf a description of
> the group?).  Most new tests being written can be described as a single
> call that does a couple subtests.
> 
> This doesn't convert all of the tests.  Some of the remaining ones use
> "win" for presenting results (which we may want to just put in a
> global?), and the rest use the pre-created pictures, which would need
> some much bigger refactoring if we want to move their test logic into
> their test files.
> 
> Signed-off-by: Eric Anholt 
> ---
> main.c   | 47 ++-
> rendercheck.h| 51 ---
> t_gtk_argb_xbgr.c| 17 -
> t_libreoffice_xrgb.c | 18 --
> tests.c  | 37 ++---
> 5 files changed, 120 insertions(+), 50 deletions(-)
> 
> diff --git a/main.c b/main.c
> index b5d67cc..4cec99b 100644
> --- a/main.c
> +++ b/main.c
> @@ -121,27 +121,38 @@ struct {
> {TEST_REPEAT, "repeat"},
> {TEST_TRIANGLES, "triangles"},
> {TEST_BUG7366, "bug7366"},
> -{TEST_GTK_ARGB_XBGR, "gtk_argb_xbgr"},
> -{TEST_LIBREOFFICE_XRGB, "libreoffice_xrgb"},
> {0, NULL}
> };
> 
> +static void
> +print_test_separator(int i)
> +{
> +if (i % 5 == 0) {
> +if(i != 0)
> +putc('\n', stderr);
> +putc('\t', stderr);
> +} else {
> +fprintf(stderr, ", ");
> +}
> +}
> +
> void print_tests(FILE *file, int tests) {
> int i, j;
> 
> for (i=0, j=0; available_tests[i].name; i++) {
> if (!(available_tests[i].flag & tests))
> continue;
> -if (j % 5 == 0) {
> -if(j != 0)
> -putc('\n', stderr);
> -putc('\t', stderr);
> -} else {
> -fprintf(stderr, ", ");
> -}
> + print_test_separator(j++);
> fprintf(stderr, "%s", available_tests[i].name);
> j++;
> }
> +for_each_test(test) {
> + if (!(test->bit & tests))
> + continue;
> + print_test_separator(j++);
> +fprintf(stderr, "%s", test->arg_name);
> +j++;
> +}
> if (j)
> fprintf(file, "\n");
> }
> @@ -169,7 +180,7 @@ int main(int argc, char **argv)
>   XSetWindowAttributes as;
>   picture_info window;
>   char *display = NULL;
> - char *test, *format, *opname, *nextname;
> + char *test_name, *format, *opname, *nextname;
> 
>   static struct option longopts[] = {
>   { "display",required_argument,  NULL,   'd' },
> @@ -239,15 +250,25 @@ int main(int argc, char **argv)
>   /* disable all tests */
>   enabled_tests = 0;
> 
> - while ((test = strsep(, ",")) != NULL) {
> + while ((test_name = strsep(, ",")) != NULL) {
>   int i;
> + bool found = false;
>   for(i=0; available_tests[i].name; i++) {
> - if(strcmp(test, 
> available_tests[i].name) == 0) {
> + if(strcmp(test_name, 
> available_tests[i].name) == 0) {
>   enabled_tests |= 
> available_tests[i].flag;
> + found = true;
> + break;
> + }
> + }
> + for_each_test(test) {
> + if (strcmp(test_name,
> +test->arg_name) == 0) {
> + enabled_tests |= test->bit;
> + found = true;
>   break;
>   }
>   }
> - if(available_tests[i].name == NULL)
> + if (!found)
>   usage(argv[0]);
>   }
> 
> diff --git a/rendercheck.h b/rendercheck.h
> index 2195cb4..f0fa7b7 100644
> --- a/rendercheck.h
> +++ b/rendercheck.h
> @@ -64,6 +64,19 @@ struct op_info {
>   bool disabled;
> };
> 
> +struct rendercheck_test_result {
> + int tests;
> + int passed;
> +};
> +
> 

Re: [PATCH xserver 3/8] {xwin, xquartz}/glx: Always enable GLX_{ARB, SGIS}_multisample

2016-03-22 Thread Jeremy Huddleston Sequoia
The xquartz -s look good given the change to core.

Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

> On Mar 21, 2016, at 13:29, Adam Jackson <a...@redhat.com> wrote:
> 
> This is enabled unconditionally in the GLX core. For xwin, if the
> backend doesn't support WGL_ARB_multisample, there will simply be no
> fbconfigs that support it.
> 
> Signed-off-by: Adam Jackson <a...@redhat.com>
> ---
> hw/xquartz/GL/indirect.c |  3 ---
> hw/xwin/glx/indirect.c   | 24 ++--
> 2 files changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
> index 4f3e2e4..54c9073 100644
> --- a/hw/xquartz/GL/indirect.c
> +++ b/hw/xquartz/GL/indirect.c
> @@ -555,9 +555,6 @@ __glXAquaScreenProbe(ScreenPtr pScreen)
> __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
> __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
> 
> -__glXEnableExtension(screen->glx_enable_bits, "GLX_SGIS_multisample");
> -__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_multisample");
> -
> //__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context");
> //__glXEnableExtension(screen->glx_enable_bits, 
> "GLX_ARB_create_context_profile");
> 
> diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
> index a01757b..b4b773f 100644
> --- a/hw/xwin/glx/indirect.c
> +++ b/hw/xwin/glx/indirect.c
> @@ -641,6 +641,10 @@ glxWinScreenProbe(ScreenPtr pScreen)
> __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
> __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
> 
> +// GLX_ARB_multisample is always enabled, even if no configs support 
> it
> +if (strstr(wgl_extensions, "WGL_ARB_multisample"))
> +screen->has_WGL_ARB_multisample = TRUE;
> +
> if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) {
> __glXEnableExtension(screen->glx_enable_bits,
>  "GLX_SGI_make_current_read");
> @@ -677,16 +681,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
> screen->has_WGL_ARB_pbuffer = TRUE;
> }
> 
> -if (strstr(wgl_extensions, "WGL_ARB_multisample")) {
> -__glXEnableExtension(screen->glx_enable_bits,
> - "GLX_ARB_multisample");
> -__glXEnableExtension(screen->glx_enable_bits,
> - "GLX_SGIS_multisample");
> -LogMessage(X_INFO,
> -   "AIGLX: enabled GLX_ARB_multisample and 
> GLX_SGIS_multisample\n");
> -screen->has_WGL_ARB_multisample = TRUE;
> -}
> -
> screen->base.destroy = glxWinScreenDestroy;
> screen->base.createContext = glxWinCreateContext;
> screen->base.createDrawable = glxWinCreateDrawable;
> @@ -747,14 +741,8 @@ glxWinScreenProbe(ScreenPtr pScreen)
> // ARB_multisample -> 1.4
> //
> if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read) {
> -if (screen->has_WGL_ARB_multisample) {
> -screen->base.GLXmajor = 1;
> -screen->base.GLXminor = 4;
> -}
> -else {
> -screen->base.GLXmajor = 1;
> -screen->base.GLXminor = 3;
> -}
> +screen->base.GLXmajor = 1;
> +screen->base.GLXminor = 4;
> }
> }
> LogMessage(X_INFO, "AIGLX: Set GLX version to %d.%d\n",
> -- 
> 2.5.0
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 5/8] xquartz/glx: Error out for MakeContextCurrent(draw != read)

2016-03-22 Thread Jeremy Huddleston Sequoia
With the change to !=:
Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

> On Mar 21, 2016, at 13:29, Adam Jackson <a...@redhat.com> wrote:
> 
> CGL doesn't have a way to express this directly, unlike EGL WGL and GLX.
> It might be implementable, but it's never actually worked, and it's a
> fairly niche feature so we're better off throwing an error if someone
> attempts it.
> 
> Signed-off-by: Adam Jackson <a...@redhat.com>
> ---
> hw/xquartz/GL/indirect.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
> index 54c9073..c0648c4 100644
> --- a/hw/xquartz/GL/indirect.c
> +++ b/hw/xquartz/GL/indirect.c
> @@ -387,6 +387,9 @@ __glXAquaContextMakeCurrent(__GLXcontext *baseContext)
> 
> GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext);
> 
> +if (context->base.drawPriv !+ context->base.readPriv)
> +return 0;
> +
> if (attach(context, drawPriv))
> return /*error*/ 0;
> 
> -- 
> 2.5.0
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libXaw3d 1/2] darwin: Remove incorrect export of vendorShellClassRec and vendorShellWidgetClass

2016-01-06 Thread Jeremy Huddleston Sequoia
Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 src/Vendor.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/Vendor.c b/src/Vendor.c
index 8899cd1..6b34b31 100644
--- a/src/Vendor.c
+++ b/src/Vendor.c
@@ -110,12 +110,21 @@ static void XawVendorShellClassPartInit(WidgetClass);
 void XawVendorShellExtResize(Widget);
 #endif
 
-#if defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__)
+#if defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__) || 
defined(__APPLE__)
 /* to fix the EditRes problem because of wrong linker semantics */
 extern WidgetClass vendorShellWidgetClass; /* from Xt/Vendor.c */
 extern VendorShellClassRec _XawVendorShellClassRec;
 void _XawFixupVendorShell(void);
 
+#if defined(__APPLE__)
+__attribute__((constructor))
+static void __VendorShellHack(void)
+{
+vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec);
+_XawFixupVendorShell();
+}
+#endif
+
 #if defined(__UNIXOS2__)
 unsigned long _DLL_InitTerm(unsigned long mod,unsigned long flag)
 {
@@ -229,9 +238,10 @@ externaldef(vendorshellclassrec) VendorShellClassRec 
vendorShellClassRec = {
   }
 };
 
+#if !defined(__APPLE__)
 externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
(WidgetClass) ();
-
+#endif
 
 #ifdef XAW_INTERNATIONALIZATION
 /***
@@ -475,7 +485,7 @@ XawVendorShellClassPartInit(WidgetClass class)
 }
 #endif
 
-#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || 
defined(__MINGW32__)
+#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || 
defined(__MINGW32__) || defined(__APPLE__)
 /* stupid OSF/1 shared libraries have the wrong semantics */
 /* symbols do not get resolved external to the shared library */
 void
-- 
2.6.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

CC_CHECK_FLAGS_APPEND (was Re: libXfont: Changes to 'master')

2015-12-08 Thread Jeremy Huddleston Sequoia
./configure: line 19194: syntax error near unexpected token `with_cflags,'
./configure: line 19194: `  CC_CHECK_FLAGS_APPEND(with_cflags, CFLAGS, \'

From what I can tell, CC_CHECK_FLAGS_APPEND comes from glib.  Can we please not 
add a dependency on glib for this?

--Jeremy

> commit eb67d10ae82b364a4324e96ce53baaa4e5e75f97
> Author: Keith Packard 
> Date:   Mon Dec 7 15:46:13 2015 -0800
> 
>Add compiler warning flags and fix warnings
> 
>Mostly signed vs unsigned comparisons
> 
>Signed-off-by: Keith Packard 
> 
> ___
> xorg-commit mailing list
> xorg-com...@lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-commit



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: Disabling RECORD by default

2015-11-23 Thread Jeremy Huddleston Sequoia
The XQuartz option was meant mainly for RECORD.  I'll followup later to add a 
preference option for RECORD in XQuartz.

Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

--Jeremy


> On Nov 23, 2015, at 18:13, Keith Packard <kei...@keithp.com> wrote:
> 
> Keith Packard <kei...@keithp.com> writes:
> 
> Here's a patch, which first splits out the command line and config file
> options for XTEST and RECORD, and then disables RECORD by default but
> leaves XTEST enabled by default.
> 
> From 2f1872f518ca7640efc42870800536f8e45c4b23 Mon Sep 17 00:00:00 2001
> From: Keith Packard <kei...@keithp.com>
> Date: Mon, 23 Nov 2015 14:49:33 -0800
> Subject: [PATCH xserver] Allow RECORD and XTEST to be controlled separately
> 
> RECORD and XTEST were both controlled by the -tst server option and
> XTEST extension selection. Split these out and then make RECORD be
> disabled by default.
> 
> Signed-off-by: Keith Packard <kei...@keithp.com>
> ---
> hw/xquartz/X11Application.m |  8 
> include/globals.h   |  5 -
> mi/miinitext.c  |  9 ++---
> os/utils.c  | 20 +---
> 4 files changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
> index d2c5d30..1348480 100644
> --- a/hw/xquartz/X11Application.m
> +++ b/hw/xquartz/X11Application.m
> @@ -82,7 +82,7 @@ static dispatch_queue_t eventTranslationQueue;
> #endif
> #endif
> 
> -extern Bool noTestExtensions;
> +extern Bool noXTestExtension;
> extern Bool noRenderExtension;
> extern BOOL serverRunning;
> 
> @@ -901,7 +901,7 @@ cfarray_to_nsarray(CFArrayRef in)
> darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
>   default   :darwinDesiredDepth];
> 
> -noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
> +noXTestExtension = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
>  default   :FALSE];
> 
> noRenderExtension = ![self prefs_get_boolean:@PREFS_RENDER_EXTENSION
> @@ -1592,7 +1592,7 @@ handle_mouse:
> }
> }
> 
> -if (!XQuartzServerVisible && noTestExtensions) {
> +if (!XQuartzServerVisible && noXTestExtension) {
> #if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
> /* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, 
> so we can't call xp_find_window from the Appkit thread */
> xp_window_id wid = 0;
> @@ -1695,7 +1695,7 @@ handle_mouse:
> /* If we're in the background, we need to send a MotionNotify event
>  * first, since we aren't getting them on background mouse motion
>  */
> -if (!XQuartzServerVisible && noTestExtensions) {
> +if (!XQuartzServerVisible && noXTestExtension) {
> bgMouseLocationUpdated = FALSE;
> DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
> location.x, location.y,
> diff --git a/include/globals.h b/include/globals.h
> index 858c9a3..42f21ce 100644
> --- a/include/globals.h
> +++ b/include/globals.h
> @@ -23,7 +23,10 @@ extern _X_EXPORT int monitorResolution;
> extern _X_EXPORT int defaultColorVisualClass;
> 
> extern _X_EXPORT int GrabInProgress;
> -extern _X_EXPORT Bool noTestExtensions;
> +extern _X_EXPORT Bool noXTestExtension;
> +#ifdef XRECORD
> +extern _X_EXPORT Bool noRecordExtension;
> +#endif
> extern _X_EXPORT char *SeatId;
> extern _X_EXPORT char *ConnectionInfo;
> extern _X_EXPORT sig_atomic_t inSignalContext;
> diff --git a/mi/miinitext.c b/mi/miinitext.c
> index 5fc44e3..a089a2c 100644
> --- a/mi/miinitext.c
> +++ b/mi/miinitext.c
> @@ -149,6 +149,9 @@ static ExtensionToggle ExtensionToggleList[] = {
> #ifdef RANDR
> {"RANDR", },
> #endif
> +#ifdef XRECORD
> +{"RECORD", },
> +#endif
> {"RENDER", },
> #ifdef XCSECURITY
> {"SECURITY", },
> @@ -179,7 +182,7 @@ static ExtensionToggle ExtensionToggleList[] = {
> #ifdef XSELINUX
> {"SELinux", },
> #endif
> -{"XTEST", },
> +{"XTEST", },
> #ifdef XV
> {"XVideo", },
> #endif
> @@ -245,7 +248,7 @@ static const ExtensionModule staticExtensions[] = {
> #endif
> {XInputExtensionInit, "XInputExtension", NULL},
> #ifdef XTEST
> -{XTestExtensionInit, XTestExtensionName, },
> +{XTestExtensionInit, XTestExtensionName, },
> #endif
> {BigReqExtensionInit, "BIG-REQUESTS", NULL},
> {SyncExtensionInit, "SYNC&

Re: [PATCH:xorg-docs 3/4] X.man: document protocol/ syntax in display string

2015-10-28 Thread Jeremy Huddleston Sequoia
Should we also mention the extension that was added for launchd support where 
we DISPLAY=[.]

> On Oct 27, 2015, at 19:45, Alan Coopersmith  
> wrote:
> 
> See 
> http://www.x.org/releases/X11R7.7/doc/libX11/libX11/libX11.html#Opening_the_Display
> 
> Signed-off-by: Alan Coopersmith 
> ---
> man/X.man |   25 ++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/man/X.man b/man/X.man
> index d07e69e..a4f4614 100644
> --- a/man/X.man
> +++ b/man/X.man
> @@ -1,4 +1,4 @@
> -.\" t
> +'\" t
> .\"
> .\" Copyright (c) 1994, 2004  The Open Group
> .\" Copyright \(co 2000  The XFree86 Project, Inc.
> @@ -165,15 +165,34 @@ form:
> .RS
> \fIhostname:displaynumber.screennumber\fP
> .RE
> +or
> +.RS
> +\fIprotocol/hostname:displaynumber.screennumber\fP
> +.RE
> .sp
> This information is used by the application to determine how it should
> connect to the server and which screen it should use by default
> (on displays with multiple monitors):
> .TP 8
> +.I protocol
> +The \fIprotocol\fP specifies the protocol to use for communication.
> +Exactly which protocols are supported is platform dependent, but most
> +commonly supported ones are:
> +.TS
> +l l.
> +tcp TCP over IPv4 or IPv6
> +inetTCP over IPv4 only
> +inet6   TCP over IPv6 only
> +unixUNIX Domain Sockets (same host only)
> +local   Platform preferred local connection method
> +.TE
> +If the protocol is not specified, Xlib uses whatever it believes is the
> +most efficient transport.
> +.TP 8
> .I hostname
> The \fIhostname\fP specifies the name of the machine to which the display is
> -physically connected.  If the hostname is not given, the most efficient way 
> of
> -communicating to a server on the same machine will be used.
> +physically connected.  If the hostname is not given, a connection to a server
> +on the same machine will be used.
> .TP 8
> .I displaynumber
> The phrase "display" is usually used to refer to a collection of monitors that
> -- 
> 1.7.9.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH:xserver 1/3] Xorg.man: move XLOCAL details to X(7) man page instead

2015-10-28 Thread Jeremy Huddleston Sequoia
Series:

Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

> On Oct 27, 2015, at 19:44, Alan Coopersmith <alan.coopersm...@oracle.com> 
> wrote:
> 
> These settings affect clients, not server, so belong there, next to
> the information about how to set $DISPLAY.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
> ---
> hw/xfree86/man/Xorg.man |   55 ++-
> 1 file changed, 2 insertions(+), 53 deletions(-)
> 
> diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
> index 646a90c..b23db3d 100644
> --- a/hw/xfree86/man/Xorg.man
> +++ b/hw/xfree86/man/Xorg.man
> @@ -44,7 +44,8 @@ byte-streams:
> .I "Local"
> On most platforms, the "Local" connection type is a UNIX-domain socket.
> On some System V platforms, the "local" connection types also include
> -STREAMS pipes, named pipes, and some other mechanisms.
> +STREAMS pipes, named pipes, and some other mechanisms.  See the
> +"LOCAL CONNECTIONS" section of X(__miscmansuffix__) for details.
> .TP 4
> .I TCP/IP
> .B Xorg
> @@ -55,58 +56,6 @@ where
> is the display number.  This connection type can be disabled with the
> .B \-nolisten
> option (see the Xserver(1) man page for details).
> -.SH "ENVIRONMENT VARIABLES"
> -For operating systems that support local connections other than Unix
> -Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying
> -the order in which local connections should be attempted.  This list
> -can be overridden by the
> -.I XLOCAL
> -environment variable described below.  If the display name indicates a
> -best-choice connection should be made (e.g.
> -.BR :0.0 ),
> -each connection mechanism is tried until a connection succeeds or no
> -more mechanisms are available.  Note: for these OSs, the Unix Domain
> -socket connection is treated differently from the other local connection
> -types.  To use it the connection must be made to
> -.BR unix:0.0 .
> -.PP
> -The
> -.I XLOCAL
> -environment variable should contain a list of one more
> -more of the following:
> -.PP
> -.RS 8
> -.nf
> -NAMED
> -PTS
> -SCO
> -ISC
> -.fi
> -.RE
> -.PP
> -which represent SVR4 Named Streams pipe, Old-style USL Streams pipe,
> -SCO XSight Streams pipe, and ISC Streams pipe, respectively.  You can
> -select a single mechanism (e.g.
> -.IR XLOCAL=NAMED ),
> -or an ordered list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP).
> -his variable overrides the compiled-in defaults.  For SVR4 it is
> -recommended that
> -.I NAMED
> -be the first preference connection.  The default setting is
> -.IR PTS:NAMED:ISC:SCO .
> -.PP
> -To globally override the compiled-in defaults, you should define (and
> -export if using
> -.B sh
> -or
> -.BR ksh )
> -.I XLOCAL
> -globally.  If you use startx(1) or xinit(1), the definition should be
> -at the top of your
> -.I .xinitrc
> -file.  If you use xdm(1), the definitions should be early on in the
> -.I __projectroot__/lib/X11/xdm/Xsession
> -script.
> .SH OPTIONS
> .B Xorg
> supports several mechanisms for supplying/obtaining configuration and
> -- 
> 1.7.9.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH:macros] XORG_MANPAGE_SECTIONS: limit SVR4 man page sections to Solaris 2.0-11

2015-10-27 Thread Jeremy Huddleston Sequoia

> On Oct 27, 2015, at 16:06, Alan Coopersmith <alan.coopersm...@oracle.com> 
> wrote:
> 
> All others (including other SunOS/Solaris releases) use the
> traditional Bell Labs / BSD / Linux section numbering.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
> ---
> xorg-macros.m4.in |   22 +-
> 1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index f160a40..c62fae5 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1,6 +1,6 @@
> dnl @configure_input@
> dnl
> -dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights 
> reserved.
> +dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights 
> reserved.

"-" rather than ","

Other than that,

Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

> dnl
> dnl Permission is hereby granted, free of charge, to any person obtaining a
> dnl copy of this software and associated documentation files (the "Software"),
> @@ -130,8 +130,9 @@ fi
> 
> if test x$FILE_MAN_SUFFIX = x; then
> case $host_os in
> - solaris*)   FILE_MAN_SUFFIX=4  ;;
> - *)  FILE_MAN_SUFFIX=5  ;;
> + # Solaris 2.0 - 11 use SVR4 man page sections
> + solaris2.?|solaris2.1[[01]])FILE_MAN_SUFFIX=4  ;;
> + *)  FILE_MAN_SUFFIX=5  ;;
> esac
> fi
> if test x$FILE_MAN_DIR = x; then
> @@ -140,8 +141,9 @@ fi
> 
> if test x$MISC_MAN_SUFFIX = x; then
> case $host_os in
> - solaris*)   MISC_MAN_SUFFIX=5  ;;
> - *)  MISC_MAN_SUFFIX=7  ;;
> + # Solaris 2.0 - 11 use SVR4 man page sections
> + solaris2.?|solaris2.1[[01]])MISC_MAN_SUFFIX=5  ;;
> + *)  MISC_MAN_SUFFIX=7  ;;
> esac
> fi
> if test x$MISC_MAN_DIR = x; then
> @@ -150,8 +152,9 @@ fi
> 
> if test x$DRIVER_MAN_SUFFIX = x; then
> case $host_os in
> - solaris*)   DRIVER_MAN_SUFFIX=7  ;;
> - *)  DRIVER_MAN_SUFFIX=4  ;;
> + # Solaris 2.0 - 11 use SVR4 man page sections
> + solaris2.?|solaris2.1[[01]])DRIVER_MAN_SUFFIX=7  ;;
> + *)  DRIVER_MAN_SUFFIX=4  ;;
> esac
> fi
> if test x$DRIVER_MAN_DIR = x; then
> @@ -160,8 +163,9 @@ fi
> 
> if test x$ADMIN_MAN_SUFFIX = x; then
> case $host_os in
> - solaris*)   ADMIN_MAN_SUFFIX=1m ;;
> - *)  ADMIN_MAN_SUFFIX=8  ;;
> + # Solaris 2.0 - 11 use SVR4 man page sections
> + solaris2.?|solaris2.1[[01]])ADMIN_MAN_SUFFIX=1m ;;
> + *)  ADMIN_MAN_SUFFIX=8  ;;
> esac
> fi
> if test x$ADMIN_MAN_DIR = x; then
> -- 
> 1.7.9.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] xfree86: Use same inb/outb asm code for i386 amd64 and ia64

2015-10-21 Thread Jeremy Huddleston Sequoia
Reviewed-by: Jeremy Huddleston Sequoia <jerem...@apple.com>

> On Oct 21, 2015, at 09:24, Adam Jackson <a...@redhat.com> wrote:
> 
> This matches the GCCUSESGAS path from the old monolith build (where that
> macro was actually set), and fixes the build on modern OSX.
> 
> Signed-off-by: Adam Jackson <a...@redhat.com>
> ---
> hw/xfree86/common/compiler.h | 49 +---
> 1 file changed, 1 insertion(+), 48 deletions(-)
> 
> diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
> index 85fb35c..5a1fdac 100644
> --- a/hw/xfree86/common/compiler.h
> +++ b/hw/xfree86/common/compiler.h
> @@ -286,7 +286,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port);
> #include 
> #endif  /* __NetBSD__ */
> 
> -#elif defined(__amd64__)
> +#elif defined(__amd64__) || defined(__i386__) || defined(__ia64__)
> 
> #include 
> 
> @@ -967,53 +967,6 @@ inl(unsigned PORT_SIZE port)
> 
> #endif  /* NDS32_MMIO_SWAP */
> 
> -#elif defined(__i386__) || defined(__ia64__)
> -
> -static __inline__ void
> -outb(unsigned short port, unsigned char val)
> -{
> -__asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port));
> -}
> -
> -static __inline__ void
> -outw(unsigned short port, unsigned short val)
> -{
> -__asm__ __volatile__("out%W0 (%1)"::"a"(val), "d"(port));
> -}
> -
> -static __inline__ void
> -outl(unsigned short port, unsigned int val)
> -{
> -__asm__ __volatile__("out%L0 (%1)"::"a"(val), "d"(port));
> -}
> -
> -static __inline__ unsigned int
> -inb(unsigned short port)
> -{
> -unsigned char ret;
> -__asm__ __volatile__("in%B0 (%1)":"=a"(ret):"d"(port));
> -
> -return ret;
> -}
> -
> -static __inline__ unsigned int
> -inw(unsigned short port)
> -{
> -unsigned short ret;
> -__asm__ __volatile__("in%W0 (%1)":"=a"(ret):"d"(port));
> -
> -return ret;
> -}
> -
> -static __inline__ unsigned int
> -inl(unsigned short port)
> -{
> -unsigned int ret;
> -__asm__ __volatile__("in%L0 (%1)":"=a"(ret):"d"(port));
> -
> -return ret;
> -}
> -
> #endif  /* arch madness */
> 
> #else   /* !GNUC */
> -- 
> 2.5.0
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/1] xfree86: Use the correct __i386__ inline asm fallbacks in compiler.h

2015-10-20 Thread Jeremy Huddleston Sequoia
../../../../hw/xfree86/common/compiler.h:975:26: error: invalid operand in 
inline asm: 'out${0:B} ($1)' [Inline Assembly Issue]
__asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port));
 ^
../../../../hw/xfree86/common/compiler.h:975:26: error: unknown use of 
instruction mnemonic without a size suffix [Inline Assembly Issue]
:1:2: note: instantiated into assembly here
out (%dx)
^
2 errors generated.

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
CC: Adam Jackson <a...@nwnk.net>
---
 hw/xfree86/common/compiler.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 1653574..1f48f69 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -286,7 +286,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port);
 #include 
 #endif  /* __NetBSD__ */
 
-#elif defined(__amd64__)
+#elif defined(__i386__) || defined(__amd64__)
 
 #include 
 
@@ -967,7 +967,7 @@ inl(unsigned PORT_SIZE port)
 
 #endif  /* NDS32_MMIO_SWAP */
 
-#elif defined(__i386__) || defined(__ia64__)
+#elif defined(__ia64__)
 
 static __inline__ void
 outb(unsigned short port, unsigned char val)
-- 
2.6.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/1] xfree86: Use the correct __i386__ inline asm fallbacks in compiler.h

2015-10-20 Thread Jeremy Huddleston Sequoia
Note that I'm not 100% confident that this is correct.  It looks right to me, 
but I'm certainly no expert here.  That file is chuck full of cpp-goop that 
makes my head spin.

The reason we hadn't seen this until recently is that we were using -DFAKEIT 
for builds on darwin because we didn't care about that code anyways (we just 
use fake, null, nested drivers).  That was removed in 
80446086b9cfcc5e23a400d7fa38ec773fae68fc, and we are just now jumping to 1.17.x 
for the next XQuartz release.  Note that tinderbox would've caught this if it 
were still alive =(

--Jeremy


> On Oct 20, 2015, at 10:52, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> ../../../../hw/xfree86/common/compiler.h:975:26: error: invalid operand in 
> inline asm: 'out${0:B} ($1)' [Inline Assembly Issue]
>__asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port));
> ^
> ../../../../hw/xfree86/common/compiler.h:975:26: error: unknown use of 
> instruction mnemonic without a size suffix [Inline Assembly Issue]
> :1:2: note: instantiated into assembly here
>    out (%dx)
>^
> 2 errors generated.
> 
> Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
> CC: Adam Jackson <a...@nwnk.net>
> ---
> hw/xfree86/common/compiler.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
> index 1653574..1f48f69 100644
> --- a/hw/xfree86/common/compiler.h
> +++ b/hw/xfree86/common/compiler.h
> @@ -286,7 +286,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port);
> #include 
> #endif  /* __NetBSD__ */
> 
> -#elif defined(__amd64__)
> +#elif defined(__i386__) || defined(__amd64__)
> 
> #include 
> 
> @@ -967,7 +967,7 @@ inl(unsigned PORT_SIZE port)
> 
> #endif  /* NDS32_MMIO_SWAP */
> 
> -#elif defined(__i386__) || defined(__ia64__)
> +#elif defined(__ia64__)
> 
> static __inline__ void
> outb(unsigned short port, unsigned char val)
> -- 
> 2.6.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 3/4] dix: Silence -Wunused-variable warning by moving window.c off of legacy region defines

2015-10-19 Thread Jeremy Huddleston Sequoia
window.c:223:15: warning: unused variable 'pScreen' [-Wunused-variable,Unused 
Entity Issue]
ScreenPtr pScreen = pWin->drawable.pScreen;
  ^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 dix/window.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dix/window.c b/dix/window.c
index d57f320..69b5a7c 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -220,7 +220,6 @@ log_window_info(WindowPtr pWin, int depth)
 int i;
 const char *win_name, *visibility;
 BoxPtr rects;
-ScreenPtr pScreen = pWin->drawable.pScreen;
 
 for (i = 0; i < (depth << 2); i++)
 ErrorF(" ");
@@ -240,7 +239,7 @@ log_window_info(WindowPtr pWin, int depth)
 ErrorF(" (%s compositing: pixmap %x)",
(pWin->redirectDraw == RedirectDrawAutomatic) ?
"automatic" : "manual",
-   (unsigned) pScreen->GetWindowPixmap(pWin)->drawable.id);
+   (unsigned) 
pWin->drawable.pScreen->GetWindowPixmap(pWin)->drawable.id);
 #endif
 
 switch (pWin->visibility) {
@@ -259,10 +258,10 @@ log_window_info(WindowPtr pWin, int depth)
 }
 ErrorF(", %s", visibility);
 
-if (REGION_NOTEMPTY(pScreen, >clipList)) {
+if (RegionNotEmpty(>clipList)) {
 ErrorF(", clip list:");
-rects = REGION_RECTS(>clipList);
-for (i = 0; i < REGION_NUM_RECTS(>clipList); i++)
+rects = RegionRects(>clipList);
+for (i = 0; i < RegionNumRects(>clipList); i++)
 ErrorF(" [(%d, %d) to (%d, %d)]",
rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
 ErrorF("; extents [(%d, %d) to (%d, %d)]",
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 2/4] glx: Fix header length error checking in __glXDisp_RenderLarge

2015-10-19 Thread Jeremy Huddleston Sequoia
glxcmds.c:2206:46: warning: comparison of unsigned expression < 0 is always 
false [-Wtautological-compare,Semantic
Issue]
if ((cmdlen = safe_pad(hdr->length)) < 0)
 ^ ~

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 glx/glxcmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index cbd4ede..0416dac 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2182,7 +2182,7 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
 __GLXrenderSizeData entry;
 int extra = 0;
 int left = (req->length << 2) - sz_xGLXRenderLargeReq;
-size_t cmdlen;
+int cmdlen;
 int err;
 
 /*
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 4/4] osinit: Silence -Wunused-variable warnings

2015-10-19 Thread Jeremy Huddleston Sequoia
osinit.c:161:24: warning: unused variable 'devnull' [-Wunused-variable,Unused 
Entity Issue]
static const char *devnull = "/dev/null";
   ^
osinit.c:162:10: warning: unused variable 'fname' [-Wunused-variable,Unused 
Entity Issue]
char fname[PATH_MAX];
 ^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 os/osinit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/os/osinit.c b/os/osinit.c
index ddd3fce..6ec2f11 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -158,8 +158,10 @@ void
 OsInit(void)
 {
 static Bool been_here = FALSE;
+#ifndef XQUARTZ
 static const char *devnull = "/dev/null";
 char fname[PATH_MAX];
+#endif
 
 if (!been_here) {
 #if !defined(WIN32) || defined(__CYGWIN__)
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 1/4] randr: Silence -Wshift-negative-value warnings

2015-10-19 Thread Jeremy Huddleston Sequoia
rrtransform.c:199:23: warning: shifting a negative signed value is undefined 
[-Wshift-negative-value,Semantic Issue]
rot_cos = F(-1);
  ^
rrtransform.c:114:14: note: expanded from macro 'F'
^~
../render/picture.h:200:24: note: expanded from macro 'IntToxFixed'
^~
/opt/X11/include/pixman-1/pixman.h:130:56: note: expanded from macro 
'pixman_int_to_fixed'
   ~~~ ^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 randr/rrtransform.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 26b0649..d32b43a 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -196,7 +196,7 @@ RRTransformCompute(int x,
 f_rot_sin = 0;
 f_rot_dx = width;
 f_rot_dy = height;
-rot_cos = F(-1);
+rot_cos = F(~0u);
 rot_sin = F(0);
 rot_dx = F(width);
 rot_dy = F(height);
@@ -207,7 +207,7 @@ RRTransformCompute(int x,
 f_rot_dx = 0;
 f_rot_dy = width;
 rot_cos = F(0);
-rot_sin = F(-1);
+rot_sin = F(~0u);
 rot_dx = F(0);
 rot_dy = F(width);
 break;
@@ -230,7 +230,7 @@ RRTransformCompute(int x,
 scale_dy = 0;
 if (rotation & RR_Reflect_X) {
 f_scale_x = -1;
-scale_x = F(-1);
+scale_x = F(~0u);
 if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
 f_scale_dx = width;
 scale_dx = F(width);
@@ -242,7 +242,7 @@ RRTransformCompute(int x,
 }
 if (rotation & RR_Reflect_Y) {
 f_scale_y = -1;
-scale_y = F(-1);
+scale_y = F(~0u);
 if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
 f_scale_dy = height;
 scale_dy = F(height);
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH v2 4/4] osinit: Silence -Wunused-variable warnings

2015-10-19 Thread Jeremy Huddleston Sequoia
Actually, only this last one is "v2".

The others I just still need a Reviewed-by: for, but they're unchanged from 
earlier.  Sorry for any confusion.

> On Oct 18, 2015, at 23:12, Jeremy Huddleston Sequoia <jerem...@apple.com> 
> wrote:
> 
> osinit.c:161:24: warning: unused variable 'devnull' [-Wunused-variable,Unused 
> Entity Issue]
>static const char *devnull = "/dev/null";
>   ^
> osinit.c:162:10: warning: unused variable 'fname' [-Wunused-variable,Unused 
> Entity Issue]
>    char fname[PATH_MAX];
> ^
> 
> Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
> ---
> os/osinit.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/os/osinit.c b/os/osinit.c
> index ddd3fce..6ec2f11 100644
> --- a/os/osinit.c
> +++ b/os/osinit.c
> @@ -158,8 +158,10 @@ void
> OsInit(void)
> {
> static Bool been_here = FALSE;
> +#ifndef XQUARTZ
> static const char *devnull = "/dev/null";
> char fname[PATH_MAX];
> +#endif
> 
> if (!been_here) {
> #if !defined(WIN32) || defined(__CYGWIN__)
> -- 
> 2.6.1
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xquartz 04/10] randr: Silence -Wshift-negative-value warnings

2015-10-19 Thread Jeremy Huddleston Sequoia

> On Oct 19, 2015, at 08:31, Adam Jackson <a...@nwnk.net> wrote:
> 
> On Wed, 2015-10-14 at 15:44 -0700, Jeremy Huddleston Sequoia wrote:
>>> On Oct 14, 2015, at 15:33, Alan Coopersmith  wrote:
>>> 
>>> On 10/14/15 03:13 PM, Jeremy Huddleston Sequoia wrote:
>>>> rrtransform.c:199:23: warning: shifting a negative signed value
>>>> is undefined [-Wshift-negative-value,Semantic Issue]
>>>> rot_cos = F(-1);
>>> 
>>> 
>>>> -rot_cos = F(-1);
>>>> +rot_cos = F(~0u);
>>> 
>>> Is -1 guaranteed to be ~0u on all platforms?   Or just all the ones
>>> we know and care about?
>> 
>> I'm pretty certain that ~0u and -1 are the same bit patterns on all
>> platforms.  I can't think of a reason why they wouldn't be.
> 
> On a ones' complement machine, (uint8_t)-1 is 0b1110.  On a signed-
> magnitude machine, (uint8_t)-1 is 0b1001.  But I think you're
> significantly more likely to encounter a PDP-endian machine than a non-
> two's-complement machine at this point, and there's plenty of other
> places in xserver where we're assuming two's complement, e.g.:
> 
> fb/fb.h:#define FB_ALLONES  ((FbBits) -1)

True.  I should have been explicit that I was talking about two's complement 
platforms when I said "all".  I just can't imagine anyone actually trying to 
support anything other than two's complement.  That would be insanely crazy.

smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PULL] XQuartz -- Fix launching with ASan

2015-10-19 Thread Jeremy Huddleston Sequoia
Hey ajax,

Thanks for merging the warning fixes I sent.  I was actually going to just roll 
them into this pull-request once they were reviewed, but now it's just down to 
two XQuartz changes.

Thanks,
Jeremy


The following changes since commit ec6294116cc41ff1c3be081b626952fb7e614244:

  osinit: Silence -Wunused-variable warnings (2015-10-19 11:52:05 -0400)

are available in the git repository at:

  git://people.freedesktop.org/~jeremyhu/xserver 

for you to fetch changes up to 27ad21254f257bac6c647315d749ee69f20c24e0:

  XQuartz: Cleanup formatting of DarwinEQInit that was butchered by automation 
a few years ago (2015-10-19 09:06:22 -0700)


Jeremy Huddleston Sequoia (2):
  XQuartz: Make sure that darwin_all_modifier_mask_additions is 0-terminated
  XQuartz: Cleanup formatting of DarwinEQInit that was butchered by 
automation a few years ago

 hw/xquartz/darwinEvents.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: X server commit process

2015-10-19 Thread Jeremy Huddleston Sequoia

> On Oct 19, 2015, at 08:56, Julien Cristau  wrote:
> 
> On Mon, Oct 19, 2015 at 11:47:09 -0400, Adam Jackson wrote:
> 
>> I don't think there's anyone currently working on 1.16 or older.
>> 
> I'm still interested in 1.16 as that's what Debian 8 ships, but at this
> point I guess it's going to be mostly CVE fixes, if anything.

I just shipped XQuartz 2.7.8 based on 1.16.4, but that will likely be the last 
1.16 based release I do.

--Jeremy



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] xorg-wrapper: when starting the server as root, reset its environment

2015-10-18 Thread Jeremy Huddleston Sequoia
I would suggest maybe instead doing:

int main(int argc, char *argv[], char *envp[]) {
...
if (getuid() != geteuid())
envp = {NULL, };
(void)execve(argv[0], argv, envp);
...
}

Or at least name the variable something like empty_envp to distinguish it more 
clearly from the process's environment since it's common to have a main 
signature of int main(int argc, char *argv[], char *envp[]).

--Jeremy

> On Oct 18, 2015, at 10:26, Julien Cristau  wrote:
> 
> When the server is privileged, we shouldn't be passing the user's
> environment directly.
> 
> Signed-off-by: Julien Cristau 
> ---
> hw/xfree86/xorg-wrapper.c | 6 +-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> It's possible some variables should be passed, in which case we could
> use a whitelist; in my testing this patch seemed to work, though.
> 
> diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
> index 22e97ad..d6efb23 100644
> --- a/hw/xfree86/xorg-wrapper.c
> +++ b/hw/xfree86/xorg-wrapper.c
> @@ -190,6 +190,7 @@ int main(int argc, char *argv[])
> int total_cards = 0;
> int allowed = CONSOLE_ONLY;
> int needs_root_rights = -1;
> +char *const envp[1] = { NULL, };
> 
> progname = argv[0];
> 
> @@ -265,7 +266,10 @@ int main(int argc, char *argv[])
> }
> 
> argv[0] = buf;
> -(void) execv(argv[0], argv);
> +if (getuid() == geteuid())
> +(void) execv(argv[0], argv);
> +else
> +(void) execve(argv[0], argv, envp);
> fprintf(stderr, "%s: Failed to execute %s: %s\n",
> progname, buf, strerror(errno));
> exit(1);
> -- 
> 2.6.1
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: X server commit process

2015-10-16 Thread Jeremy Huddleston Sequoia
What is the current process for pulling into release branches?  Are the 
breakdowns the same, or is someone specific going to manage release branches?

> On Oct 16, 2015, at 09:21, Keith Packard  wrote:
> 
> 
> We had a discussion at XDC which resulted in some minor changes in how
> patches are getting merged to the X server. Instead of having everything
> route through me, we've got a group of people doing that work, each
> focused on different areas:
> 
> * Eric Anholt  - glamor
> * Alan Coopersmith - security
> * Peter Hutterer   - input
> * Adam Jackson - xfree86 backend
> * Keith Packard- misc
> 
> All of us will also pick up minor patches throughout the tree and get
> them merged.
> 
> We still have a requirement that each patch be marked as Reviewed-by:
> and include a Signed-off-by: line, and need to be 'generally agreed to
> be useful'. The latter is sometimes a judgement call, and will depend on
> the current release process status at times.
> 
> Adam has also been working to reduce the patchwork queue in a desperate
> attempt to make that useful.
> 
> We're hoping that this will reduce the time it takes to merge patches,
> especially as I'm available less regularly.
> 
> -- 
> -keith
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xquartz 03/10] xdmauth: Correct miscall of abs() to instrad call labs()

2015-10-15 Thread Jeremy Huddleston Sequoia
Can you elaborate on your concern?

Are you suggesting using difftime() instead of fabs()?  I agree that would 
probably be a good idea, but I don't see why this change would look scary to 
you.

--Jeremy

> On Oct 15, 2015, at 06:47, walter harms <wha...@bfs.de> wrote:
> 
> some nitpicking ...
> man 3 difftime
> 
> i pretty sure it will cause a fundamental change ...
> 
> 
> just my 2 cents
> re,
> wh
> 
> Am 15.10.2015 00:13, schrieb Jeremy Huddleston Sequoia:
>> xdmauth.c:230:13: warning: absolute value function 'abs' given an argument 
>> of type 'long' but has parameter of
>> type
>> 'int'
>>  which may cause truncation of value [-Wabsolute-value,Semantic Issue]
>>if (abs(now - client->time) > TwentyFiveMinutes) {
>>^
>> xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
>>if (abs(now - client->time) > TwentyFiveMinutes) {
>>^~~
>>labs
>> xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of 
>> type 'long' but has parameter of type
>> 'int' which
>>  may cause truncation of value [-Wabsolute-value,Semantic Issue]
>>if (abs(client->time - now) > TwentyMinutes) {
>>^
>> xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
>>if (abs(client->time - now) > TwentyMinutes) {
>>^~~
>>labs
>> 
>> Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
>> ---
>> os/xdmauth.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/os/xdmauth.c b/os/xdmauth.c
>> index f11cbb9..482bc67 100644
>> --- a/os/xdmauth.c
>> +++ b/os/xdmauth.c
>> @@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
>> prev = 0;
>> for (client = xdmClients; client; client = next) {
>> next = client->next;
>> -if (abs(now - client->time) > TwentyFiveMinutes) {
>> +if (labs(now - client->time) > TwentyFiveMinutes) {
>> if (prev)
>> prev->next = next;
>> else
>> @@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int 
>> length,
>> }
>> now += clockOffset;
>> XdmClientAuthTimeout(now);
>> -if (abs(client->time - now) > TwentyMinutes) {
>> +if (labs(client->time - now) > TwentyMinutes) {
>> free(client);
>> if (reason)
>> *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PULL] XQuartz update for ATS allowance of our Sparkle feed and updated menu bar height logic

2015-10-14 Thread Jeremy Huddleston Sequoia

> On Oct 14, 2015, at 06:32, Adam Jackson <a...@nwnk.net> wrote:
> 
> On Wed, 2015-10-14 at 00:40 -0700, Jeremy Huddleston Sequoia wrote:
> 
>>  XQuartz: Relax App Transport Security for communicating with the update 
>> server
> 
> I'm not sure I'm a fan of this change?  ATS looks to be new in 10.11,
> so this might not be a change in behavior in a strict sense, but the
> SSL cert for www.macosforge.org seems to be valid for
> xquartz.macosforge.org and xquartz-dl.macosforge.org so I'm not sure
> why you'd need to turn it off.  What's the story here?

We don't really care about the security of the transport itself.  No 
confidential data is sent from the user's machine during the update process.  
Sparkle validates the downloaded update was signed by my sparkle key, and the 
installer verifies that the contained package was installed by my app developer 
key.

The main reason I don't just leave it alone and update the URL is that our wiki 
and years of instructions have left users having set this manually:
defaults write org.macosforge.xquartz.X11 SUFeedURL 
http://xquartz.macosforge.org/downloads/sparkle/beta.xml

We could have some logic at startup to notice that and update it for them, but 
the easier path was to just relax ATS since we don't really benefit from it 
anyways.

smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PULL] XQuartz update for ATS allowance of our Sparkle feed and updated menu bar height logic

2015-10-14 Thread Jeremy Huddleston Sequoia
The following changes since commit 880d4e78b1823bcc0e66e68270af1a475f097bb5:

  xwayland: Set physical screen size to something (2015-10-07 10:39:17 -0400)

are available in the git repository at:

  git://people.freedesktop.org/~jeremyhu/xserver 

for you to fetch changes up to 4513f924a7065edbd267cf96837af94ce5a58a6f:

  XQuartz: Fix how we calculate the height of the OSX menu bar (2015-10-13 
14:19:05 -0700)


Jeremy Huddleston Sequoia (2):
  XQuartz: Relax App Transport Security for communicating with the update 
server
  XQuartz: Remove InfoPlist.strings

Ken Thomases (1):
  XQuartz: Fix how we calculate the height of the OSX menu bar

 hw/xquartz/X11Application.m  |  12 ++--
 hw/xquartz/bundle/Info.plist.cpp |  13 
+
 hw/xquartz/bundle/Makefile.am|  30 
--
 hw/xquartz/bundle/Resources/Dutch.lproj/InfoPlist.strings| Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/English.lproj/InfoPlist.strings  | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/French.lproj/InfoPlist.strings   | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/German.lproj/InfoPlist.strings   | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/Italian.lproj/InfoPlist.strings  | Bin 278 -> 0 
bytes
 hw/xquartz/bundle/Resources/Japanese.lproj/InfoPlist.strings | Bin 272 -> 0 
bytes
 hw/xquartz/bundle/Resources/Spanish.lproj/InfoPlist.strings  | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/ar.lproj/InfoPlist.strings   | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/ca.lproj/InfoPlist.strings   | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/cs.lproj/InfoPlist.strings   | Bin 272 -> 0 
bytes
 hw/xquartz/bundle/Resources/da.lproj/InfoPlist.strings   | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/el.lproj/InfoPlist.strings   | Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/fi.lproj/InfoPlist.strings   | Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/he.lproj/InfoPlist.strings   | Bin 298 -> 0 
bytes
 hw/xquartz/bundle/Resources/hr.lproj/InfoPlist.strings   | Bin 286 -> 0 
bytes
 hw/xquartz/bundle/Resources/hu.lproj/InfoPlist.strings   | Bin 278 -> 0 
bytes
 hw/xquartz/bundle/Resources/ko.lproj/InfoPlist.strings   | Bin 266 -> 0 
bytes
 hw/xquartz/bundle/Resources/no.lproj/InfoPlist.strings   | Bin 276 -> 0 
bytes
 hw/xquartz/bundle/Resources/pl.lproj/InfoPlist.strings   | Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/pt.lproj/InfoPlist.strings   | Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/pt_PT.lproj/InfoPlist.strings| Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/ro.lproj/InfoPlist.strings   | Bin 280 -> 0 
bytes
 hw/xquartz/bundle/Resources/ru.lproj/InfoPlist.strings   | Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/sk.lproj/InfoPlist.strings   | Bin 274 -> 0 
bytes
 hw/xquartz/bundle/Resources/sv.lproj/InfoPlist.strings   | Bin 260 -> 0 
bytes
 hw/xquartz/bundle/Resources/th.lproj/InfoPlist.strings   | Bin 270 -> 0 
bytes
 hw/xquartz/bundle/Resources/tr.lproj/InfoPlist.strings   | Bin 272 -> 0 
bytes
 hw/xquartz/bundle/Resources/uk.lproj/InfoPlist.strings   | Bin 264 -> 0 
bytes
 hw/xquartz/bundle/Resources/zh_CN.lproj/InfoPlist.strings| Bin 260 -> 0 
bytes
 hw/xquartz/bundle/Resources/zh_TW.lproj/InfoPlist.strings| Bin 264 -> 0 
bytes
 hw/xquartz/bundle/mk_bundke.sh   |   2 +-
 34 files changed, 24 insertions(+), 33 deletions(-)
 delete mode 100644 hw/xquartz/bundle/Resources/Dutch.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/English.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/French.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/German.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/Italian.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/Japanese.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/Spanish.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/ar.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/ca.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/cs.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/da.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/el.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/fi.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/he.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/hr.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Resources/hu.lproj/InfoPlist.strings
 delete mode 100644 hw/xquartz/bundle/Res

annarchy disk space

2015-10-14 Thread Jeremy Huddleston Sequoia
I noticed some errors in my git post commit hooks just now.  It looks like 
annarchy is out of space on /

$ git push -f...
remote: mail: /tmp/mail.Rs7Ah02H: No space left on device

jeremyhu@annarchy:~$ df -h /
Filesystem  Size  Used Avail Use% 
Mounted on
/dev/disk/by-uuid/9b248e34-3621-45b9-8fbf-163210d0439e  9.9G  9.4G 0 100% /




smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 05/10] xres: Silence -Wunused-function warnings when building !COMPOSITE or !RENDER

2015-10-14 Thread Jeremy Huddleston Sequoia
xres.c:422:1: warning: unused function 'ResFindCompositeClientWindowPixmaps' 
[-Wunused-function,Unused Entity Issue]
ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xext/xres.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Xext/xres.c b/Xext/xres.c
index 6b87c3d..83cc691 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -410,21 +410,21 @@ ResFindGCPixmaps(void *value, XID id, void *cdata)
 *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
 }
 
+#ifdef RENDER
 static void
 ResFindPicturePixmaps(void *value, XID id, void *cdata)
 {
-#ifdef RENDER
 ResFindResourcePixmaps(value, id, PictureType, cdata);
-#endif
 }
+#endif
 
+#ifdef COMPOSITE
 static void
 ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
 {
-#ifdef COMPOSITE
 ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
-#endif
 }
+#endif
 
 static int
 ProcXResQueryClientPixmapBytes(ClientPtr client)
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 09/10] xdmcp: Declare XdmcpFatal _X_NORETURN

2015-10-14 Thread Jeremy Huddleston Sequoia
xdmcp.c:1404:1: warning: function 'XdmcpFatal' could be declared with attribute 
'noreturn'
[-Wmissing-noreturn,Semantic Issue]

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 os/xdmcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 7939b41..5bdcbe9 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1399,6 +1399,7 @@ recv_alive_msg(unsigned length)
 }
 }
 
+_X_NORETURN
 static void
 XdmcpFatal(const char *type, ARRAY8Ptr status)
 {
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 07/10] dix: Silence -Wunused-variable warning by moving window.c off of legacy region defines

2015-10-14 Thread Jeremy Huddleston Sequoia
window.c:223:15: warning: unused variable 'pScreen' [-Wunused-variable,Unused 
Entity Issue]
ScreenPtr pScreen = pWin->drawable.pScreen;
  ^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 dix/window.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dix/window.c b/dix/window.c
index d57f320..69b5a7c 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -220,7 +220,6 @@ log_window_info(WindowPtr pWin, int depth)
 int i;
 const char *win_name, *visibility;
 BoxPtr rects;
-ScreenPtr pScreen = pWin->drawable.pScreen;
 
 for (i = 0; i < (depth << 2); i++)
 ErrorF(" ");
@@ -240,7 +239,7 @@ log_window_info(WindowPtr pWin, int depth)
 ErrorF(" (%s compositing: pixmap %x)",
(pWin->redirectDraw == RedirectDrawAutomatic) ?
"automatic" : "manual",
-   (unsigned) pScreen->GetWindowPixmap(pWin)->drawable.id);
+   (unsigned) 
pWin->drawable.pScreen->GetWindowPixmap(pWin)->drawable.id);
 #endif
 
 switch (pWin->visibility) {
@@ -259,10 +258,10 @@ log_window_info(WindowPtr pWin, int depth)
 }
 ErrorF(", %s", visibility);
 
-if (REGION_NOTEMPTY(pScreen, >clipList)) {
+if (RegionNotEmpty(>clipList)) {
 ErrorF(", clip list:");
-rects = REGION_RECTS(>clipList);
-for (i = 0; i < REGION_NUM_RECTS(>clipList); i++)
+rects = RegionRects(>clipList);
+for (i = 0; i < RegionNumRects(>clipList); i++)
 ErrorF(" [(%d, %d) to (%d, %d)]",
rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
 ErrorF("; extents [(%d, %d) to (%d, %d)]",
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 08/10] osinit: Silence -Wunused-variable warnings

2015-10-14 Thread Jeremy Huddleston Sequoia
osinit.c:161:24: warning: unused variable 'devnull' [-Wunused-variable,Unused 
Entity Issue]
static const char *devnull = "/dev/null";
   ^
osinit.c:162:10: warning: unused variable 'fname' [-Wunused-variable,Unused 
Entity Issue]
char fname[PATH_MAX];
 ^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 os/osinit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/os/osinit.c b/os/osinit.c
index ddd3fce..41a0aa7 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -158,8 +158,6 @@ void
 OsInit(void)
 {
 static Bool been_here = FALSE;
-static const char *devnull = "/dev/null";
-char fname[PATH_MAX];
 
 if (!been_here) {
 #if !defined(WIN32) || defined(__CYGWIN__)
@@ -219,6 +217,9 @@ OsInit(void)
 #endif
 
 #if !defined(XQUARTZ)/* STDIN is already /dev/null and STDOUT/STDERR is 
managed by console_redirect.c */
+static const char *devnull = "/dev/null";
+char fname[PATH_MAX];
+
 # if defined(__APPLE__)
 int devnullfd = open(devnull, O_RDWR, 0);
 assert(devnullfd > 2);
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 01/10] mi: Correct a miscall of abs() to instead call fabs()

2015-10-14 Thread Jeremy Huddleston Sequoia
miarc.c:1714:9: warning: using integer absolute value function
'abs' when
  argument is of floating point type [-Wabsolute-value,Semantic Issue]
if (abs(parc->angle2) >= 360.0)
^
miarc.c:1714:9: note: use function 'fabs' instead [Semantic Issue]
if (abs(parc->angle2) >= 360.0)
^~~
fabs

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 mi/miarc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mi/miarc.c b/mi/miarc.c
index 5e854b3..2588ee4 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1711,7 +1711,7 @@ miGetArcPts(SppArcPtr parc, /* points to an arc */
 y1 = y2;
 }
 /* adjust the last point */
-if (abs(parc->angle2) >= 360.0)
+if (fabs(parc->angle2) >= 360.0)
 poly[cpt + i - 1] = poly[0];
 else {
 poly[cpt + i - 1].x = (miDcos(st + et) * parc->width / 2.0 + xc);
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 06/10] security: Silence some benign -Wformat warnings

2015-10-14 Thread Jeremy Huddleston Sequoia
XID may be either 'unsigned long' or 'unsigned int' depending on:

typedef unsigned long CARD64;
typedef unsigned int CARD32;
typedef unsigned long long CARD64;
typedef unsigned long CARD32;

typedef unsigned long XID;
typedef CARD32 XID;

so when building with -Wformat, we get some warnings that are benign.  This 
silences them.

security.c:215:52: warning: format specifies type 'int' but the argument has 
type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
~~ ^
%lu
  CC   dpmsstubs.lo
security.c:553:25: warning: format specifies type 'int' but the argument has 
type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
 client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
^
security.c:553:55: warning: format specifies type 'int' but the argument has 
type 'CARD32' (aka 'unsigned long')
  [-Wformat,Format String Issue]
 client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
  ^~
security.c:554:10: warning: format specifies type 'int' but the argument has 
type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
 pAuth->group, eventMask);
 ^~~~
security.c:554:24: warning: format specifies type 'int' but the argument has 
type 'Mask' (aka 'unsigned long')
  [-Wformat,Format String Issue]
 pAuth->group, eventMask);
   ^
security.c:781:19: warning: format specifies type 'unsigned int' but the 
argument has type 'Mask' (aka 'unsigned
long')
  [-Wformat,Format String Issue]
  requested, rec->id, cid,
  ^
security.c:781:30: warning: format specifies type 'unsigned int' but the 
argument has type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
  requested, rec->id, cid,
 ^~~
security.c:863:23: warning: format specifies type 'unsigned int' but the 
argument has type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
  rec->pWin->drawable.id, wClient(rec->pWin)->index,
  ^~
security.c:893:31: warning: format specifies type 'unsigned int' but the 
argument has type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
  rec->pWin->drawable.id,
  ^~
security.c:915:39: warning: format specifies type 'unsigned int' but the 
argument has type 'XID' (aka 'unsigned long')
  [-Wformat,Format String Issue]
  rec->client->index, rec->pWin->drawable.id,
      ^~

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 Xext/security.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Xext/security.c b/Xext/security.c
index cce7c46..04382ff 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -212,7 +212,7 @@ SecurityDeleteAuthorization(void *value, XID id)
 CloseDownClient(clients[i]);
 }
 
-SecurityAudit("revoked authorization ID %d\n", pAuth->id);
+SecurityAudit("revoked authorization ID %lu\n", (unsigned long)pAuth->id);
 free(pAuth);
 return Success;
 
@@ -549,9 +549,9 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
 WriteToClient(client, authdata_len, pAuthdata);
 
 SecurityAudit
-("client %d generated authorization %d trust %d timeout %d group %d 
events %d\n",
- client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
- pAuth->group, eventMask);
+("client %d generated authorization %lu trust %d timeout %lu group %lu 
events %lu\n",
+ client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned 
long)pAuth->timeout,
+ (unsigned long)pAuth->group, (unsigned long)eventMask);
 
 /* the request succeeded; don't call RemoveAuthorization or free pAuth */
 return Success;
@@ -776,9 +776,9 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void 
*calldata)
 return;
 }
 
-SecurityAudit("Security: denied client %d access %x to resource 0x%x "
+SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
   "of client %d on request %s\n", rec->client->index,
-  requested, rec->id, cid,
+  (unsigned long)requested, (unsigned long)rec->id, cid,
   SecurityLookupRequestName(rec->client));
 re

[PATCH xquartz 03/10] xdmauth: Correct miscall of abs() to instrad call labs()

2015-10-14 Thread Jeremy Huddleston Sequoia
xdmauth.c:230:13: warning: absolute value function 'abs' given an argument of 
type 'long' but has parameter of
type
'int'
  which may cause truncation of value [-Wabsolute-value,Semantic Issue]
if (abs(now - client->time) > TwentyFiveMinutes) {
^
xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
if (abs(now - client->time) > TwentyFiveMinutes) {
^~~
labs
xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of 
type 'long' but has parameter of type
'int' which
  may cause truncation of value [-Wabsolute-value,Semantic Issue]
if (abs(client->time - now) > TwentyMinutes) {
^
xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
if (abs(client->time - now) > TwentyMinutes) {
^~~
    labs

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 os/xdmauth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/os/xdmauth.c b/os/xdmauth.c
index f11cbb9..482bc67 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
 prev = 0;
 for (client = xdmClients; client; client = next) {
 next = client->next;
-if (abs(now - client->time) > TwentyFiveMinutes) {
+if (labs(now - client->time) > TwentyFiveMinutes) {
 if (prev)
 prev->next = next;
 else
@@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int length,
 }
 now += clockOffset;
 XdmClientAuthTimeout(now);
-if (abs(client->time - now) > TwentyMinutes) {
+if (labs(client->time - now) > TwentyMinutes) {
 free(client);
 if (reason)
 *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 04/10] randr: Silence -Wshift-negative-value warnings

2015-10-14 Thread Jeremy Huddleston Sequoia
rrtransform.c:199:23: warning: shifting a negative signed value is undefined 
[-Wshift-negative-value,Semantic Issue]
rot_cos = F(-1);
  ^
rrtransform.c:114:14: note: expanded from macro 'F'
^~
../render/picture.h:200:24: note: expanded from macro 'IntToxFixed'
^~
/opt/X11/include/pixman-1/pixman.h:130:56: note: expanded from macro 
'pixman_int_to_fixed'
   ~~~ ^

Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com>
---
 randr/rrtransform.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 26b0649..d32b43a 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -196,7 +196,7 @@ RRTransformCompute(int x,
 f_rot_sin = 0;
 f_rot_dx = width;
 f_rot_dy = height;
-rot_cos = F(-1);
+rot_cos = F(~0u);
 rot_sin = F(0);
 rot_dx = F(width);
 rot_dy = F(height);
@@ -207,7 +207,7 @@ RRTransformCompute(int x,
 f_rot_dx = 0;
 f_rot_dy = width;
 rot_cos = F(0);
-rot_sin = F(-1);
+rot_sin = F(~0u);
 rot_dx = F(0);
 rot_dy = F(width);
 break;
@@ -230,7 +230,7 @@ RRTransformCompute(int x,
 scale_dy = 0;
 if (rotation & RR_Reflect_X) {
 f_scale_x = -1;
-scale_x = F(-1);
+scale_x = F(~0u);
 if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
 f_scale_dx = width;
 scale_dx = F(width);
@@ -242,7 +242,7 @@ RRTransformCompute(int x,
 }
 if (rotation & RR_Reflect_Y) {
 f_scale_y = -1;
-scale_y = F(-1);
+scale_y = F(~0u);
 if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
 f_scale_dy = height;
 scale_dy = F(height);
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

  1   2   3   4   5   6   7   8   9   10   >