Skip to contentSkip to conversation

Locale-dependent POSIX regex in sof-soundwire UCM fails under tr_TR.UTF-8 and prevents HiFi profile detection

DISCUSSION GitHub issues - opened 1 participant 1 message Aug 3 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

alsa-project/alsa-ucm-conf issue #824 was opened from radiatez:

## Summary

This issue is fully reproducible and the root cause has been isolated.

The problem is caused by a locale-dependent POSIX regular expression in the SOF SoundWire UCM configuration. Under tr_TR.UTF-8, ALSA fails to import the UCM profile, preventing PipeWire/WirePlumber from exposing the normal HiFi profile.

This report includes:

- a minimal reproducer
- the root cause
- the diagnostic evidence
- a tested fix

---

## Hardware

- Laptop: Acer Swift SFG14-72
- Audio controller: Intel Meteor Lake-P HD Audio (8086:7e28)
- Driver: sof-audio-pci-intel-mtl

### Packages

- alsa-ucm-conf 1.2.16.1-1
- pipewire 1.6.8
- wireplumber 0.5.15

---

## Symptoms

With LANG=tr_TR.UTF-8:

PipeWire exposes only:

- Off
- HDMI
- Pro Audio

No **HiFi** profile appears.

WirePlumber therefore selects off, resulting in:

- Dummy Output
- No speaker
- No microphone

The exact same hardware works correctly from the CachyOS Live ISO.

---

## Root cause

The following regex in sof-soundwire.conf:

```text
mic:([a-z0-9]+(-dmic)?+(-sdca)?)
```

depends on locale-sensitive POSIX character ranges.

This behavior is independent of PipeWire and WirePlumber.

Both components correctly report the ALSA UCM import failure. The parsing error originates inside the ALSA UCM configuration/parser under the Turkish locale.

Under tr_TR.UTF-8, the expression matches:

```text
dmic
```

as

```text
dm
```

instead of

```text
dmic
```

ALSA then attempts to load:

```text
/usr/share/alsa/ucm2/sof-soundwire/dm.conf
```

which does not exist.

The failed include aborts the UCM import, causing PipeWire to expose only legacy ACP profiles.

---

## Reproducer

A small test using setlocale() and POSIX regex demonstrates the issue:

```text
C             -> dmic
C.UTF-8       -> dmic
en_US.UTF-8   -> dmic
tr_TR.UTF-8   -> dm
```

---

## Proposed fix

Replace

```text
[a-z0-9]
```

with

```text
[[:alnum:]]
```

because POSIX character classes are locale-safe while [a-z] is locale-dependent.

This change preserves the intended matching semantics while eliminating locale-specific behavior.

---

## Additional information

I performed a full investigation eliminating:

- kernel regression
- SOF firmware
- topology loading
- PipeWire
- WirePlumber
- device permissions
- package corruption

The attached report contains the complete diagnostic process, evidence, commands executed, and validation.

Please let me know if you would like the minimal reproducer or a patch.

[AUDIO_ROOT_CAUSE.md](https://github.com/user-attachments/files/30677297/AUDIO_ROOT_CAUSE.md)

Issue URL : https://github.com/alsa-project/alsa-ucm-conf/issues/824
Repository URL: https://github.com/alsa-project/alsa-ucm-conf