2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 01:57:43 +00:00

Merge binutils/aa-status: don't exit if no profiles are loaded

Downstream report: https://github.com/NixOS/nixpkgs/issues/347490

Output of `aa-status` is nondescriptive if no profiles are loaded.

Worse yet, the json output isn't even valid json.
It would make sense to just return a json object with no entries,
instead of returning a non-json `eprint` to stderr.

**Ideally** output of non-json would be more descriptive.

Currently:
```
apparmor module is loaded.
Failed to get profiles: 2....
```


What i would prefer:
```
apparmor module is loaded.
Failed to get profiles: No policies loaded
```

However, i am unfamiliar with how the translation framework works,
and thus not confident to do this change blindly.
I am happy to add a commit doing so if i know where to change all that.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1652
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
John Johansen 2025-04-24 10:48:38 +00:00
commit 6f480cb819

View File

@ -1038,7 +1038,7 @@ int main(int argc, char **argv)
* have policy associated.
*/
ret = get_profiles(fp, &profiles, &nprofiles);
if (ret != 0) {
if (ret != 0 && !opt_json) {
eprintf(_("Failed to get profiles: %d....\n"), ret);
goto out;
}