I did another test, also with snapd 2.55.3 from beta:
$ snap run --shell cups-admin-test-no-control.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
$ echo $CUPS_SERVER
/var/cups/cups.sock
$ stat / /var/cups | grep Device
Device: 740h/1856d Inode: 11789 Links: 21
Device: 10302h/66306d Inode: 53813571 Links: 2
$ exit
exit
$ sudo snap disconnect cups-admin-test-no-control:cups
$ snap run --shell cups-admin-test-no-control.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
$ echo $CUPS_SERVER
$ stat / /var/cups | grep Device
Device: 740h/1856d Inode: 11789 Links: 21
Device: 740h/1856d Inode: 11669 Links: 2
$ exit
exit
$ sudo snap connect cups-admin-test-no-control:cups cups:cups
$ snap run --shell cups-admin-test-no-control.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
$ echo $CUPS_SERVER
/var/cups/cups.sock
$ stat / /var/cups | grep Device
Device: 740h/1856d Inode: 11789 Links: 21
Device: 10302h/66306d Inode: 53813571 Links: 2
$ exit
exit
$
This shows that disconnecting the cups
interface immediately removes the bind mount on /var/cups/
and also the CUPS_SERVER
environment variable. Re-connecting immediately sets the CUPS_SERVER
variable and does the bind mount. No persistence of the variable over interface disconnect/connect actions.