Opened 4 years ago

Closed 4 years ago

#18728 closed defect (fixed)

Build is broken with --enable-gcc-warnings on NetBSD.

Reported by: yawning Owned by:
Priority: Medium Milestone: Tor: 0.2.8.x-final
Component: Core Tor/Tor Version: Tor: unspecified
Severity: Normal Keywords: tor-core, portability
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Part of trying to track down #18286, neither tor nor the unit tests build with --enable-gcc-warnings set on NetBSD 7.0 (gcc 4.8.4) due to char subscript warnings.

This gets tor to build:

diff --git a/src/ext/readpassphrase.c b/src/ext/readpassphrase.c
index ab71935..dee474f 100644
--- a/src/ext/readpassphrase.c
+++ b/src/ext/readpassphrase.c
@@ -144,11 +144,11 @@ restart:
                        if (p < end) {
                                if ((flags & RPP_SEVENBIT))
                                        ch &= 0x7f;
-                               if (isalpha(ch)) {
+                               if (isalpha((int)ch)) {
                                        if ((flags & RPP_FORCELOWER))
-                                               ch = (char)tolower(ch);
+                                               ch = (char)tolower((int)ch);
                                        if ((flags & RPP_FORCEUPPER))
-                                               ch = (char)toupper(ch);
+                                               ch = (char)toupper((int)ch);
                                *p++ = ch;

The test suite fails with:

  CC       src/test/src_test_test-test_util.o
../src/test/test_util.c: In function 'test_util_format_time_interval':
../src/test/test_util.c:2347:3: error: array subscript has type 'char' [-Werror=char-subscripts]
   tt_ci_char_op(label_s[0],OP_EQ, 's');
../src/test/test_util.c:2354:3: error: array subscript has type 'char' [-Werror=char-subscripts]
   tt_ci_char_op(label_s[0],OP_EQ, 's');

[lots more use of the macro snipped]

I'm filing this against 0.2.8, since it's a build failure, change it if you disagree.

Child Tickets

Change History (5)

comment:1 Changed 4 years ago by nickm

+1 for putting this into 028

The right fix for test_util is to change the macro to use TOR_TOLOWER.

The right fix for readpassphrase.c is probably just to disable the RPP_{FORCEUPPER,FORCELOWER,SEVENBIT} stuff, since it is all crazypants and we don't use it.

comment:2 Changed 4 years ago by nickm

Status: newneeds_review

bug18728_028 in my public repo?

comment:3 Changed 4 years ago by yawning

Status: needs_reviewmerge_ready

ACK, tested on the VM of doom.

comment:4 Changed 4 years ago by nickm

merged to 028 and forward. thanks!

We have a problem though. I have no option to move this ticket out of merge_ready. halp?

comment:5 Changed 4 years ago by nickm

Resolution: fixed
Status: merge_readyclosed

merge_ready is no longer a cul-de-sac. :)

Note: See TracTickets for help on using tickets.