Skip to content

Segfault in watch (control characters)

In trying to display some color output within watch, I see consistent crashes on my platform (Archlinux), but have had a few friends confirm that it seems to exist on other distributions.

$ watch -v
watch from procps-ng 3.3.11

The crash is triggered by assorted inputs, but can be triggered consistently as follows.

$ watch -t -c "echo -e 'begin-base64 644 -\nG1s5MnRlc3QbWzBtCg==\n====' | uudecode"
Segmentation fault (core dumped)

This above is a small snippet, of the output from this command:

$ watch -t -c 'curl -s wttr.in/Moon@2016-Mar$((($(date +%s)/2 % 30)))'

The, -t seems to make the crash much more likely. Though I'm having trouble reproducing, I believe I have witnessed the crashing without the -t as well.