Tiny Core Extensions > TCE Bugs
wbar.tcz bug and fix
gadget42:
had tcl-13x handy so am looking at wbar_update.sh
#!/bin/sh
# (c) Robert Shingledecker 2010
# Called from desktop.sh to update wbar icons.
does the above first three lines in the file mean that this has remained unchanged since 2010?
and if so then i must ask why change it now, especially when someone threw a curve-ball at it?
i know in the wider tech world there is a never-ending drive to catch _ALL_ the corner/edge cases, but do we need/want to march to that tune? where does it end? who/whom _draws_the_line_?
i suppose not having a BDFL has its pros and cons.
(i favor well-considered consensus to be more/mostly beneficial to the greater utility)
GNUser:
--- Quote from: gadget42 on October 30, 2024, 08:17:11 AM ---i know in the wider tech world there is a never-ending drive to catch _ALL_ the corner/edge cases, but do we need/want to march to that tune?
--- End quote ---
Of course not. That's why we use TCL ;D
--- Quote from: gadget42 on October 30, 2024, 08:17:11 AM ---and if so then i must ask why change it now, especially when someone threw a curve-ball at it?
--- End quote ---
It was the script that threw a curveball, failing in a mysterious way. It has most likely failed in this way before (and will again unless we fix it), but whoever was affected before was not as OCD as me and just moved along rather than troubleshooting. IMHO obvious bugs/unexpected behaviors should be fixed regardless of how old the script is.
--- Quote from: gadget42 on October 30, 2024, 08:17:11 AM ---who/whom _draws_the_line_?
--- End quote ---
In TCL, the TCL developers draw the line (fortunately). Time has shown that the TCL developers have good instincts and know which features/fixes have value and which ones are bloat.
GNUser:
FWIW I favor the solution I proposed in the first post of the thread. It is explicit and does nothing more than fix the relevant issue.
Rich:
Hi GNUser
First let me start out by saying I was not criticizing, judging, or
objecting to your proposed changes. Just sharing some tools
for your toolbox.
A couple of notes.
First, using echo also compresses multiple spaces between words:
--- Code: ---tc@E310:~$ Var1=" Too many spaces "
tc@E310:~$ echo "$Var1"
Too many spaces
tc@E310:~$ echo $Var1
Too many spaces
--- End code ---
Second, it seems I was late to the party. Roberts already incorporated
a trim function in tc-functions dating back to at least TC3:
--- Code: ---tc@E310:~$ grep trim /etc/init.d/tc-functions
trim() { echo $1; }
tc@E310:~$ trim "$Var1"
Too many spaces
tc@E310:~$
--- End code ---
--- Quote from: GNUser on October 30, 2024, 06:31:08 AM --- ... Rich's idea of removing leading whitespace, trailing whitespace, and blank lines before parsing the .desktop file is very tempting. ...
--- End quote ---
Actually, I wasn't suggesting that. It would mean replacing the symlinks with copies of the files.
However, it might be worth adding to submitqc.
--- Quote from: gadget42 on October 30, 2024, 08:17:11 AM --- ... there is a never-ending drive to catch _ALL_ the corner/edge cases, ...
--- End quote ---
I would not call this a corner case. Excess whitespace is invisible when not bracketed by
printable characters and would go unnoticed. Most commands would ignore it and it would
not matter. When it occurs in a string being searched for, it does matter.
GNUser:
Hi Rich.
--- Quote from: Rich on October 30, 2024, 11:20:32 AM ---First let me start out by saying I was not criticizing, judging, or
objecting to your proposed changes. Just sharing some tools
for your toolbox.
--- End quote ---
Oh, I know. I appreciate all the tools. Thank you.
--- Quote from: Rich on October 30, 2024, 11:20:32 AM ---Actually, I wasn't suggesting that. It would mean replacing the symlinks with copies of the files.
--- End quote ---
Right. I don't like the idea. Creating a temporary "fixed" .desktop file (as much as I dislike the idea) would be better than replacing the symlinks in /usr/local/share/applications with files.
--- Quote from: Rich on October 30, 2024, 11:20:32 AM ---it seems I was late to the party. Roberts already incorporated
a trim function in tc-functions dating back to at least TC3:
--- Code: ---tc@E310:~$ grep trim /etc/init.d/tc-functions
trim() { echo $1; }
tc@E310:~$ trim "$Var1"
Too many spaces
tc@E310:~$
--- End code ---
--- End quote ---
Well, look at that! Maybe I can tweak my initial proposal to use this little function rather than sed. The fact that it is called "trim" makes it less cryptic than using just a plain echo to accomplish this.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version