Page MenuHomeFreeBSD

mixer(8): Make mute and recsrc argument parsing more robust
ClosedPublic

Authored by christos on Jul 14 2024, 5:10 PM.
Tags
None
Referenced Files
F97921464: D45973.id.diff
Tue, Oct 1, 5:55 PM
Unknown Object (File)
Fri, Sep 27, 1:20 AM
Unknown Object (File)
Thu, Sep 19, 6:28 PM
Unknown Object (File)
Thu, Sep 19, 5:35 AM
Unknown Object (File)
Wed, Sep 18, 11:41 PM
Unknown Object (File)
Wed, Sep 18, 8:19 AM
Unknown Object (File)
Wed, Sep 18, 4:08 AM
Unknown Object (File)
Tue, Sep 17, 8:33 AM
Subscribers

Details

Summary

For the deprecated argument interfaces of the mute (1, 0, ^) and recsrc
(+, -, =, ^) controls, we only check the first character of the
argument, which means that an argument such as "vol.mute=10" would be a
valid. Fix this by checking the whole argument string.

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58637
Build 55525: arc lint + arc unit

Event Timeline

usr.sbin/mixer/mixer.c
436

I guess strcmp()s would be fine as well.

475

Ditto.

Did some brief tests, looks good to me.

This revision is now accepted and ready to land.Jul 18 2024, 7:27 PM

For the deprecated argument interfaces of the mute (1, 0, ^) and recsrc
(+, -, =, ^) controls,

On a side note, how do people know that these are deprecated? The CLI interface of mixer(8) is used as an API by user scripts - there's been some resentment already due to the change from percentage to decimal values (difficult to parse and modify in shell script).

For the deprecated argument interfaces of the mute (1, 0, ^) and recsrc
(+, -, =, ^) controls,

On a side note, how do people know that these are deprecated? The CLI interface of mixer(8) is used as an API by user scripts - there's been some resentment already due to the change from percentage to decimal values (difficult to parse and modify in shell script).

I think adding a man page notice would suffice for now. Also regarding percentage values, they are still available. You can do mixer vol.volume=[+|-]<n>%[:[+|-]<n>%] just fine.

For the deprecated argument interfaces of the mute (1, 0, ^) and recsrc
(+, -, =, ^) controls,

On a side note, how do people know that these are deprecated? The CLI interface of mixer(8) is used as an API by user scripts - there's been some resentment already due to the change from percentage to decimal values (difficult to parse and modify in shell script).

I think adding a man page notice would suffice for now.

Adding a man page notice about deprecation is fine, but it should be communicated before the actual removal. People on the release train should have a chance to know that one or two releases in advance. Or at least communicate it explicitly via release notes, if possible.

Also regarding percentage values, they are still available. You can do mixer vol.volume=[+|-]<n>%[:[+|-]<n>%] just fine.

Yes, but reading the current value and turning it into a percentage for display / comparison requires some non-trivial awk skills. People have suggested to support libxo(3) output, as an alternative.