Bug 1211980 - [Build 20230602] Internal Error Crash: openQA test fails in yast2_apparmor
Summary: [Build 20230602] Internal Error Crash: openQA test fails in yast2_apparmor
Status: VERIFIED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: AppArmor (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Christian Boltz
QA Contact: E-mail List
URL: https://openqa.opensuse.org/tests/333...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-04 04:37 UTC by Dominique Leuenberger
Modified: 2023-09-13 08:20 UTC (History)
4 users (show)

See Also:
Found By: openQA
Services Priority:
Business Priority:
Blocker: Yes
Marketing QA Status: ---
IT Deployment: ---


Attachments
Screenshot: Internal Error (30.61 KB, image/png)
2023-06-05 07:07 UTC, Stefan Hundhammer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique Leuenberger 2023-06-04 04:37:57 UTC
## Observation

No textdomain configured error shown when starting yast apparmor module 

openQA test in scenario opensuse-Tumbleweed-DVD-x86_64-yast2_ncurses@64bit fails in
[yast2_apparmor](https://openqa.opensuse.org/tests/3334529/modules/yast2_apparmor/steps/9)

## Test suite description
Maintainer: qsf-y Test for yast2 UI, ncurses only. Running on created gnome images which provides both text console for ncurses UI tests as well as the gnome environment for the GUI tests.
riafarov set TIMEOUT_SCALE to improve stability of the test.


## Reproducible

Fails since (at least) Build [20221123](https://openqa.opensuse.org/tests/2899189)


## Expected result

Last good: [20210718](https://openqa.opensuse.org/tests/1847178) (or more recent)


## Further details

Always latest result in this scenario: [latest](https://openqa.opensuse.org/tests/latest?arch=x86_64&distri=opensuse&flavor=DVD&machine=64bit&test=yast2_ncurses&version=Tumbleweed)
Comment 1 Stefan Hundhammer 2023-06-05 07:07:49 UTC
Created attachment 867398 [details]
Screenshot: Internal Error
Comment 2 Stefan Hundhammer 2023-06-05 07:10:17 UTC
No y2logs at that OpenQA test (why not?), "Details" at that internal error pop-up not opened.
Comment 3 Stefan Hundhammer 2023-06-05 07:12:42 UTC
What little we can read in that error pop-up:

Caller: .../yast/i18n.rb:59 in '_'

Details:

No textdomain configured in AppArmor::Profiles,
cannot translate "Cannot evaluate current status via..."

(Rest cut off)
Comment 4 Stefan Hundhammer 2023-06-05 07:14:18 UTC
There are also several more red frames all over that OpenQA test. Something deeper might be wrong in that build.
Comment 5 Dominique Leuenberger 2023-06-05 07:17:02 UTC
(In reply to Stefan Hundhammer from comment #4)
> There are also several more red frames all over that OpenQA test. Something
> deeper might be wrong in that build.

The other failed yast modules are the long-known issue https://bugzilla.opensuse.org/show_bug.cgi?id=1207390
Comment 6 Stefan Hundhammer 2023-06-05 07:45:40 UTC
Error location in yast/i18n.rb:59:

https://github.com/yast/yast-ruby-bindings/blob/master/src/ruby/yast/i18n.rb#L59
Comment 7 Stefan Hundhammer 2023-06-05 07:58:58 UTC
Indeed there is no "textdomain" call in the AppArmor::Profiles class, but there is one single '_(...)' call that could cause this error:

https://github.com/yast/yast-apparmor/blob/master/src/lib/apparmor/profiles.rb#L87

> Yast::Report.Error(_("Cannot evaluate current status via aa-status."))


The fix to add the textdomain is easy, but then the next problem will probably be WHY that 'aa-status' command failed.
Comment 9 Stefan Hundhammer 2023-06-05 08:04:44 UTC
This problem is also present in SLE-15 SP4 and SP5.
Comment 10 Dominique Leuenberger 2023-06-05 08:18:25 UTC
(In reply to Stefan Hundhammer from comment #7)
>
> The fix to add the textdomain is easy, but then the next problem will
> probably be WHY that 'aa-status' command failed.

the 'why' is likely the update for AppArmor to 3.1.4; if yast parses output of aa-status, there is a chance the output format might have changed sufficiently
Comment 11 Stefan Hundhammer 2023-06-05 08:29:10 UTC
PR for SLE-15-SP4:

  https://github.com/yast/yast-apparmor/pull/59

(a merge to SLE-15-SP5 and master / Factory will follow)
Comment 12 Dominique Leuenberger 2023-06-05 08:44:39 UTC
yast uses the command
  aa-status --pretty-json

this seems not to give any output on an apparmor 3.1.4 based TW install

aa-status without parameters gives output.

@cboltz: does that sound right or possibly a known regression upstream?
Comment 13 Stefan Hundhammer 2023-06-05 09:08:52 UTC
This yast-apparmor module is flawed by design: It's only a very thin wrapper around the AppArmor Python scripts. So the JSON output was added years later to make the YaST module at least less dependent on the exact format of the script output. But that of course means that this JSON output needs to remain reasonably stable.
Comment 14 Stefan Hundhammer 2023-06-05 09:09:39 UTC
See also

  https://github.com/yast/yast-apparmor/issues/58

Conclusion: The YaST AppArmor module offers little benefit over using the AppArmor Python scripts directly.
Comment 16 Stefan Hundhammer 2023-06-05 09:38:01 UTC
Merge to SLE-15-SP5:

  https://github.com/yast/yast-apparmor/pull/59

Merge to master / Factory:

  https://github.com/yast/yast-apparmor/pull/61

SR to IBS SLE-15-SP4:

  https://build.suse.de/request/show/300584

SR to IBS SLE-15-SP5:

  https://build.suse.de/request/show/300587
Comment 17 Stefan Hundhammer 2023-06-05 09:42:23 UTC
Maintenance team,

this could become maintenance updates for SLE-15-SP4 / SP5, but since this is only a very rare problem, waiting for the QU is sufficient AFAICS.

There were no customer complaints about this, and I doubt that there will be any: This happens only if the "aa-status" reported an error, and that error could not be parsed.
Comment 18 Stefan Hundhammer 2023-06-05 09:44:58 UTC
SR to OBS master / Factory:

https://build.opensuse.org/request/show/1090867
Comment 19 Stefan Hundhammer 2023-06-05 09:45:47 UTC
So the original part of this is now fixed: The internal error about the missing textdomain.
Comment 20 Stefan Hundhammer 2023-06-05 09:47:39 UTC
Reassigning to the apparmor maintainers for the underlying problem: The changed output format of the "aa-status" script (see comment #12).
Comment 21 Christian Boltz 2023-06-05 11:58:03 UTC
(In reply to Dominique Leuenberger from comment #12)
> yast uses the command
>   aa-status --pretty-json
> 
> this seems not to give any output on an apparmor 3.1.4 based TW install
> 
> aa-status without parameters gives output.
> 
> @cboltz: does that sound right or possibly a known regression upstream?

This is indeed a known upstream bug - aa-status produces invalid json, which also causes --pretty-json to be empty. This was fixed upstream, but it seems the fix didn't make it into 3.1.4 :-(

I'll add the patch to the AppArmor package tonight.
Comment 22 Christian Boltz 2023-06-06 22:07:05 UTC
Actually the fix made it into 3.1.4, but it was slightly faulty because he 3.1 branch needed a slightly different patch than master.

There's "only" a  }  missing in the json, but that's enough to make the json invalid.

SR 1091163 sent.
Comment 23 OBSbugzilla Bot 2023-06-07 00:35:09 UTC
This is an autogenerated message for OBS integration:
This bug (1211980) was mentioned in
https://build.opensuse.org/request/show/1091163 Factory / apparmor
Comment 24 Dominique Leuenberger 2023-06-12 06:30:50 UTC
Fix confirmed by openQA:
https://openqa.opensuse.org/tests/3347767#step/yast2_apparmor/19