alsa-utils: axfer: use second argument for transmission direction - #4
Closed
takaswie wants to merge 5 commits into
Closed
alsa-utils: axfer: use second argument for transmission direction#4takaswie wants to merge 5 commits into
takaswie wants to merge 5 commits into
Conversation
Contributor
|
Lack of sign-offs? |
…y to aplay(1) This commit splits option parser for backward compatibility to aplay(1) in list subcommand. Supported operations are listed in local enumeration. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit splits option parser for new command system into a function for readability. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
In renewed command system, axfer uses first argument for subcommand. In popular subcommand such as transfer, transmission direction is required. At present, some options in aplay(1) are used for this purpose however it's understandable to use second argument for this purpose. This commit uses second argument as fixed position to indicate direction for renewed command system. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
… aplay(1) At present, both of help and transfer subcommands are used when options are missing in compatibility mode to aplay(1). However, in a view of users, it should be transfer subcommand. This commit uses transfer subcommand as a default for the mode. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
When subcommands are operated, top-most two arguments are already parsed in renewed command system, thus they're useless. Besides, they're possible to be parsed by getopt_long(3). This commit truncates these options before entering subcommand operation. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Member
Author
Contributor
|
Now merged. Thanks. |
masatake
added a commit
to masatake/alsa-utils
that referenced
this pull request
May 16, 2024
alsactl distributed as part of Fedora 40 got a SEGV:
# journalctl
...
May 17 00:55:58 dev64.localdomain kernel: alsactl[1923]: segfault at 28 ip 00005600705b3373 sp 00007ffd9712bef0 error 4 in alsactl[5600705af000+13000] likely on CPU 5 (core 8, socket 0)
...
As the following output of the debug session, card_free() tried a card
pointing NULL:
$ sudo coredumpctl debug alsactl
PID: 1923 (alsactl)
UID: 0 (root)
GID: 0 (root)
Signal: 11 (SEGV)
Timestamp: Fri 2024-05-17 00:55:58 JST (3h 34min ago)
Command Line: /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon
Executable: /usr/sbin/alsactl
Control Group: /system.slice/alsa-state.service
Unit: alsa-state.service
Slice: system.slice
Boot ID: 241b5a2ef86f4940bb3d340583c80d88
Machine ID: 437365709a8c488c9481ee4b6651c2ec
Hostname: dev64.localdomain
Storage: /var/lib/systemd/coredump/core.alsactl.0.241b5a2ef86f4940bb3d340583c80d88.1923.1715874958000000.zst (present)
Size on Disk: 81.7K
Package: alsa-utils/1.2.11-1.fc40
build-id: 3b6fec58b3566d666d6e9fd48e8fcf04f03f0152
Message: Process 1923 (alsactl) of user 0 dumped core.
Module libasound.so.2 from rpm alsa-lib-1.2.11-2.fc40.x86_64
Module alsactl from rpm alsa-utils-1.2.11-1.fc40.x86_64
Stack trace of thread 1923:
#0 0x00005600705b3373 card_free (alsactl + 0xa373)
alsa-project#1 0x00005600705c0e54 state_daemon (alsactl + 0x17e54)
alsa-project#2 0x00005600705b2339 main (alsactl + 0x9339)
alsa-project#3 0x00007f4c0b9b7088 __libc_start_call_main (libc.so.6 + 0x2a088)
alsa-project#4 0x00007f4c0b9b714b __libc_start_main_impl (libc.so.6 + 0x2a14b)
alsa-project#5 0x00005600705b2df5 _start (alsactl + 0x9df5)
ELF object binary architecture: AMD x86-64
GNU gdb (Fedora Linux) 14.2-1.fc40
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/alsactl...
Reading symbols from /usr/lib/debug/usr/sbin/alsactl-1.2.11-1.fc40.x86_64.debug...
[New LWP 1923]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --init'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 free_list (list=0x20) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:73
73 for (i = 0; i < list->size; i++)
(gdb) where
#0 free_list (list=0x20) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:73
alsa-project#1 card_free (card=card@entry=0x5600707455f0) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:82
alsa-project#2 0x00005600705c0e54 in state_daemon (file=file@entry=0x5600705c31a1 "/var/lib/alsa/asound.state", cardname=cardname@entry=0x0, period=period@entry=300,
pidfile=pidfile@entry=0x5600705c3170 "/var/run/alsactl.pid") at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:455
alsa-project#3 0x00005600705b2339 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/alsactl.c:459
(gdb) list
68
69 static void free_list(struct id_list *list)
70 {
71 int i;
72
73 for (i = 0; i < list->size; i++)
74 free(list->list[i]);
75 free(list->list);
76 }
77
(gdb) up
alsa-project#1 card_free (card=card@entry=0x5600707455f0) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:82
82 free_list(&c->blacklist);
(gdb) p c
$1 = (struct card *) 0x0
(gdb)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
perexg
pushed a commit
that referenced
this pull request
May 23, 2024
alsactl distributed as part of Fedora 40 got a SEGV:
# journalctl
...
May 17 00:55:58 dev64.localdomain kernel: alsactl[1923]: segfault at 28 ip 00005600705b3373 sp 00007ffd9712bef0 error 4 in alsactl[5600705af000+13000] likely on CPU 5 (core 8, socket 0)
...
As the following output of the debug session, card_free() tried a card
pointing NULL:
$ sudo coredumpctl debug alsactl
PID: 1923 (alsactl)
UID: 0 (root)
GID: 0 (root)
Signal: 11 (SEGV)
Timestamp: Fri 2024-05-17 00:55:58 JST (3h 34min ago)
Command Line: /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon
Executable: /usr/sbin/alsactl
Control Group: /system.slice/alsa-state.service
Unit: alsa-state.service
Slice: system.slice
Boot ID: 241b5a2ef86f4940bb3d340583c80d88
Machine ID: 437365709a8c488c9481ee4b6651c2ec
Hostname: dev64.localdomain
Storage: /var/lib/systemd/coredump/core.alsactl.0.241b5a2ef86f4940bb3d340583c80d88.1923.1715874958000000.zst (present)
Size on Disk: 81.7K
Package: alsa-utils/1.2.11-1.fc40
build-id: 3b6fec58b3566d666d6e9fd48e8fcf04f03f0152
Message: Process 1923 (alsactl) of user 0 dumped core.
Module libasound.so.2 from rpm alsa-lib-1.2.11-2.fc40.x86_64
Module alsactl from rpm alsa-utils-1.2.11-1.fc40.x86_64
Stack trace of thread 1923:
#0 0x00005600705b3373 card_free (alsactl + 0xa373)
#1 0x00005600705c0e54 state_daemon (alsactl + 0x17e54)
#2 0x00005600705b2339 main (alsactl + 0x9339)
#3 0x00007f4c0b9b7088 __libc_start_call_main (libc.so.6 + 0x2a088)
#4 0x00007f4c0b9b714b __libc_start_main_impl (libc.so.6 + 0x2a14b)
#5 0x00005600705b2df5 _start (alsactl + 0x9df5)
ELF object binary architecture: AMD x86-64
GNU gdb (Fedora Linux) 14.2-1.fc40
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/alsactl...
Reading symbols from /usr/lib/debug/usr/sbin/alsactl-1.2.11-1.fc40.x86_64.debug...
[New LWP 1923]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --init'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 free_list (list=0x20) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:73
73 for (i = 0; i < list->size; i++)
(gdb) where
#0 free_list (list=0x20) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:73
#1 card_free (card=card@entry=0x5600707455f0) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:82
#2 0x00005600705c0e54 in state_daemon (file=file@entry=0x5600705c31a1 "/var/lib/alsa/asound.state", cardname=cardname@entry=0x0, period=period@entry=300,
pidfile=pidfile@entry=0x5600705c3170 "/var/run/alsactl.pid") at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:455
#3 0x00005600705b2339 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/alsactl.c:459
(gdb) list
68
69 static void free_list(struct id_list *list)
70 {
71 int i;
72
73 for (i = 0; i < list->size; i++)
74 free(list->list[i]);
75 free(list->list);
76 }
77
(gdb) up
#1 card_free (card=card@entry=0x5600707455f0) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:82
82 free_list(&c->blacklist);
(gdb) p c
$1 = (struct card *) 0x0
(gdb)
Closes: #267
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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.
This patchset is for axfer command in alsa-utils to use second argument
for transmission direction. As a result, syntax of its command line is
axfer subcommand direction options
For example:
$ axfer transfer playback [options]
$ axfer list capture [options]
This fashion requires more typing to users, however in my taste this
looks good because it's easier to understand than long/short options.
Additionally, this patchset applies refactoring to list subcommand.
Takashi Sakamoto (5):
axfer: apply refactoring to list subcommand for backward compatibility
to aplay(1)
axfer: apply refactoring in list subcommand for new command system
axfer: use second argument in command line for transmission direction
axfer: use transfer subcommand as a default for compatibility mode to
aplay(1)
axfer: truncate parsed arguments before operating subcommand