Commit graph

615 commits

Author SHA1 Message Date
Kelvin M. Klann
7e91a0414c tests: disable broken wget tests in utils/sysutils
They are taking longer than the 30s timeout[1] [2]:

    runner@fv-az246-621:~/work/firejail/firejail/test/sysutils$
    <ysutils$ firejail --ignore=quiet wget -q debian.org
    Reading profile /etc/firejail/wget.profile
    [...]
    Child process initialized in 115.54 ms
    TESTING ERROR 2

    runner@fv-az1234-541:~/work/firejail/firejail/test/utils$
    <irejail --build wget --output-document=~ debian.org
    [...]
    Resolving www.debian.org (www.debian.org)... 128.31.0.62
    Connecting to www.debian.org (www.debian.org)|128.31.0.62|:443... connected.
    TESTING ERROR 13

[1] https://github.com/kmk3/firejail/actions/runs/6005119423/job/16287436840
[2] https://github.com/kmk3/firejail/actions/runs/6005314148/job/16287794321
2023-08-28 19:03:09 -03:00
Kelvin M. Klann
d5c90b7416 tests: disable wget test in utils/trace.exp
It is apparently getting in the way of the rm test[1]:

    runner@fv-az1417-728:~/work/firejail/firejail/test/utils$
    <ail/test/utils$ firejail --trace wget -q debian.org
    5:wget:exec /usr/local/bin/wget:0
    5:wget:stat64 /etc/wgetrc:0
    5:wget:fopen64 /etc/wgetrc:0x561585600510
    5:wget:stat64 /home/runner/.wgetrc:-1
    OK
    [...]
    firejail --trace rm index.html
    5:wget:connect 4 128.31.0.62 port 443:0
    [...]
    5:wget:stat64 /home/runner/.wget-hsts:0
    runner@fv-az1417-728:~/work/firejail/firejail/test/utils$ TESTING ERROR 9

[1] https://github.com/kmk3/firejail/actions/runs/6004405511/job/16284920616
2023-08-28 19:03:09 -03:00
Kelvin M. Klann
2dc28f636e tests: fix wget test in utils/trace.exp
This should fix the following error[1]:

    runner@fv-az1230-523:~/work/firejail/firejail/test/utils$
    <ail/test/utils$ firejail --trace wget -q debian.org
    [...]
    5:wget:stat64 index.html:-1
    5:wget:stat64 index.html:-1
    5:wget:stat64 /home/runner/.netrc:-1
    5:wget:socket AF_INET SOCK_STREAM IPPROTO_IP:4
    5:wget:connect 4 151.101.66.132 port 80:0
    5:wget:stat64 index.html:-1
    5:wget:stat64 index.html:-1
    5:wget:stat64 index.html:-1
    [...]
    TESTING ERROR 8.6

[1] https://github.com/kmk3/firejail/actions/runs/6004266783/job/16284476671
2023-08-28 19:03:09 -03:00
Kelvin M. Klann
486ef54287 tests: increase the timeouts in wget.exp and build.exp
To try to fix the following errors[1] [2]:

    runner@fv-az298-480:~/work/firejail/firejail/test/utils$
    <irejail --build wget --output-document=~ debian.org
    [...]
    Resolving www.debian.org (www.debian.org)... 128.31.0.62
    Connecting to www.debian.org (www.debian.org)|128.31.0.62|:443... connected.
    TESTING ERROR 13

    runner@fv-az305-745:~/work/firejail/firejail/test/sysutils$
    <ysutils$ firejail --ignore=quiet wget -q debian.org
    [...]
    Child process initialized in 106.89 ms
    TESTING ERROR 2

[1] https://github.com/netblue30/firejail/actions/runs/5996420917/job/16278071977?pr=5979
[2] https://github.com/netblue30/firejail/actions/runs/5996420917/job/16278071219?pr=5979
2023-08-28 19:02:41 -03:00
Kelvin M. Klann
72c6df3af5 tests: properly fix fs/kmsg test
It was broken likely due to `private-dev` being added to default.profile
on commit 307dad542 ("adding private-tmp and private-dev to
default.profile", 2023-08-20).

So ignore `private-dev` in the test and make sure to run the tests when
default.profile changes.

This amends commit 75cefd5b1 ("tests: fix error when /dev/kmsg is
missing", 2023-08-21).
2023-08-23 12:02:24 -03:00
Kelvin M. Klann
ec504406b9 test: disable broken sysutils strings test
And limit the output of `diff` in the test to avoid logging thousands of
lines of a hexdump.

Likely broken by commit 3077b2d1f ("update disable-devel.inc",
2023-08-22)[1].

[1] https://github.com/netblue30/firejail/actions/runs/5945120115/job/16123622451
2023-08-23 08:08:51 -03:00
Kelvin M. Klann
75cefd5b16 tests: fix error when /dev/kmsg is missing
This is breaking test-fs in CI since at least commit f37cd57cd ("disable
all /bin/dpkg* programs in disable-common.inc", 2023-08-20)[1].

[1] https://github.com/netblue30/firejail/actions/runs/5918495917/job/16062400120
2023-08-21 10:07:10 -03:00
Kelvin M. Klann
6767f30660 build: fix TARNAME/VERSION variables in compile.sh
This fixes the following errors:

    $ make clean
    [...]
    cd test/compile; ./compile.sh --clean; cd ../..
    ./compile.sh: line 55: TARNAME: command not found
    ./compile.sh: line 55: VERSION: command not found

This amends commit 200f389ed ("build: use config.sh in more scripts",
2023-07-28) / PR #5927.
2023-08-12 05:17:40 -03:00
Kelvin M. Klann
200f389ed0 build: use config.sh in more scripts
This removes the need to manually pass variables such as `$(TARNAME)`
and `$(VERSION)` to shell scripts in the root Makefile.

Relates to #5140.
2023-07-28 14:10:31 -03:00
Kelvin M. Klann
59ed39ec46 build: fix shellcheck issues in mkrpm.sh/compile.sh 2023-07-28 14:08:01 -03:00
Kelvin M. Klann
5f27852906 build: remove unnecessary distclean targets
This also fixes the duplicate execution of the "clean" targets.
2023-07-20 05:03:47 -03:00
glitsj16
9863f982ca
modif: drop deprecated 'shell' option references (#5894)
The `shell` option has been removed. Remove stale references.

This does NOT remove `shell none`-related code comments in:

- src/firejail/fs_lib.c (L433-L441)
- src/firejail/join.c (L415-L417)

Relates to #5196.

Suggested by #5891.
2023-07-19 12:54:53 +00:00
Kelvin M. Klann
b963fe41ae Improve errExit error messages
Changes:

* Move msg to the end of errExit (right before perror(3p))
* Include the full file path (within the repository)
* Add "()" to function name for clarity

Before:

    Error malloc: main.c:123 main: Cannot allocate memory

After:

    Error src/firejail/main.c:123 main(): malloc: Cannot allocate memory

Note: This clarifies which is the exact file that the error message
comes from, as there are many source files with the same name.  For
example:

    $ git ls-files 'src/*/main.c' | wc -l
    20
2023-06-28 04:00:13 -03:00
Kelvin M. Klann
c0c284e33c build: move MAKEFLAGS to config.mk.in
To reduce the amount of boilerplate in the makefiles.

This amends commit 9789c263a ("build: disable all built-in implicit make
rules", 2023-06-21) / PR #5864.
2023-06-24 11:54:15 -03:00
Kelvin M. Klann
9789c263a2 build: disable all built-in implicit make rules
Use `make -r` to reduce unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~93.3% (~97.5% compared to a8f01a383) for the default build and by
~83.3% (~99.3% compared to a8f01a383) for the "man" target (as an
example):

    $ git show --pretty='%h %ai %s' -s
    a8f01a383 2023-06-20 05:26:23 +0000 Merge pull request #5859 from kmk3/build-remove-retpoline
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6798
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085
    # (in the previous commit)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    2535
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    42
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    170
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    7

Environment: GNU make 4.4.1-2 on Artix Linux.

Note: According to make(1p) in POSIX.1-2017, "If .SUFFIXES does not have
any prerequisites, the list of known suffixes shall be cleared.", while
"The result of setting MAKEFLAGS in the Makefile is unspecified."

Commands used to search and replace:

    $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(sed -E \
        's/^(.SUFFIXES:)/\1\nMAKEFLAGS += -r\n/' '{}')\" >'{}'"
2023-06-21 14:21:09 -03:00
Kelvin M. Klann
d4be8e512d build: disable most built-in implicit make rules
Clear `.SUFFIXES:` to reduce unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~62% for the default build and by ~96% for the "man" target (as an
example):

    $ git checkout master >/dev/null 2>&1
    $ git show --pretty='%h %ai %s' -s
    a8f01a383 2023-06-20 05:26:23 +0000 Merge pull request #5859 from kmk3/build-remove-retpoline
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6798
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    2535
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    42

Environment: GNU make 4.4.1-2 on Artix Linux.

Commands used to search and replace:

    $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(sed '1s/^/.SUFFIXES:\n/' '{}')\" >'{}'"

See also commit f48886f25 ("build: mark most phony targets as such",
2023-02-01) / PR #5637.
2023-06-21 12:22:34 -03:00
Kelvin M. Klann
6ece8cec3d build: standardize commands on top of makefiles
To make the makefiles look more similar.
2023-06-21 12:22:10 -03:00
Kelvin M. Klann
6d0ffc75d8 tests: disable ping test in test/chroot/fs_chroot.exp
Sometimes ping just works normally.

Log from build_and_test[1]:

    TESTING: chroot (test/chroot/fs_chroot.exp)
    spawn /bin/bash
    firejail  --chroot=/tmp/chroot
    runner@fv-az615-403:~/work/firejail/firejail/test/chroot$
    [...]
    bash-5.1$ /bin/ping 1.1.1.1
    PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
    TESTING ERROR 9

[1] https://github.com/kmk3/firejail/actions/runs/4875037540/jobs/8696877757
2023-05-03 15:20:07 -03:00
netblue30
18765f2358 testing 2023-03-09 09:21:35 -05:00
netblue30
c79aa14295 testing 2023-03-09 08:39:25 -05:00
netblue30
8835b130e2 testing 2023-03-08 17:32:20 -05:00
netblue30
aa0194eae7 testing 2023-03-08 17:09:17 -05:00
netblue30
acf8efb878 testing 2023-03-08 16:23:30 -05:00
netblue30
0e48f9933c remove firemon --interface option - it is a duplication of firejail --net.print 2023-03-08 11:13:02 -05:00
netblue30
4b760f4f3d add ipv6 support in --net.print 2023-03-08 06:53:22 -05:00
netblue30
7ba317267e testing 2023-03-07 17:59:48 -05:00
netblue30
ec7d55fc44 testing 2023-03-07 17:49:25 -05:00
netblue30
51f25677e6 remove DNS lookup for --netfilter.print and --netfilter6.print commands 2023-03-07 09:50:22 -05:00
netblue30
a12601f02a testing 2023-03-07 08:30:53 -05:00
Kelvin M. Klann
1f5f84f959 Run make codespell
Environment: codespell 2.2.2-3 on Artix Linux.
2023-03-07 03:29:31 -03:00
netblue30
c79beb5a15 testing 2023-03-06 16:09:33 -05:00
netblue30
d78fc96ee0 codespell github action 2023-03-05 09:57:04 -05:00
netblue30
1bab42a724 test apparmor 2023-03-04 11:48:00 -05:00
netblue30
295a207490 testing: moving apparmor out from filters group 2023-03-03 17:23:43 -05:00
netblue30
774fadedee testing firecfg 2023-03-03 17:16:45 -05:00
netblue30
5b1d1d5cf1 more testing 2023-03-03 17:05:15 -05:00
smitsohu
eb8dfc1284 restrict-namespaces testing 2023-03-02 17:34:07 +01:00
netblue30
336ecb5d65 network testing; merges 2023-03-02 10:34:03 -05:00
netblue30
91235785e0 network testing 2023-03-02 08:19:41 -05:00
netblue30
6d92028545 appimage testing 2023-03-01 09:04:07 -05:00
netblue30
b50812ff5e appimage testing 2023-03-01 08:52:53 -05:00
netblue30
55fb69f4f5 chroot testing 2023-02-28 10:07:35 -05:00
netblue30
27c4d069f3 chroot testing 2023-02-28 09:51:26 -05:00
netblue30
e4f9f36a47 random hostname by default; fix --hostname and --hosts-file 2023-02-27 17:50:02 -05:00
Kelvin M. Klann
bdb4f03ed9 test2.profile: restore leading spaces
As pointed out by @rusty-snake[1]:

> I think this is intentional to test if firejail can parse commands
> with leading spaces.

This amends commit b406b2420 ("tests: Fix mixed space/tabs indentation",
2023-02-19) / PR #5674.

Note: This is the only profile in test/ that the commit changed:

    $ git show --pretty= --name-only b406b2420 -- test/
    test/fs/private-whitelist.exp
    test/network/firemon-route.exp
    test/profiles/test2.profile

[1] https://github.com/netblue30/firejail/pull/5674#discussion_r1117891957
2023-02-25 14:42:38 -03:00
netblue30
d657245f73
Merge pull request #5674 from kmk3/fix-ws-add-editorconfig
build: Fix whitespace and add .editorconfig
2023-02-24 20:44:48 -05:00
netblue30
2531759b80 more private-etc 2023-02-24 20:37:35 -05:00
Kelvin M. Klann
b406b2420a tests: Fix mixed space/tabs indentation
Command used to find the errors:

    $ git grep -I '^ [^*]' -- test/

Misc: All of the affected files were added in 2016.
2023-02-20 17:39:31 -03:00
Kelvin M. Klann
def30f6d1e test/filters/namespaces.c: use tabs for indentation
This appears to be the only C file in the repository that uses spaces
for indentation.

Commands used to check for the above:

    $ git grep '^        ' -- '*.c' '*.h'

Commands used to search and replace:

    $ f=test/filters/namespaces.c; printf '%s\n' \
        "$(sed 's/    /\t/g' "$f")" >"$f"

Note: The mmap call was aligned manually.

Added on commit 5116c1ced ("testing", 2022-12-24).
2023-02-20 17:39:31 -03:00
Kelvin M. Klann
3812c139a6 Fix EOL at EOF
Commands used to search and replace:

    $ git grep -Ilz '.' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(cat '{}')\" >'{}'"

The above commands ensure that there is exaclty 1 line terminator at EOF
(rather than 0 or more than 1) on all non-empty text files.

This fixes all of the "new blank line at EOF" errors raised by git:

    $ git diff --check 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEAD |
      grep '^[^+]' | cut -f 3 -d : | LC_ALL=C sort | uniq -c
         21  new blank line at EOF.
         72  space before tab in indent.
          4  trailing whitespace.
2023-02-19 20:57:12 -03:00