Repository navigation
upgrade, provision: keep /etc/speakerguardd readable for the seat user - #186
Merged
Merged
Conversation
aurora-speaker-upgrade runs with umask 077. Its switch writes
/etc/speakerguardd/provision.conf before v2 has provisioned, so
write_file()'s makedirs() created /etc/speakerguardd 0700. systemd's
ConfigurationDirectoryMode=0755 only warns about an existing directory
("already exists but the mode is different"), and provisioning's
ensure_dir() returned early for it. From then on, the seat user's session
could not read speakerguardd.conf: speakerguardd-provision graph-user found
no SGV2_UID ("uid 1000 is not the seat user (none provisioned)"), linked
no speaker graph, and PipeWire had no protected speaker sink. The J815 was
silent on every boot after the switch, though provisioning, the self-check
and the supervisor all passed.
- upgrade: create the missing parents of a file written outside the store
at 0755, whatever the umask. Existing directories are left alone.
- provision: ensure_dir() adds the bits it wants to an existing directory
that lacks them, which repairs installs that are already affected on
their next boot. It never removes bits.
Same class of bug as RC8 E2E B4 (/run/speakerguardd-graph), on the one
path that fix did not cover. Tests for both sides.
Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After a successful switch to v2, the speakers are silent on every following boot. The cause is
/etc/speakerguarddending up0700, which hidesspeakerguardd.conffrom the seat user's session. Provisioning, the self-check and the supervisor all pass, but no speaker graph is ever linked.What happens
/etc/speakerguardd/provision.confbefore v2 has provisioned, sowrite_file()'sos.makedirs()creates/etc/speakerguarddas0700.ConfigurationDirectoryMode=0755doesn't change an existing directory. It only warns:speakerguardd-v2-provision.service: ConfigurationDirectory 'speakerguardd' already exists but the mode is different. (File system: 700 ConfigurationDirectoryMode: 755)ensure_dir()in speakerguardd-provision returns early for an existing directory, so nothing repairs it.graph-userruns as the seat user, andread_kv(/etc/speakerguardd/speakerguardd.conf)comes back empty:speakerguardd-provision: uid 1000 is not the seat user (none provisioned): no speaker graph hereThat happens even though provisioning had just bound that user (
provisioned j815: blob … seat user nikita (seat0)). PipeWire gets no protected speaker sink, so there's no sound at all.This is the same class of bug as RC8 E2E B4 (
/run/speakerguardd-graphmade0700under the tool's umask), on the one path that fix didn't cover.Seen on a MacBook Air 15-inch M5 (J815, AID43 tuning from macOS 26B131, speakerguardd-v2 1.0.0alpha.1-40, aurora-speaker-upgrade 0.1-0.14). The switch passed (
check rc 0,switch rc 0), and the next boot was silent.Change
make_parents()creates the missing parents of a file written outside the store at0755, whatever the umask. Directories that already exist, including the store at0700, are left alone.ensure_dir()adds the bits it wants to an existing directory that lacks them, and never removes any. Installs that are already affected repair themselves on their next provisioning run, with no manualchmod.Tests
ConfigDirPermissions.test_a_config_dir_made_by_the_switch_is_world_readable(upgrade) andUmask.test_an_unreadable_config_dir_is_repaired(provision). Both fail on04169c4and pass with this change.packaging/upgrade/tests: 38 passed.packaging/session: 219 passed, 1 skipped. One failure,test_session.py::Idle::test_the_report_carries_play, is unrelated: it reads/proc/self/stat, which doesn't exist on the macOS host I ran it on.@RyanTheTide could you take a look?
Assisted-by: Claude Opus 5.5