Thread: [HACKERS] Pg V10: Patch for bug in bonjour support

[HACKERS] Pg V10: Patch for bug in bonjour support

From
Luke Lonergan
Date:

Hi all – I’m doing some geo analysis and was excited to see all the new features in V10 – particularly the declarative partitioning support!

 

Found a tiny bug in the build for Bonjour – patch below:

 

*** configure.in  2017-10-02 14:09:15.000000000 -0700

--- /home/llonergan/archive/configure.in    2017-11-08 12:53:29.522584528 -0800

***************

*** 1293,1298 ****

--- 1293,1299 ----

  

  if test "$with_bonjour" = yes ; then

    AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])

+   AC_CHECK_LIB(dns_sd, DNSServiceRefSockFD, [], [AC_MSG_ERROR([library 'dns_sd' is required for Bonjour])])

  fi

  

  # for contrib/uuid-ossp

 

- Luke

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Thomas Munro
Date:
On Thu, Nov 9, 2017 at 10:05 AM, Luke Lonergan <luke@brightforge.com> wrote:
>   if test "$with_bonjour" = yes ; then
>
>     AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is
> required for Bonjour])])
>
> +   AC_CHECK_LIB(dns_sd, DNSServiceRefSockFD, [], [AC_MSG_ERROR([library
> 'dns_sd' is required for Bonjour])])
>
>   fi

Hi Luke,

It lives in libSystem.dylib (implicitly linked) on macOS, so that
would break the build there.  We'd need something a bit more
conditional, but I don't know what.

-- 
Thomas Munro
http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Thu, Nov 9, 2017 at 10:05 AM, Luke Lonergan <luke@brightforge.com> wrote:
>> +   AC_CHECK_LIB(dns_sd, DNSServiceRefSockFD, [], [AC_MSG_ERROR([library
>> 'dns_sd' is required for Bonjour])])

> It lives in libSystem.dylib (implicitly linked) on macOS, so that
> would break the build there.  We'd need something a bit more
> conditional, but I don't know what.

A quick look at the Autoconf manual finds:
    `AC_CHECK_LIB' requires some care in usage, and should be avoided    in some common cases.  Many standard functions
like`gethostbyname'    appear in the standard C library on some hosts, and in special    libraries like `nsl' on other
hosts. On some hosts the special    libraries contain variant implementations that you may not want to    use.  These
daysit is normally better to use    `AC_SEARCH_LIBS([gethostbyname], [nsl])' instead of    `AC_CHECK_LIB([nsl],
[gethostbyname])'.

If Luke wants to check that that works for him, I can check it on
macOS.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Luke Lonergan
Date:
Hi Tom – works for me on Linux (Ubuntu)…

- Luke
================================
*** /home/llonergan/archive/configure.in    2017-11-08 14:17:56.804891827 -0800
--- configure.in    2017-11-08 14:15:58.961186149 -0800
***************
*** 1293,1298 ****
--- 1293,1299 ----  if test "$with_bonjour" = yes ; then   AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file
<dns_sd.h>is required for Bonjour])]) 
+   AC_SEARCH_LIBS([DNSServiceRefSockFD],[dns_sd]) fi  # for contrib/uuid-ossp
================================




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Luke Lonergan <luke@brightforge.com> writes:
> Hi Tom – works for me on Linux (Ubuntu)…
> +   AC_SEARCH_LIBS([DNSServiceRefSockFD],[dns_sd])

Pushed with an error message added.  I also took the trouble to
standardize the syntax of our various AC_SEARCH_LIBS calls ---
they weren't very consistent about quoting.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Luke Lonergan <luke@brightforge.com> writes:
> Hi Tom – works for me on Linux (Ubuntu)…

BTW, when I try this on Fedora 25, it builds cleanly but the feature
doesn't seem to work --- I get this at postmaster start:

*** WARNING *** The program 'postgres' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=postgres>
2017-11-08 17:58:42.451 EST [23762] LOG:  DNSServiceRegister() failed: error code -65540

I wonder which libdns_sd you are using.
        regards, tom lane


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Luke Lonergan
Date:

# dpkg -S !$

dpkg -S /usr/lib/x86_64-linux-gnu/libdns_sd.so.1.0.0

libavahi-compat-libdnssd1:amd64: /usr/lib/x86_64-linux-gnu/libdns_sd.so.1.0.0

 

Also:
  ii  libavahi-compat-libdnssd1:amd64            0.6.32-1ubuntu1                                    amd64        Avahi Apple Bonjour compatibility library

 

- Luke

 

On 11/8/17, 3:00 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:


BTW, when I try this on Fedora 25, it builds cleanly but the feature

    doesn't seem to work --- I get this at postmaster start:

I wonder which libdns_sd you are using.

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Luke Lonergan <luke@brightforge.com> writes:
> On 11/8/17, 3:00 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>> BTW, when I try this on Fedora 25, it builds cleanly but the feature
>> doesn't seem to work --- I get this at postmaster start:
>> ...
>> I wonder which libdns_sd you are using.

> libavahi-compat-libdnssd1:amd64: /usr/lib/x86_64-linux-gnu/libdns_sd.so.1.0.0

Hm, the library on F25 is also avahi's.  Digging in the archives, I find
this old thread reporting the same behavior:

https://www.postgresql.org/message-id/flat/17824.1252293423%40sss.pgh.pa.us

So now I'm wondering if you know something the rest of us don't about
how to configure the platform for bonjour to work.

I'm also a bit disturbed about the report that libdns_sd was causing
the postmaster to become multithreaded.  If still true, that's quite
bad, and might be a reason to decide we don't want this change after
all.
        regards, tom lane


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Luke Lonergan
Date:
Hey Tom,

On 11/8/17, 4:39 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
   So now I'm wondering if you know something the rest of us don't about   how to configure the platform for bonjour to
work.

Nope – in fact, I hadn’t tried to use Bonjour on this instance, but had only enabled it thinking I’d want it within my
networkto be discoverable via Bonjour… 

Given these issues I’d recommend disabling the functionality for non-Mac until someone can get a workable solution in
place– then at least it will avoid people like me trying to enable a broken feature and failing… 

- Luke




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Thomas Munro
Date:
On Thu, Nov 9, 2017 at 1:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Luke Lonergan <luke@brightforge.com> writes:
>> On 11/8/17, 3:00 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>>> BTW, when I try this on Fedora 25, it builds cleanly but the feature
>>> doesn't seem to work --- I get this at postmaster start:
>>> ...
>>> I wonder which libdns_sd you are using.
>
>> libavahi-compat-libdnssd1:amd64: /usr/lib/x86_64-linux-gnu/libdns_sd.so.1.0.0
>
> Hm, the library on F25 is also avahi's.  Digging in the archives, I find
> this old thread reporting the same behavior:
>
> https://www.postgresql.org/message-id/flat/17824.1252293423%40sss.pgh.pa.us
>
> So now I'm wondering if you know something the rest of us don't about
> how to configure the platform for bonjour to work.

FWIW it builds and starts up fine on FreeBSD with
mDNSResponder-878.1.1 installed (Apache-licensed Apple Bonjour code)
and the mdnsd daemon started.  If I don't start mdnsd it shows an
error at startup.  When built against the (conflicting)
avahi-libdns-0.6.31_2 package it shows the WARNING you reported and
"DNSServiceRegister() failed: error code -65537", which might just
mean it wants to talk to some daemon I'm not running.

-- 
Thomas Munro
http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Thu, Nov 9, 2017 at 1:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hm, the library on F25 is also avahi's.  Digging in the archives, I find
>> this old thread reporting the same behavior:
>> https://www.postgresql.org/message-id/flat/17824.1252293423%40sss.pgh.pa.us

> FWIW it builds and starts up fine on FreeBSD with
> mDNSResponder-878.1.1 installed (Apache-licensed Apple Bonjour code)
> and the mdnsd daemon started.  If I don't start mdnsd it shows an
> error at startup.  When built against the (conflicting)
> avahi-libdns-0.6.31_2 package it shows the WARNING you reported and
> "DNSServiceRegister() failed: error code -65537", which might just
> mean it wants to talk to some daemon I'm not running.

Interesting.  Fedora doesn't seem to package mDNSResponder as such ---
"dnf search mDNSResponder" just returns more pointers to avahi:

avahi-compat-libdns_sd.x86_64 : Libraries for Apple Bonjour mDNSResponder                             : compatibility
avahi-compat-libdns_sd.i686 : Libraries for Apple Bonjour mDNSResponder                           : compatibility
avahi-compat-libdns_sd-devel.x86_64 : Header files for the Apple Bonjour                                   :
mDNSRespondercompatibility libraries
 
avahi-compat-libdns_sd-devel.i686 : Header files for the Apple Bonjour                                 : mDNSResponder
compatibilitylibraries
 

Is the AC_SEARCH_LIBS configure call needed to make PG build with the
FreeBSD package?
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Thomas Munro
Date:
On Thu, Nov 9, 2017 at 5:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Is the AC_SEARCH_LIBS configure call needed to make PG build with the
> FreeBSD package?

Yes.  My take is that the commit was correct: the library is needed
for --with-bonjour to work on non-macOS systems, and apparently it can
work (though I didn't personally try to assess that beyond seeing that
it could start up and connect to mdnsd).  Perhaps Avahi doesn't
qualify as a suitable Bonjour implementation any more though, and
someone out there might like to consider writing a --with-avahi option
that uses the native API it's shouting about.

-- 
Thomas Munro
http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Thu, Nov 9, 2017 at 5:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Is the AC_SEARCH_LIBS configure call needed to make PG build with the
>> FreeBSD package?

> Yes.  My take is that the commit was correct: the library is needed
> for --with-bonjour to work on non-macOS systems, and apparently it can
> work (though I didn't personally try to assess that beyond seeing that
> it could start up and connect to mdnsd).  Perhaps Avahi doesn't
> qualify as a suitable Bonjour implementation any more though, and
> someone out there might like to consider writing a --with-avahi option
> that uses the native API it's shouting about.

I'm not sure what to do at this point.  I concur that the AC_SEARCH_LIBS
call is helpful if you're using mDNSResponder on FreeBSD (or wherever
else that may be available) ... but I'm worried that it will enable
people to create broken builds on Linux without trying very hard.
We might be wise to deem that putting that call in is just creating
an attractive nuisance.

This would certainly be easier if we had a certifiably-working interface
to the avahi library.  But we don't, and I don't plan to write one,
and I doubt anyone else will come out of the woodwork to do it either.

Is there really much interest in Bonjour support on non-macOS platforms?
I hadn't heard that anybody but Apple was invested in it.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Thomas Munro
Date:
On Thu, Nov 9, 2017 at 6:27 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thomas Munro <thomas.munro@enterprisedb.com> writes:
>> On Thu, Nov 9, 2017 at 5:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Is the AC_SEARCH_LIBS configure call needed to make PG build with the
>>> FreeBSD package?
>
>> Yes.  My take is that the commit was correct: the library is needed
>> for --with-bonjour to work on non-macOS systems, and apparently it can
>> work (though I didn't personally try to assess that beyond seeing that
>> it could start up and connect to mdnsd).  Perhaps Avahi doesn't
>> qualify as a suitable Bonjour implementation any more though, and
>> someone out there might like to consider writing a --with-avahi option
>> that uses the native API it's shouting about.
>
> I'm not sure what to do at this point.  I concur that the AC_SEARCH_LIBS
> call is helpful if you're using mDNSResponder on FreeBSD (or wherever
> else that may be available) ... but I'm worried that it will enable
> people to create broken builds on Linux without trying very hard.
> We might be wise to deem that putting that call in is just creating
> an attractive nuisance.
>
> This would certainly be easier if we had a certifiably-working interface
> to the avahi library.  But we don't, and I don't plan to write one,
> and I doubt anyone else will come out of the woodwork to do it either.
>
> Is there really much interest in Bonjour support on non-macOS platforms?
> I hadn't heard that anybody but Apple was invested in it.

Not from me.  My only interest here was to pipe up because I knew that
what was originally proposed would have broken stuff on macOS, and
after that piqued curiosity.  I won't mind at all if you revert the
commit to prevent confusion.  If the intersection of FreeBSD,
PostgreSQL and Bonjour users is a non-empty set, [s]he might at least
find this archived discussion useful...

-- 
Thomas Munro
http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Pg V10: Patch for bug in bonjour support

From
Tom Lane
Date:
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Thu, Nov 9, 2017 at 6:27 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Is there really much interest in Bonjour support on non-macOS platforms?
>> I hadn't heard that anybody but Apple was invested in it.

> Not from me.  My only interest here was to pipe up because I knew that
> what was originally proposed would have broken stuff on macOS, and
> after that piqued curiosity.  I won't mind at all if you revert the
> commit to prevent confusion.  If the intersection of FreeBSD,
> PostgreSQL and Bonjour users is a non-empty set, [s]he might at least
> find this archived discussion useful...

Not hearing anyone else speaking up for this, I'll go revert the
configure change, and instead put in a comment pointing out that
Avahi support would require a lot more than an extra -l switch.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers