Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: new regression test to reproduce lp-2061981 #13848

Conversation

sergiocazzolato
Copy link
Collaborator

@sergiocazzolato sergiocazzolato commented Apr 17, 2024

Running this test is possible to reproduce the following error:

lp issue: https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/2061981

reproduce: > spread -debug google:ubuntu-22.04-64:tests/regression/lp-2061981

error:
cannot update snap namespace: cannot expand mount entry (none $HOME/.missing none x-snapd.kind=ensure-dir,x-snapd.must-exist-dir=$HOME 0 0): cannot use invalid home directory "/home/myhome/test2": permission denied

@sergiocazzolato sergiocazzolato changed the title tests: new test to reproduce the error raised in lp-20611981 tests: new regression test to reproduce lp-20611981 Apr 17, 2024
@sergiocazzolato
Copy link
Collaborator Author

output of cat /etc/apparmor.d/tunables/home

https://paste.ubuntu.com/p/kYQYmjYcWQ/

Copy link
Member

@olivercalder olivercalder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, question about the path granted by personal-files though.

Also, is there something special about the home directory being an extra subdirectory deep in /home, or does this occur as well if the homedir is e.g. /var/www/test2?


plugs:
personal-files:
read: [$HOME/myhome]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is $HOME here /home or /home/myhome/test2? AFAICT the test expects to find /home/myhome/test2/testfile, so in neither case would granting $HOME/myhome seem to be correct, unless it grants recursive read access and $HOME is /home. But in that case, what happens if the personal-files plug grants $HOME/myhome/test2 instead, does it still fail?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$HOME is user home directory I understand

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I udpated the snap to allow read from $HOME and I get the error

grep error: pattern not found, got:
cannot update snap namespace: cannot expand mount entry (none $HOME/.missing none x-snapd.kind=ensure-dir,x-snapd.must-exist-dir=$HOME 0 0): cannot use invalid home directory "/home/myhome/test2": permission denied

@olivercalder olivercalder changed the title tests: new regression test to reproduce lp-20611981 tests: new regression test to reproduce lp-2061981 Apr 17, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.88%. Comparing base (ab996a0) to head (734d1df).
Report is 64 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13848      +/-   ##
==========================================
+ Coverage   78.86%   78.88%   +0.02%     
==========================================
  Files        1043     1043              
  Lines      134595   135366     +771     
==========================================
+ Hits       106144   106782     +638     
- Misses      21837    21926      +89     
- Partials     6614     6658      +44     
Flag Coverage Δ
unittests 78.88% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zyga
Copy link
Collaborator

zyga commented Apr 18, 2024

Please don't merge this yet. The test needs subtle adjustment.

@zyga zyga force-pushed the tests-regression-lp-2061981 branch 2 times, most recently from 10751dc to 2e9ddff Compare April 18, 2024 08:50
XXX: THIS IS NOT A VALID REPRODUCER. To reproduce snapd must re-exec
and in spread the host snapd version is 1334. We must repackage snapd
for this test to really fail.

Running this test is possible to reproduce the following error:

run: spread -debug google:ubuntu-22.04-64:tests/regression/lp-2061981

error:
cannot update snap namespace: cannot expand mount entry (none
$HOME/.missing none x-snapd.kind=ensure-dir,x-snapd.must-exist-dir=$HOME
0 0): cannot use invalid home directory "/home/myhome/test2": permission
denied
@zyga zyga force-pushed the tests-regression-lp-2061981 branch from 2e9ddff to 896b398 Compare April 18, 2024 10:19
mkdir "$TEST_USER_HOME"/other-subdir
touch "$TEST_USER_HOME"/other-subdir/testfile
chown -R "$TEST_USER" -R "$TEST_USER_HOME"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to install a re-packaged snapd snap here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants