Skip to content

Commit

Permalink
ci: fix --version not printing compile-time features
Browse files Browse the repository at this point in the history
Currently, when running on CI, `firejail --version` only prints the
following line:

    firejail version 0.9.69

Add a new print_version() function that always prints both the above and
the compile-time options (like it is done outside of CI) and call it in
both of the places that handle --version on main.c.

Misc: The printing of compile-time features was added on commit
48dd1fb ("apparmor", 2016-08-02).
  • Loading branch information
kmk3 committed May 17, 2022
1 parent 72a686f commit 78aaed1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/firejail/checkcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ int checkcfg(int val) {
exit(1);
}

void print_version(void) {
printf("firejail version %s\n", VERSION);
printf("\n");
print_compiletime_support();
printf("\n");
}

void print_compiletime_support(void) {
printf("Compile time support:\n");
Expand Down
1 change: 1 addition & 0 deletions src/firejail/firejail.h
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ extern char *config_seccomp_filter_add;
extern char **whitelist_reject_topdirs;

int checkcfg(int val);
void print_version(void);
void print_compiletime_support(void);

// appimage.c
Expand Down
7 changes: 2 additions & 5 deletions src/firejail/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,7 @@ static void run_cmd_and_exit(int i, int argc, char **argv) {
exit(0);
}
else if (strcmp(argv[i], "--version") == 0) {
printf("firejail version %s\n", VERSION);
printf("\n");
print_compiletime_support();
printf("\n");
print_version();
exit(0);
}
#ifdef HAVE_OVERLAYFS
Expand Down Expand Up @@ -1082,7 +1079,7 @@ int main(int argc, char **argv, char **envp) {
EUID_USER();
if (rv == 0) {
if (check_arg(argc, argv, "--version", 1)) {
printf("firejail version %s\n", VERSION);
print_version();
exit(0);
}

Expand Down

0 comments on commit 78aaed1

Please sign in to comment.