View Issue Details

IDProjectCategoryView StatusLast Update
0005688Talermechant backendpublic2021-09-02 18:22
Reporternikita Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Versiongit (master) 
Target Version0.6Fixed in Version0.6 
Summary0005688: unable to build merchant due to includes (or getaddrinfo(3)?)
DescriptionSimilar 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;
taler-merchant-httpd.c:1465:39: note: each undeclared identifier is reported only once for each function it appears in
*** Error code 1

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

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

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

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.
TagsNo tags attached.



2019-04-16 21:19

developer   ~0014295

Last edited: 2019-04-16 21:20

diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 31a1c9d..e54bd3c 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1462,7 +1462,11 @@ run (void *cls,
         hints.ai_family = AF_UNSPEC;
         hints.ai_socktype = SOCK_STREAM;
         hints.ai_protocol = IPPROTO_TCP;
+#ifdef AI_IDN
         hints.ai_flags = AI_PASSIVE | AI_IDN;
+ hints.ai_flags = AI_PASSIVE;
         if (0 !=
             (ec = getaddrinfo (bind_to,

good enough or did I miss anything obvious?
It compiles to the point where I hit errors with texinfo which I'll be fixing now,
ie it gets past the original error but I'm not sure if it's enough.


2019-04-16 21:47

developer   ~0014296

medfly in #NetBSD suggests that

#ifndef AI_IDN #define AI_IDN 0 #endif

would be enough, but I'd like to have a final call by someone with more knowledge of parts of merchant
(I started reading it just this morning)

Related Changesets

merchant: master 83a4ffce

2019-04-18 19:35

Christian Grothoff

Details Diff
only use AI_IDN if supported by platform (fixes 0005688) Affected Issues
mod - src/backend/taler-merchant-httpd.c Diff File

Issue History

Date Modified Username Field Change
2019-04-16 20:48 nikita New Issue
2019-04-16 20:48 nikita Status new => assigned
2019-04-16 20:48 nikita Assigned To => Marcello Stanisci
2019-04-16 21:05 nikita Description Updated
2019-04-16 21:19 nikita Note Added: 0014295
2019-04-16 21:20 nikita Note Edited: 0014295
2019-04-16 21:47 nikita Note Added: 0014296
2019-04-18 17:36 Christian Grothoff Assigned To Marcello Stanisci => Christian Grothoff
2019-04-18 17:36 Christian Grothoff Status assigned => resolved
2019-04-18 17:36 Christian Grothoff Resolution open => fixed
2019-04-18 17:36 Christian Grothoff Fixed in Version => 0.6
2019-04-18 17:36 Christian Grothoff Target Version => 0.6
2019-12-20 19:12 Christian Grothoff Status resolved => closed
2021-09-02 18:22 Christian Grothoff Changeset attached => Taler-merchant master 83a4ffce