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
F103017573: D45973.id140879.diff
Tue, Nov 19, 9:20 PM
F103017520: D45973.id141459.diff
Tue, Nov 19, 9:19 PM
F103013067: D45973.diff
Tue, Nov 19, 8:05 PM
Unknown Object (File)
Tue, Nov 12, 10:46 PM
Unknown Object (File)
Tue, Nov 12, 8:44 PM
Unknown Object (File)
Oct 11 2024, 12:02 AM
Unknown Object (File)
Oct 11 2024, 12:02 AM
Unknown Object (File)
Oct 11 2024, 12:01 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 Not Applicable
Unit
Tests Not Applicable

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.