View Revisions: Issue #5688

Summary 0005688: unable to build merchant due to includes (or getaddrinfo(3)?)
Revision 2019-04-16 21:05 by ng0
Description Similar to the bug I reported earlier for exchange, merchant has includes in global style which
I am pretty sure should be local style. This was fixed as soon as I build with exchange. So works as intended but undocumented?

I'm still in the orientation phase wrt Taler source code layout and connection, so I will refrain from
fixing the reported bug.

Now the real bug I hit on NetBSD/amd64:

make all-recursive
Making all in .
Making all in src
Making all in include
Making all in backenddb
Making all in backend
  CC taler-merchant-httpd.o
In file included from /home/ng0/gnunet/include/gnunet/gnunet_util_lib.h:83:0,
                 from taler-merchant-httpd.c:26:
/home/ng0/gnunet/include/gnunet/gnunet_tun_lib.h:141:10: warning: 'packed' attribute ignored for field of type 'struct in_addr' [-Wattributes]
   struct in_addr source_address GNUNET_PACKED;
          ^~~~~~~
/home/ng0/gnunet/include/gnunet/gnunet_tun_lib.h:146:10: warning: 'packed' attribute ignored for field of type 'struct in_addr' [-Wattributes]
   struct in_addr destination_address GNUNET_PACKED;
          ^~~~~~~
/home/ng0/gnunet/include/gnunet/gnunet_tun_lib.h:736:12: warning: 'packed' attribute ignored for field of type 'struct in_addr' [-Wattributes]
     struct in_addr redirect_gateway_address GNUNET_PACKED;
            ^~~~~~~
taler-merchant-httpd.c: In function 'run':
taler-merchant-httpd.c:1465:39: error: 'AI_IDN' undeclared (first use in this function); did you mean 'AF_ISDN'?
         hints.ai_flags = AI_PASSIVE | AI_IDN;
                                       ^~~~~~
                                       AF_ISDN
taler-merchant-httpd.c:1465:39: note: each undeclared identifier is reported only once for each function it appears in
*** Error code 1

Stop.
make[3]: stopped in /home/ng0/src/taler/merchant/src/backend
*** Error code 1

Stop.
make[2]: stopped in /home/ng0/src/taler/merchant/src
*** Error code 1

Stop.
make[1]: stopped in /home/ng0/src/taler/merchant
*** Error code 1

Stop.
make: stopped in /home/ng0/src/taler/merchant




So the closest I can find is in <netdb.h>, but that's not enough.
I can't even find this in the compatibility header file which comes
with postgresql-server in postgresql/server/getaddrinfo.h

But still no positive match. Surprisingly include/php/main/php_config.h
has a match, but it's #undef for me.

So since I assume this is just integers (I'm writing this bug report from memory
of what I've done this morning), is this AI_IDN only defined on some Linux platforms?

It seems so, because `man 3 getaddrinfo` on my Debian system includes:

...
Extensions to getaddrinfo() for Internationalized Domain Names
       Starting with glibc 2.3.4, getaddrinfo() has been extended to selec‐
       tively allow the incoming and outgoing hostnames to be transparently
       converted to and from the Internationalized Domain Name (IDN) format
       (see RFC 3490, Internationalizing Domain Names in Applications
       (IDNA)). Four new flags are defined:

       AI_IDN If this flag is specified, then the node name given in node is
              converted to IDN format if necessary. The source encoding is
              that of the current locale.

              If the input name contains non-ASCII characters, then the IDN
              encoding is used. Those parts of the node name (delimited by
              dots) that contain non-ASCII characters are encoded using
              ASCII Compatible Encoding (ACE) before being passed to the
              name resolution functions.
...


I presume the best way to resolve this is by checking in taler-merchant-httpd.c
or wherever it came from if we have a glibc >= 2.3.4 and set the value of
hints.ai_flags accordingly.
Actually maybe even a check for the underlying OS because I also have glibc (available, but limitations might apply and it is not the native one).
Updating in a bit with more details.
Revision 2019-04-16 20:48 by ng0
Description Similar to the bug I reported earlier for exchange, merchant has includes in global style which
I am pretty sure should be local style. This was fixed as soon as I build with exchange. So works as intended but undocumented?

I'm still in the orientation phase wrt Taler source code layout and connection, so I will refrain from
fixing the reported bug.

Now the real bug I hit on NetBSD/amd64:

make all-recursive
Making all in .
Making all in src
Making all in include
Making all in backenddb
Making all in backend
  CC taler-merchant-httpd.o
In file included from /home/ng0/gnunet/include/gnunet/gnunet_util_lib.h:83:0,
                 from taler-merchant-httpd.c:26:
/home/ng0/gnunet/include/gnunet/gnunet_tun_lib.h:141:10: warning: 'packed' attribute ignored for field of type 'struct in_addr' [-Wattributes]
   struct in_addr source_address GNUNET_PACKED;
          ^~~~~~~
/home/ng0/gnunet/include/gnunet/gnunet_tun_lib.h:146:10: warning: 'packed' attribute ignored for field of type 'struct in_addr' [-Wattributes]
   struct in_addr destination_address GNUNET_PACKED;
          ^~~~~~~
/home/ng0/gnunet/include/gnunet/gnunet_tun_lib.h:736:12: warning: 'packed' attribute ignored for field of type 'struct in_addr' [-Wattributes]
     struct in_addr redirect_gateway_address GNUNET_PACKED;
            ^~~~~~~
taler-merchant-httpd.c: In function 'run':
taler-merchant-httpd.c:1465:39: error: 'AI_IDN' undeclared (first use in this function); did you mean 'AF_ISDN'?
         hints.ai_flags = AI_PASSIVE | AI_IDN;
                                       ^~~~~~
                                       AF_ISDN
taler-merchant-httpd.c:1465:39: note: each undeclared identifier is reported only once for each function it appears in
*** Error code 1

Stop.
make[3]: stopped in /home/ng0/src/taler/merchant/src/backend
*** Error code 1

Stop.
make[2]: stopped in /home/ng0/src/taler/merchant/src
*** Error code 1

Stop.
make[1]: stopped in /home/ng0/src/taler/merchant
*** Error code 1

Stop.
make: stopped in /home/ng0/src/taler/merchant




So the closest I can find is in <netdb.h>, but that's not enough.
I can't even find this in the compatibility header file which comes
with postgresql-server in postgresql/server/getaddrinfo.h

But still no positive match. Surprisingly include/php/main/php_config.h
has a match, but it's #undef for me.

So since I assume this is just integers (I'm writing this bug report from memory
of what I've done this morning), is this AI_IDN only defined on some Linux platforms?

It seems so, because `man 3 getaddrinfo` on my Debian system includes:

...
Extensions to getaddrinfo() for Internationalized Domain Names
       Starting with glibc 2.3.4, getaddrinfo() has been extended to selec‐
       tively allow the incoming and outgoing hostnames to be transparently
       converted to and from the Internationalized Domain Name (IDN) format
       (see RFC 3490, Internationalizing Domain Names in Applications
       (IDNA)). Four new flags are defined:

       AI_IDN If this flag is specified, then the node name given in node is
              converted to IDN format if necessary. The source encoding is
              that of the current locale.

              If the input name contains non-ASCII characters, then the IDN
              encoding is used. Those parts of the node name (delimited by
              dots) that contain non-ASCII characters are encoded using
              ASCII Compatible Encoding (ACE) before being passed to the
              name resolution functions.
...


I presume the best way to resolve this is by checking in taler-merchant-httpd.c
or wherever it came from if we have a glibc >= 2.3.4 and set the value of
hints.ai_flags accordingly.
Actually maybe even a check for the underlying OS because I also have glibc.
Updating in a bit with more details.