nikp123 / xava

X11 Audio Visualizer for ALSA
http://nikp123.github.io/xava
Other
134 stars 15 forks source link

Config file name gets corrupted in xWatcher #56

Closed dromer closed 3 months ago

dromer commented 1 year ago

When I run it on my system it says:

$ xava -p config.txt 
Output method 'alsa' at '/usr/lib/xava/out_alsa.so' could not load.
Reason: /usr/lib/xava/out_alsa.so: cannot open shared object file: No such file or directory

With this config:

[output]
method=alsa
nikp123 commented 1 year ago

ALSA is not an output module. Aim for the [input] section instead.

dromer commented 1 year ago

Derp, sorry :D

When I change the config to

[input]
method=alsa

I just get a segfault.

(gdb) run
Starting program: /home/dreamer/Sources/_audio/xava/build/xava -p config.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
76  ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1  0x00007ffff7d557ee in __GI___strdup (s=0x0) at ./string/strdup.c:41
#2  0x00007ffff7fbaee2 in xWatcher_appendFile (watcher=0x55555555c2a0, reference=0x7fffffffd820) at /home/dreamer/Sources/_audio/xava/lib/x-watcher/x-watcher.h:534
#3  0x00007ffff7fbb2b2 in xavaIONotifyAddWatch (setup=0x7fffffffd860) at /home/dreamer/Sources/_audio/xava/src/shared/ionotify.c:67
#4  0x0000555555557f77 in main (argc=3, argv=0x7fffffffda98) at /home/dreamer/Sources/_audio/xava/src/xava.c:225
dromer commented 1 year ago

Trying the fifo input with mpd results in the same type of segfault:

[input]
method=fifo
source=/tmp/mpd.fifo
nikp123 commented 1 year ago

Somehow the file name that's passed along gets corrupted?

Are you changing the default config files name by any chance or do you have a custom XDG path set? Asking this for debugging reasons.

nikp123 commented 1 year ago

Can you break at ionotify.c:67 and give me the value of the variable setup->filename b is the GDB command for breaking and p is for printing variables once you breaked

dromer commented 1 year ago

hmm, I'm trying to set the breakpoint using break src/shared/ionotify.c 67 but I'm guessing this is not the way?

p just says The history is empty.

(gdb) b src/shared/ionotify.c 67
Function "src/shared/ionotify.c 67" not defined.
Make breakpoint pending on future shared library load? (y or [n]) 
(gdb) p
The history is empty.
(gdb) run
Starting program: /home/dreamer/Sources/_audio/xava/build/xava -p config.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
76  ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) p
The history is empty.
(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1  0x00007ffff7d557ee in __GI___strdup (s=0x0) at ./string/strdup.c:41
#2  0x00007ffff7fbaee2 in xWatcher_appendFile (watcher=0x55555555c2a0, reference=0x7fffffffd820) at /home/dreamer/Sources/_audio/xava/lib/x-watcher/x-watcher.h:534
#3  0x00007ffff7fbb2b2 in xavaIONotifyAddWatch (setup=0x7fffffffd860) at /home/dreamer/Sources/_audio/xava/src/shared/ionotify.c:67
#4  0x0000555555557f77 in main (argc=3, argv=0x7fffffffda98) at /home/dreamer/Sources/_audio/xava/src/xava.c:225
(gdb) p
The history is empty.

Sorry but new to this.

dromer commented 1 year ago

Ok derp, because I was standing in the build-dir it used the binary located there, this was incorrect.

Backtrace from the installed version is a bit different:

dreamer@auditorium:~/Sources/_audio/xava$ gdb --args xava -p build/config.txt
GNU gdb (Debian 13.1-3) 13.1
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-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 xava...
(gdb) run
Starting program: /usr/bin/xava -p build/config.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff67126c0 (LWP 1190391)]
b[New Thread 0x7ffff2b5a6c0 (LWP 1190392)]

Thread 3 "xava" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff2b5a6c0 (LWP 1190392)]
0x00000000000000ff in ?? ()
(gdb) bt
#0  0x00000000000000ff in ?? ()
#1  0x00007ffff7f7c1bd in __internal_xavaIONotifyWorkAroundDumbDecisions (event=XWATCHER_FILE_OPENED, name=0x7fffec000b70 "/home/dreamer/.config/xava/gl/shaders/default/fragment.glsl", 
    id=1, data=0x7ffff7f833c0 <hax+32>) at /home/dreamer/Sources/_audio/xava/src/shared/ionotify.c:47
#2  0x00007ffff7f7b965 in __internal_xWatcherProcess (argument=0x55555555c2a0) at /home/dreamer/Sources/_audio/xava/lib/x-watcher/x-watcher.h:203
#3  0x00007ffff7d40044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#4  0x00007ffff7dc061c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:8
nikp123 commented 1 year ago

/home/dreamer/.config/xava/gl/shaders/default/fragment.glsl does this file exist in your case? My auto-installers can be quite buggy sometimes.

dromer commented 1 year ago

It does exist yes

nikp123 commented 11 months ago

You can try again now, it seems that I had a buggy version of a lib in xava.

dromer commented 11 months ago

I get a near identical segfault. Using just

[input]
method=alsa
dreamer@auditorium:~/Sources/_audio/xava$ gdb --args xava -p confix.txt 
GNU gdb (Debian 13.1-3) 13.1
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-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 xava...
(gdb) run
Starting program: /usr/bin/xava -p confix.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
76  ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1  0x00007ffff7d557ee in __GI___strdup (s=0x0) at ./string/strdup.c:41
#2  0x00007ffff7f7bee2 in xWatcher_appendFile (watcher=0x55555555c2a0, reference=0x7fffffffd890) at /home/dreamer/Sources/_audio/xava/lib/x-watcher/x-watcher.h:536
#3  0x00007ffff7f7c2b2 in xavaIONotifyAddWatch (setup=0x7fffffffd8d0) at /home/dreamer/Sources/_audio/xava/src/shared/ionotify.c:67
#4  0x0000555555557f77 in main (argc=3, argv=0x7fffffffdb08) at /home/dreamer/Sources/_audio/xava/src/xava.c:225
nikp123 commented 11 months ago

Fortunately I was able to reproduce the issue. I had a buggy strcmp, but it seems even with said option the output is a empty screen. I'll look into why that is.

PS: You need to use the default config otherwise the OpenGL module has no module to output to.

Try again please.

dromer commented 11 months ago

How can I use the default config, by not giving any additional parameters?

This fails because it requires PulseAudio, which I don't have on my systems (or a compatible API like PipeWire).

nikp123 commented 11 months ago

The config should be already at ~/.config/xava/config just change the [input] section to:

[input]
method = alsa

If it isn't, delete the old one. Run xava again and once it crashes/exits, make the changes above.

dromer commented 11 months ago

I indeed modified that file. xava opens, but it doesn't have any window. I need to set it to the top layer in my WM to see it. And then it doesn't respond to audio somehow :thinking: At least it no longer crashes immediately!

Does it require a compositing WM to function properly perhaps?

nikp123 commented 11 months ago

I indeed modified that file. xava opens, but it doesn't have any window. I need to set it to the top layer in my WM to see it. And then it doesn't respond to audio somehow 🤔 At least it no longer crashes immediately!

Does it require a compositing WM to function properly perhaps?

Depends on what you're trying to achieve. If it's a window that's supposed to be transparent, yes. Otherwise no.

"Does not respond to audio" just means that you probably selected the wrong audio source. And unless you plan to use a loopback setup I otherwise discourage the use of ALSA.

nikp123 commented 3 months ago

I indeed modified that file. xava opens, but it doesn't have any window. I need to set it to the top layer in my WM to see it. And then it doesn't respond to audio somehow

I figured out what this was by reading the comment again: If you're running a file manager or some wallpaper root program window (this is X11 specific) and set XAVA to be the bottom layer, XAVA isn't intelligent enough to tell whether or not that window is the part of the desktop interface and will place itself below it (yes, this is a bug, for which I don't have a simple fix).

This of course is undesirable, but I can't realistically work around that now, sorry.

As the relevant issue (from the title) has been solved, I'm closing this one. If you want further updates on this feel free to open a new issue.