Bug 188826

Summary: sysutils/pftop broken on -CURRENT
Product: Ports & Packages Reporter: Daniel Engberg <diizzy>
Component: Individual Port(s)Assignee: Marcelo Araujo <araujo>
Status: Closed FIXED    
Severity: Affects Only Me CC: lists, robak
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for bpf_dump.c
none
Patch for sf-gencode.h none

Description Daniel Engberg freebsd_committer freebsd_triage 2014-04-20 13:10:00 UTC
pftop fails on -CURRENT and have done so for quite a while now...

===>  Building for pftop-0.7_2
--- objwarn ---
--- pftop.o ---
--- objwarn ---
Warning: Object directory not changed from original /usr/ports/sysutils/pftop/work/pftop-0.7
--- pftop.o ---
cc -O2 -pipe -march=core2  -DHAVE_ALTQ=1 -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1 -DHAVE_FINE_GRAINED_LOCKING=1 -fno-strict-aliasing   -Wall -DOS_LEVEL=45 -std=gnu89 -Qunused-arguments  -fstack-protector  -c pftop.c
--- sf-gencode.o ---
cc -O2 -pipe -march=core2  -DHAVE_ALTQ=1 -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1 -DHAVE_FINE_GRAINED_LOCKING=1 -fno-strict-aliasing   -Wall -DOS_LEVEL=45 -std=gnu89 -Qunused-arguments  -fstack-protector  -c sf-gencode.c
In file included from sf-gencode.c:49:
./sf-gencode.h:173:20: warning: unknown attribute 'volatile' ignored [-Wattributes]
    __attribute__((volatile, __format__ (printf, 1, 2)));
                   ^
./sf-gencode.h:191:6: error: conflicting types for 'bpf_dump'
void bpf_dump(struct bpf_program *, int);
     ^
/usr/include/pcap/pcap.h:416:6: note: previous declaration is here
void    bpf_dump(const struct bpf_program *, int);
        ^
--- pftop.o ---
In file included from pftop.c:68:
./sf-gencode.h:173:20: warning: unknown attribute 'volatile' ignored [-Wattributes]
    __attribute__((volatile, __format__ (printf, 1, 2)));
                   ^
--- sf-gencode.o ---
sf-gencode.c:1861:37: warning: passing 'char *' to parameter of type 'const u_char *' (aka 'const unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
--- pftop.o ---
./sf-gencode.h:191:6: error: conflicting types for 'bpf_dump'
void bpf_dump(struct bpf_program *, int);
     ^
/usr/include/pcap/pcap.h:416:6: note: previous declaration is here
void    bpf_dump(const struct bpf_program *, int);
        ^
--- sf-gencode.o ---
        b0 = gen_bcmp(off, strlen(ifname), ifname);
                                           ^~~~~~
sf-gencode.c:395:50: note: passing argument to parameter 'v' here
gen_bcmp(u_int offset, u_int size, const u_char *v)
                                                 ^
2 warnings and 1 error generated.
*** [sf-gencode.o] Error code 1

make[1]: stopped in /usr/ports/sysutils/pftop/work/pftop-0.7
--- pftop.o ---
pftop.c:856:41: warning: passing 'char *' to parameter of type 'const u_char *' (aka 'const unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
                        if (bpf_filter(filter_prog.bf_insns, (char *)(&state_buf[n]),
                                                             ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pcap/pcap.h:412:57: note: passing argument to parameter here
u_int   bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
                                                          ^
pftop.c:1652:28: warning: incompatible pointer to integer conversion passing 'counter_u64_t' (aka 'unsigned long *') to parameter of type 'u_int64_t' (aka 'unsigned long'); dereference with * [-Wint-conversion]
        print_fld_size(FLD_STATS, pr->states_tot);
                                  ^~~~~~~~~~~~~~
                                  *
./engine.h:112:47: note: passing argument to parameter 'size' here
void print_fld_size(field_def *fld, u_int64_t size);
                                              ^
3 warnings and 1 error generated.
*** [pftop.o] Error code 1

make[1]: stopped in /usr/ports/sysutils/pftop/work/pftop-0.7
2 errors

make[1]: stopped in /usr/ports/sysutils/pftop/work/pftop-0.7
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/sysutils/pftop

How-To-Repeat: Build pftop in ports
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-20 17:30:45 UTC
Responsible Changed
From-To: freebsd-ports-bugs->araujo

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-06-30 17:28:22 UTC
A commit references this bug:

Author: araujo
Date: Mon Jun 30 17:27:37 UTC 2014
New revision: 359889
URL: http://svnweb.freebsd.org/changeset/ports/359889

Log:
  - Mark as BROKEN on HEAD.

  PR:		188826
  Submitted by:	daniel.engberg.lists

Changes:
  head/sysutils/pftop/Makefile
Comment 3 Oliver Peter 2014-10-17 11:01:15 UTC
Created attachment 148387 [details]
Patch for bpf_dump.c

Place into /usr/ports/sysutils/pftop/files
Comment 4 Oliver Peter 2014-10-17 11:02:04 UTC
Created attachment 148388 [details]
Patch for sf-gencode.h

Place into /usr/ports/sysutils/pftop/files
Comment 5 Oliver Peter 2014-10-17 11:02:49 UTC
Should be easy to fix.

Works for me, tested on:

FreeBSD ovid.home.gfuzz.de 11.0-CURRENT FreeBSD 11.0-CURRENT #1 1687a66(master): Thu Oct 16 08:06:08 UTC 2014     root@ovid.home.gfuzz.de:/usr/obj/usr/src/sys/OVID  i386
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2014-10-17 20:50:01 UTC
Confirmed, this works for me too.
Thanks for the patches!
Comment 7 commit-hook freebsd_committer freebsd_triage 2014-10-21 07:04:30 UTC
A commit references this bug:

Author: araujo
Date: Tue Oct 21 07:03:36 UTC 2014
New revision: 371311
URL: https://svnweb.freebsd.org/changeset/ports/371311

Log:
  - Mark as UNBROKEN on FreeBSD >= 1100000.

  PR:		188826
  Submitted by:	Oliver Peter
  Tested by:	daniel.engberg.lists

Changes:
  head/sysutils/pftop/Makefile
  head/sysutils/pftop/files/patch-bpf_dump.c
  head/sysutils/pftop/files/patch-sf-gencode.h
Comment 8 Bartek Rutkowski freebsd_committer freebsd_triage 2015-03-29 11:04:06 UTC
The fix has been already committed, so I am closing this PR.