[Bug 219352] emulators/tpm-emulator: fail to run in arm64 due to improper getopt(3) use

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed May 17 13:02:58 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219352

            Bug ID: 219352
           Summary: emulators/tpm-emulator: fail to run in arm64 due to
                    improper getopt(3) use
           Product: Ports & Packages
           Version: Latest
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: hrs at FreeBSD.org
          Reporter: prj at rootwyrm.com
          Assignee: hrs at FreeBSD.org
             Flags: maintainer-feedback?(hrs at FreeBSD.org)

Confirmed on multiple systems and also by kevans91 on IRC, who confirmed the
issue is getopt(3) returning 1. This results in tpmd refusing to start under
any conditions and only returning the usage error. Failure has 100%
reproduction under -CURRENT.

Root cause is use of signed char for getopt(3) return instead of int which is
more correct for all platforms, so patch will need submitted upstream. Testing
under 11.0-RELEASE showed no behavior change as expected.

Code demonstrating the issue from kevans91 is available here:
https://gist.github.com/anonymous/2cf21321e011cdf1555a8b174cc23bc4

On arm64:
 root at skyhorn ~ # uname -a
FreeBSD skyhorn.SANITIZED 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r313109M: Thu
Feb  2 16:16:39 MST 2017    
raspberry at hive.raspbsd.org:/usr/home/brd/rpi3/crochet/work/obj/arm64.aarch64/usr/src/sys/GENERIC
 arm64

 root at skyhorn ~ # cc test.c -o char_c
test.c:8:54: warning: comparison of constant -1 with expression of type 'char'
      is always true [-Wtautological-constant-out-of-range-compare]
    while ((c = getopt(argc, argv, "dfs:u:o:g:c:h")) != -1) {
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~
1 warning generated.
 root at skyhorn ~ # ./char_c
1
Handling option 255

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list