libxmp / xmp-cli

Command-line mod player using libxmp
GNU General Public License v2.0
75 stars 22 forks source link

AddressSanitzer et al. exit leaves terminal echo disabled. #26

Open AliceLR opened 3 years ago

AliceLR commented 3 years ago

When xmp is terminated by AddressSanitizer, MemorySanitizer, etc. encountering an error and exiting, terminal echo is still turned off until manually fixed with stty echo, tput reset, or similar. I don't know what the correct solution is for this, but I tried adding an atexit hook to call reset_tty and it didn't help. This has been mildly annoying when diagnosing issues like https://github.com/libxmp/libxmp/issues/319 with input files that cause a lot of ASan/MSan exits.

debrouxl commented 3 years ago

Based on what some other projects do, I'd suggest:

sezero commented 3 years ago

Anyone has a patch for this?

AliceLR commented 3 years ago

Not yet. I think the first one wouldn't be all that much clutter to xmp, and ideally it'd just suppress the player display portion of the terminal output (which is presumably the reason echo/etc is changed). The driver portion could just be handled with the driver flag, if needed (WAV output or playback might be desirable in some cases). It'd also be good to have a way to target any arbitrary one of the four xmp_load_module* functions.

edit: -q suppresses the player portion but it also suppresses the other output (which might not matter much if libxmp is built with -DDEBUG).