Michael Vogt 052d3496e2 snap-exec: fix detection if cups interface is connected
* snap-exec: fix detection if `cups` interface is connected

The cups interface needs a way to set the environment variable
`CUPS_SERVER` if the `cups` interface is connected. However we
have no mechanism for setting environment vars based on interface
connections currently. To workaround this, the cups work added
a workaround in `snap-exec` that tried to detect if `cups` is
connected and when it is set the environment. Unfortunately the
code in there was too simplistic because it just checked if
the directory `/var/cups` exists. However ths dir now always
exists because it's needed as the mount point.

This commit fixes the detection by checking if `/var/cups` is
a bind mount. This is checked by looking at the `stat()` data
and the `dev_t` field in there. If they differ it means the
bind mount exists and the only thing that creates this bind
mount is the `cups` `MountConnectedPlug()` code.

This is not great but it fixes the spread failure we see
in the `cups-control` test (which is a real bug) and should
be good enough until we have a proper interface backend that
can set environment variables.

* tests: re-enable interfaces-cups-control test

For unclear reasons the error message on unplug changes when I
run this on my 20.04 system so I updated the tests - it most likely
because the test-snapd-cups-control-consumer snap moved from
core16 to core20 a week ago but that is not 100% confirmed.

* snap-exec: fix unit test for CUPS_SERVER workaround
2022-04-04 13:18:03 +02:00
2022-03-11 10:29:26 +01:00
2022-02-09 10:12:09 +00:00
2022-03-21 22:17:15 -05:00
2021-06-24 11:42:13 +02:00
2020-05-11 15:31:11 -05:00
2022-02-09 10:12:09 +00:00
2022-03-16 19:29:58 +01:00
2016-05-02 16:39:40 +02:00
2021-08-24 20:12:41 +02:00
2018-09-20 09:04:52 +02:00
2021-09-03 14:41:11 +03:00
2016-09-14 14:01:39 +02:00
2015-10-29 22:46:10 -06:00
2022-01-18 09:35:44 +01:00
2022-02-09 13:42:29 +00:00

Snapcraft

Welcome to snapd

This is the code repository for snapd, the background service that manages and maintains installed snaps.

Snaps are app packages for desktop, cloud and IoT that update automatically, are easy to install, secure, cross-platform and dependency-free. They're being used on millions of Linux systems every day.

Alongside its various service and management functions, snapd:

  • provides the snap command that's used to install and remove snaps and interact with the wider snap ecosystem
  • implements the confinement policies that isolate snaps from the base system and from each other
  • governs the interfaces that allow snaps to access specific system resources outside of their confinement

For general details, including installation and Getting started guides, head over to our Snap documentation. If you're looking for something to install, such as Spotify or Visual Studio Code, take a look at the Snap Store. And if you want to build your own snaps, start with our Creating a snap documentation.

Get involved

This is an open source project and we warmly welcome community contributions, suggestions, and constructive feedback. If you're interested in contributing, please take a look at our Code of Conduct first.

Get in touch

We're friendly! We have a community forum at https://forum.snapcraft.io where we discuss feature plans, development news, issues, updates and troubleshooting. You can chat in realtime with the snapd team and our wider community on the #snappy IRC channel on libera chat.

For news and updates, follow us on Twitter and on Facebook.

Project status

Service Status
Github Actions Build Status
GoReport Go Report Card
Codecov codecov
Description
No description provided
Readme 165 MiB
Languages
Go 93.9%
C 2.9%
Shell 2%
Python 0.7%
Makefile 0.4%