evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
9.86k stars 486 forks source link

TestProcIOStats check fails on latest unstable #1075

Closed onny closed 5 months ago

onny commented 6 months ago

Trying to build the latest commit https://github.com/evilsocket/opensnitch/commit/ffb76683aa804e7052013dbab7132a31239a09dc fails with:

opensnitch-unstable> Running phase: checkPhase
opensnitch-unstable> ok         github.com/evilsocket/opensnitch/daemon/conman  0.010s
opensnitch-unstable> ok         github.com/evilsocket/opensnitch/daemon/firewall/config 0.007s
opensnitch-unstable> ok         github.com/evilsocket/opensnitch/daemon/firewall/nftables       0.008s
opensnitch-unstable> ok         github.com/evilsocket/opensnitch/daemon/firewall/nftables/exprs 0.009s
opensnitch-unstable> ?          github.com/evilsocket/opensnitch/daemon/firewall/nftables/nftest        [no test files]
opensnitch-unstable> ok         github.com/evilsocket/opensnitch/daemon/netlink 0.002s
opensnitch-unstable> --- FAIL: TestProcIOStats (0.00s)
opensnitch-unstable>     process_test.go:70: Proc.IOStats.WChar should not be 0: &{18941 0 34 0 0 0}
opensnitch-unstable>     process_test.go:76: Proc.IOStats.SyscallWrite should not be 0: &{18941 0 34 0 0 0}
opensnitch-unstable> FAIL
opensnitch-unstable> FAIL       github.com/evilsocket/opensnitch/daemon/procmon 0.009s
opensnitch-unstable> FAIL

Reference: https://github.com/NixOS/nixpkgs/pull/276468

gustavo-iniguez-goya commented 5 months ago

Hi @onny ,

Thank you for reporting this error. I think the test itself is not exactly correct. I guess that running it in restricted environments could fail.

Is this the case? where're the tests executed? lxc? docker? etc

onny commented 5 months ago

yes it is an isolated test environment on nixos without internet access etc. this is my current PR with updating and enhancing the opensnitch module https://github.com/NixOS/nixpkgs/pull/276468/files i could try to git bisect the sources to see which commit introduced the bug or maybe try an earlier go version (< 1.17)

gustavo-iniguez-goya commented 5 months ago

I've changed the test to fail only on parsing the stats or opening the procfs IO stats file /proc/self/io

It'll still fail on environments without procfs mounted. If needed we can add a environment variable to disable these tests on those systems.

onny commented 5 months ago

Thanks that fixed the issue for me :)