Opened 11 years ago

Last modified 7 years ago

#707 closed defect (Fixed)

Patch: Build failures on 0.2.0.28rc BSD

Reported by: grarpamp Owned by: nickm
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.0.25-rc
Severity: Keywords:
Cc: nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hi.

This patch fixes some build failures on:

FreeBSD RELENG_4, gcc version 2.95.4 20020320 [FreeBSD]
warning: preprocessing directive not recognized within macro arg

Please modify patch as needed and apply if appropriate.

Also, 'make install' rebuilds tor_main.Po, tor_main.o and tor. This
should not happen when called as: 'make ; make install' because
'make' already made them. 'make install' should just pick up and
install all the previously built bits from the build hierarchy.

Lastly, when registering on this bugtracker, the registration link
sent in the registration mail is not https. As with the rest of the
site, it should be as well.

Thanks [for Tor too].

========================================================
--- ./src/or/config.c.orig Wed Jun 11 07:09:55 2008
+++ ./src/or/config.c Sun Jun 15 18:54:54 2008
@@ -198,13 +198,12 @@

V(FetchServerDescriptors, BOOL, "1"),
V(FetchHidServDescriptors, BOOL, "1"),
V(FetchUselessDescriptors, BOOL, "0"),

  • V(GeoIPFile, STRING, #ifdef WIN32
  • "<default>"

+ V(GeoIPFile, STRING, "<default>"),

#else

  • SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"

+ V(GeoIPFile, STRING,
+ SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),

#endif

-),

V(Group, STRING, NULL),
V(HardwareAccel, BOOL, "0"),
V(HashedControlPassword, LINELIST, NULL),

--- ./src/or/routerlist.c.orig Fri Jun 13 00:18:28 2008
+++ ./src/or/routerlist.c Sun Jun 15 18:57:30 2008
@@ -4391,8 +4391,8 @@

r->cache_info.signed_descriptor_digest);

tor_assert(&(r->cache_info) == sd2);
tor_assert(r->cache_info.routerlist_index == r_sl_idx);

-#if 0

/* XXXX021.

+#if 0

*

  • Hoo boy. We need to fix this one, and the fix is a bit tricky, so
  • commenting this out is just a band-aid.

@@ -4409,13 +4409,13 @@

  • reset our retry count for an extrainfo, but that's not the end
  • of the world. Changing the representation in 0.2.0.x would just
  • destabilize the codebase.
  • */

if (!tor_digest_is_zero(r->cache_info.extra_info_digest)) {

signed_descriptor_t *sd3 =

sdmap_get(rl->desc_by_eid_map, r->cache_info.extra_info_digest);

tor_assert(sd3 == &(r->cache_info));

}

#endif

+ */

});
SMARTLIST_FOREACH(rl->old_routers, signed_descriptor_t *, sd,
{

@@ -4424,14 +4424,15 @@

sd2 = sdmap_get(rl->desc_digest_map, sd->signed_descriptor_digest);
tor_assert(sd == sd2);
tor_assert(sd->routerlist_index == sd_sl_idx);

+ /* XXXX021 see above.

#if 0

  • /* XXXX021 see above. */

if (!tor_digest_is_zero(sd->extra_info_digest)) {

signed_descriptor_t *sd3 =

sdmap_get(rl->desc_by_eid_map, sd->extra_info_digest);

tor_assert(sd3 == sd);

}

#endif

+*/

});


RIMAP_FOREACH(rl->identity_map, d, r) {

========================================================

[Automatically added by flyspray2trac: Operating System: BSD]

Child Tickets

Change History (9)

comment:1 Changed 11 years ago by nickm

I understand what the changes in config.c are for, but what's the purpose of the changes in routerlist.c?
This should be perfectly fine C:
#if 0

/* a comment */
if (some_code) function_call();

#endif

comment:2 Changed 11 years ago by nickm

I've applied the config.c fix.

comment:3 Changed 11 years ago by grarpamp

Here's the failure log for both files. I'm noob not guru.

routerlist.c: I'm guessing it doesn't like the #if being buried in
the expansion of lines 4386 and 4420. Since #if 0 acts to disable,
I did the alternative and commented it out instead.

config.c: Seems to be the same thing, #if in a macro.

Making all in or
source='config.c' object='config.o' libtool=no DEPDIR=.deps

depmode=gcc /usr/local/bin/bash ../../depcomp gcc -DHAVE_CONFIG_H
-I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\""
-DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\""
-I../common -I/usr/local/include -g -O2 -Wall -g -O2 -c config.c

config.c:207: warning: preprocessing directive not recognized within macro arg
config.c:207: warning: preprocessing directive not recognized within macro arg
config.c:207: warning: preprocessing directive not recognized within macro arg
config.c:207: warning: preprocessing directive not recognized within macro arg
config.c:207: warning: preprocessing directive not recognized within macro arg
config.c:207: warning: preprocessing directive not recognized within macro arg
In file included from or.h:56,

from config.c:17:

/usr/include/arpa/inet.h:89: warning: parameter has incomplete type
/usr/include/arpa/inet.h:92: warning: parameter has incomplete type
/usr/include/arpa/inet.h:96: warning: parameter has incomplete type
config.c:202: undefined or invalid # directive
config.c:204: undefined or invalid # directive
config.c:206: undefined or invalid # directive
* Error code 1
Stop in /tmp/tor-0.2.0.28-rc/src/or.

Making all in or
source='routerlist.c' object='routerlist.o' libtool=no DEPDIR=.deps

depmode=gcc /usr/local/bin/bash ../../depcomp gcc -DHAVE_CONFIG_H
-I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\""
-DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\""
-I../common -I/usr/local/include -g -O2 -Wall -g -O2 -c routerlist.c

routerlist.c:4419: warning: preprocessing directive not recognized within macro arg
routerlist.c:4419: warning: preprocessing directive not recognized within macro arg
routerlist.c:4435: warning: preprocessing directive not recognized within macro arg
routerlist.c:4435: warning: preprocessing directive not recognized within macro arg
In file included from or.h:56,

from routerlist.c:17:

/usr/include/arpa/inet.h:89: warning: parameter has incomplete type
/usr/include/arpa/inet.h:92: warning: parameter has incomplete type
/usr/include/arpa/inet.h:96: warning: parameter has incomplete type
routerlist.c: In function `smartlist_choose_by_bandwidth':
routerlist.c:1606: warning: use of l' length character with f' type character
routerlist.c:1606: warning: use of l' length character with f' type character
routerlist.c: In function `routerlist_assert_ok':
routerlist.c:4394: undefined or invalid # directive
routerlist.c:4401: undefined or invalid # directive
routerlist.c:4427: undefined or invalid # directive
routerlist.c:4434: undefined or invalid # directive
* Error code 1
Stop in /tmp/tor-0.2.0.28-rc/src/or.

comment:4 Changed 11 years ago by nickm

Ah! I hadn't seen that the stuff in routerlist.c was also inside macro arguments. It makes sense now why the
bug would happen. Thanks for the clarification; I've patched it now.

comment:5 Changed 11 years ago by grarpamp

For completeness, here's the log of the rest of gcc's warnings on
this platform. Unlike the two mentioned earlier, these do not
prevent things from building.

In file included from util.c:76:
/usr/include/malloc.h:2: warning: #warning "this file includes <malloc.h> which is deprecated, use <stdlib.h> instead"

dirserv.c: In function `dirserv_compute_performance_thresholds':
dirserv.c:1816: warning: use of l' length character with f' type character

rephist.c: In function `rep_hist_record_mtbf_data':
rephist.c:703: warning: use of l' length character with f' type character

routerlist.c: In function `smartlist_choose_by_bandwidth':
routerlist.c:1606: warning: use of l' length character with f' type character
routerlist.c:1606: warning: use of l' length character with f' type character

routerparse.c: In function `router_parse_list_from_string':
routerparse.c:943: warning: `signed_desc' might be used uninitialized in this function

And there are tons of these for various *.c files though this may
be a platform issue instead, not sure...

In file included from or.h:56,

from buffers.c:17:

/usr/include/arpa/inet.h:89: warning: parameter has incomplete type
/usr/include/arpa/inet.h:92: warning: parameter has incomplete type
/usr/include/arpa/inet.h:96: warning: parameter has incomplete type

/usr/include/arpa/inet.h

89 in_addr_t inet_lnaof P((struct in_addr));
92 in_addr_t inet_netof
P((struct in_addr));
96 char *inet_ntoa P((struct in_addr));

comment:6 Changed 11 years ago by grarpamp

In file included from util.c:76:
/usr/include/malloc.h:2: warning: #warning "this file includes malloc.h which is deprecated, use stdlib.h instead"

comment:7 Changed 11 years ago by arma

I'm going to close this, since the main bug is fixed. Thanks!

I believe the various bsd's malloc.h files are at odds with autoconf --
we ask autoconf if the file exists, and if so we include it. The BSDs make sure
the file does exist, but the only reason it is there is to yell at you if you
try to use it.

We use *both* malloc.h and stdlib.h. Seems to me that if BSD wants to fix its
bug, it should detect if we are following its advice and not yell in that case.

comment:8 Changed 11 years ago by arma

flyspray2trac: bug closed.

comment:9 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.