Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Sat May 14, 2022 8:11 Post subject:
egc wrote:
Do not use the command shell use the CLI (telnet/Putty)
It should be an easy fix, like last time when I reported an error related to escaping HTML characters in the same function Admin->Commands ...
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Mon May 16, 2022 5:09 Post subject:
the-joker wrote:
TBH, admin->commands is basic and not surprisingly so, not a substitute for a full blown terminal.
Inexperienced users still rely on Administration->Commands to "Save USB", "Save Startup"... for scripting, and for simple management tasks. This function exists for a long time...
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Mon May 16, 2022 5:25 Post subject:
the-joker wrote:
If it should be an easy fix, it should be easy to submit a patch then right ? hahahaha
It still will take hard work and precious time. Maybe later...
Side-note: I think source codes of DD-WRT lacked sufficient documentation and comments. This adds difficulties reading codes let alone fixing problems for new developers. Anyway...
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Mon May 16, 2022 7:06 Post subject:
Well, I agree with lack of proper comments but that is 90% or more of any projects.
Not being a C person, thus not being familiar with most of its functions and declarations, I understand the pain.
That said all code is code even scripting languages all have some common ancestry in one way or another similarities exist, some syntax can change and or have specific quirks but its all code.
If you can read one, you can more or less read another, and the internet being the internet, I can search for any portions I dont understand what its doing to see what documentation says.
I'm already on the 5th chapter of my life and have some impairment due to health issues that affects my brain most days, so learning new stuff is extra extra hard and remembering stuff is also bullshit.
But my health issues are not me, the self is resilient and one must soldier on and forward without fear or hesitation no matter what it is about.
Time however is one thing once expended you never get back, so I try to use it wisely, not always possible as this posts attests to.
In another thread, I found that DD-WRT Busybox was not including the flock command. It could be as useful as a simple fopen() and it shouldn't take much disk space. You could lock a file like using a semaphore. Anyway...
Regarding your ramble: our brains are born to grow old. Some age faster, some slower.
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Mon May 16, 2022 10:10 Post subject:
I think there is some stripping going on.
First, most files have an empty line at the end I think thats likely being stripped out.
Second, to test whats going on, I ran
Code:
cat /tmp/dnsmasq.conf
The empty line at end of file is not rendered, and in addition, maybe because its a web interface its interpreting other stuff like in file I have an entry like dhcp-option=252,"\n" followed by cache-size=1500 on the very next line.
This is shown then as
Code:
dhcp-option=252,"
"
cache-size=1500
So indeed the web interface is interpreting the new line and rendering it.
This tells me the logic behind is likely if you ran a cat on some html file that would render the HTML instead of showing the actual text.
I havent tested this, but I know for instance, when there are crashes on some router page the backtrace will output what was on page and if it includes html like e.g. input, that an actual input is rendered and looks like any input on regular options page, and you can interact with it, like type text into that input on the syslsog page -- right, its nuts!
On an aside note, there is a fully fledged web terminal based on xterm that could be used as a wrapper for the busybox terminal functionality see https://github.com/xtermjs/xterm.js and use that instead of the current solution, obviously would need to be neutered to suit dd-wrt as most the stuff wouldn't be needed.
That would give you essentially the same functionality in web interface as running it from a real terminal, but without its caveats as well since its only a wrapper and not actual terminal, but, your not actually gonna notice those shortcomings.
The only drawback of this is, the project has quite a few dependencies, and boy oh boy its dependency hell any such projects, though size wise its minimal.
Anyway it was a brain fart, I doubt it would actually be integrated.
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Mon May 16, 2022 12:25 Post subject:
the-joker wrote:
Yep, running cat on a html file renders most of the html intead of showing the files contents, same as I observed in syslog.
See attachment and marvel at the 999th wonder of the world.
Not a simple fix after all.
I didn't expect this.
The simple solution is to always wrap the output of shell execution with "<Pre>" or "<TextArea>" tag? Worth trying in my opinion...
If I remember correctly, the last time I reported problem about Admin -> Commands was the output of "cat /proc/mtd".
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Mon May 16, 2022 12:39 Post subject:
the-joker wrote:
The output is wrapped in the pre, just look at Diagnostics.asp source, makes no difference.
There are bigger issues then the last line being missing is all I'm saying.
How about just replacing "<" with "<" and ">" with ">"? I think the problem with quote characters was solved when I reported about "cat /proc/mtd". Find that same function and add logic to escape "<" and ">"?