I've come up with a very bizarre problem. One that makes me hesitant to post herder.tk for others.
First, the operation uses a temp file that resides in memory and is recycled for all kinds of purposes. That's not an issue, but leads to one.
Second, herder.tk opens anything, or nothing, and does stuff depending. One of those things is to open a video file, have it tell you all about it, open it to watch, open it to edit, and modify the tags (atoms) if you'd like. No problems.
I have found that depending on the file name of the video, herder.tk may read the binary contents into the temp file, as in the whole file, for some unknown reason. That is not the instructed behavior and there isn't even an option to do so. It should read only the results of commands that are short, even when tagging it reads from the temp file and not to it...
Bad filenames are "12O'ClockHigh_121_The Clash.dv", "1short.dv" and other variations. Rename to short.dv, no issue on the same file. Rename a random file to "1short.dv" or any 'video' extension and it reads the entire content into the temp file, and displays the code like it's morphed into a hex editor.
So my machine survives. It just takes some time to display, alerting me to the issue. It usually opens instantly. I said my machine survives, but the scenario is clear. If someone happens to open a video file named 1short, or clash, or whatever combo yet undetermined, then they need to have that memory free, or maybe crash. What if that video file is many GB's? To answer any wondering, yes, it will open a 10GB file like a hex editor and display it, yes the temp file is the whole 10GB written out, yes it continues without issue and doesn't crash.... IF you have gobs of memory.
Some of the parsing section;
Code: Select all
if {[file isdirectory $basefile] == 1} {.f1.nb select .f1.nb.dir; ls1} else {}
# text as input
foreach {var} {.txt .conf .html .sh .tcl .tk .genmon .qstat } {if {[regexp -- $var [file tail $basefile]] == 1} {.f1.nb select .f1.nb.text; popWord; .f1.nb.text.bcat invoke} else {}}
# text as input requiring root (or user is 'staff') ? chain onto regular text to just add pkexec mouepad buttoon?
foreach {var} {.conf .sh .tcl .tk .genmon .qstat } {if {[regexp -- $var [file tail $basefile]] == 1} { popCode; } else {}}
# pic as input
foreach {var} {.jpg .jpeg .png } {if {[regexp -- $var [file tail $basefile]] == 1} {.f1.nb select .f1.nb.media; popImage; .f1.nb.media.bminfo invoke
; if {[regexp -- png [file tail $basefile]] == 1} {popIrow2} else {}} else {}}
# audio as input
foreach {var} {.mp3 .m4a .aac .ac3 .wav .wma} {if {[regexp -- $var [file tail $basefile]] == 1} {.f1.nb select .f1.nb.media; popAudio; } else {}}
# video as input
foreach {var} {.dv .mpg .mpeg .mkv .m4v .avi} {if {[regexp -- $var [file tail $basefile]] == 1} {.f1.nb select .f1.nb.media; popVideo; } else {}}
# qcow2 as input, already above
# /dev/disk/ as input
if {[regexp -- disk [file dirname $basefile]] == 1} {.f1.nb select .f1.nb.cow} else {}
Modifying the {.dv .mpg etc} part doesn't change the error, eliminating popVideo that populates video specific functions doesn't help either. Non-video filetypes which are mostly doing the same thing are not affected.
It seems restricted to video files with some "sh" combo in the name. I'm baffled.
So, I think, test, wonder, think..watch bees in the garden...
In that parsing code if it finds a *.sh it sets up the text handling part of herder.tk. It also invokes a 'cat' of the file and displays it...hmmm. Yes, that's it. Why? it picks up the 'sh' in only odd combos and interprets it as ".sh" and I included the dot that tcl/tk apparently ignores! I leave out the first .sh reference, and leave the second, the the issue disappears since it no longer cats a massive file.
So, fixable but I'd like it to do correctly for a *.sh file and cat the contents for instant display without an extra click...
Takeaway? My non-malicious friendly well intention code could blow up your computer!