StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.08k stars 390 forks source link

Running DNSControl in Termux (Android) Output Always Get Stuck #3091

Closed IzumiSenaSora closed 3 days ago

IzumiSenaSora commented 3 weeks ago

Describe the bug When i run dnscontrol preview or dnscontrol push it shows ******************** Domain: example.org And stuck there forever

Expected behavior Should Be Working

DNS Provider

Additional context I already checked via dnscontrol check shows no errors

Note: Everything works fine with Github Action But not in Termux!

tlimoncelli commented 3 weeks ago

Interesting!

Does it happen when you use other terminal?

Does it happen when you add --no-colors? (i.e. dnscontrol --no-colors preview)

IzumiSenaSora commented 3 weeks ago

Does it happen when you use other terminal?

I am using Fedora in my desktop where everything works even in github action everything fine!

Even a years ago i tried it in termux it worked without issue ... Now it stuck!

Does it happen when you add --no-colors? (i.e. dnscontrol --no-colors preview)

It still same stuck

tlimoncelli commented 3 weeks ago

I don't have access to Termux so I'd need your assistance.

Can you capture the output (maybe use /usr/bin/script) and see what causes Termux to fail?

IzumiSenaSora commented 3 weeks ago

I don't have access to Termux so I'd need your assistance.

Can you capture the output (maybe use /usr/bin/script) and see what causes Termux to fail?

I don't really get what you are saying! Can you explain a bit? 😅

Which script?

tlimoncelli commented 3 weeks ago

Super glad to explain! The script command is part of the util-linux package but it has been part of Unix since the BSD days. I love showing it to people ... it's surprisingly useful yet very few people know about it.

script captures ALL the output of a command. It captures both stdout and stderr.

Let's do an example.

What is the output of ls -1 --color in a directory with two files (foo.txt and bar.txt)

We run ls -1 --color like normal, but we run it with script:

$ script -q /tmp/capture.txt -c "ls --color -1"
bar.txt
foo.txt

If we look at /tmp/capture.txt you'll see the output that was captured, along with a date header:

$ cat /tmp/capture.txt 
Script started on Thu Aug 22 18:39:15 2024
bar.txt
foo.txt

That's what we expected. Right? Ah! There's more!

On my screen "foo.txt" was in green because it is executable.

Let's look at the captured text with a hex dump:

$ od -c /tmp/capture.txt 
0000000   S   c   r   i   p   t       s   t   a   r   t   e   d       o
0000020   n       T   h   u       A   u   g       2   2       1   8   :
0000040   3   9   :   1   5       2   0   2   4  \n   b   a   r   .   t
0000060   x   t  \r  \n 033   [   0   m 033   [   3   8   ;   5   ;   3
0000100   4   m   f   o   o   .   t   x   t 033   [   0   m  \r  \n
0000117

Now we see what was actually output is bar.txt then the line ending \r followed by \n (ASCII code 13 then 10, otherwise known as CR and LF). Around byte 0000060 we see the "ESC" sequences for turning the text to green, and later we see the codes for turning off color.

If you want some real fun, just use the "script" command with no command line options. You'll get a shell prompt. When you exit that shell (CTRL-D or the exit command), you'll find a file called typescript with every keystroke you typed.

Script has a lot of other features too, but the above is all we need for now.

So... now you can run script -q /tmp/capture.txt -c "dnscontrol preview" and capture the exact output. (try adding -f if the output is incomplete).

If cat /tmp/capture.txt crashes your terminal, you now have a simple way to reproduce the bug.

IzumiSenaSora commented 3 weeks ago

Here's the Output

Script started on 2024-08-23 01:05:30+06:00 [COMMAND="dnscontrol preview" TERM="xterm-256color" TTY="/dev/pts/2" COLUMNS="78" LINES="31"]
******************** Domain: example.org
^C
Script done on 2024-08-23 01:23:12+06:00 [COMMAND_EXIT_CODE="130"]
tlimoncelli commented 3 weeks ago

Can you attach the file?

IzumiSenaSora commented 3 weeks ago

Can you attach the file?

capture.txt

tlimoncelli commented 3 weeks ago

Hi hi!

I'm not seeing anything unusual in the file. Could you run script with the -f flag and attach that file?

Thanks!

IzumiSenaSora commented 3 weeks ago

Hi hi!

I'm not seeing anything unusual in the file. Could you run script with the -f flag and attach that file?

Thanks!

I already did with that file!

tlimoncelli commented 2 weeks ago

Ah, ok.

In that case... I don't see anything in the file that could cause a problem.

I think we've exhausted all the possibilities for this to be a bug in dnscontrol. It must be a bug with Termaux. Please open a bug with that project.

I'd be glad to assist if they have questions.

tlimoncelli commented 3 days ago

closing issue with no activity for >2 weeks.