Tiny Core Base > TCB Bugs

bug in depends-on.sh (and fix)

(1/2) > >>

GNUser:
I found a bug in depends-on.sh:


--- Code: ---$ depends-on.sh unbound
getdns.tcz
unbound-dev.tcz
--- End code ---

The output is incorrect because prosody.tcz depends on unbound.tcz, so should appear in the command's output.

I found many other instances of unexpected behavior. Just one more example:

--- Code: ---$ depends-on.sh protobuf-c

[no hits]

--- End code ---
That's also incorrect. protobuf-c-dev.tcz should have been a hit because it depends on protobuf-c.tcz.

After close inspection of dep.db and much head-scratching, I discovered the problem: The default (exact match) searches fail when the lines with expected matches have trailing whitespace. Brutal.

There are at least two ways to fix this:
1. Make the logic in awk more complex so that exact searches can deal with trailing whitespace in dep.db
2. Remove trailing whitespace from dep.db before searching

Option #2 seems more obvious and straight-forward, so I went with that:
https://github.com/tinycorelinux/Core-scripts/pull/75/commits/8e84f192359af77ab7806389768d46897a0b57bc




Rich:
Hi GNUser
I just checked TC16 x86_64 dep.db:

--- Code: ---rich@tcbox:~$ grep -E ".* +$" dep.db
rich@tcbox:~$
--- End code ---
I couldn't find any trailing whitespace.

GNUser:
Hi Rich. Wow, my head is spinning. You're right!

I use a local mirror. It's exactly like the official repo except that I add a few custom extensions into it and have a shell script that adds my custom extensions to the local mirror's metadata files (e.g., dep.db). It seems my shell script is the culprit--it must be inadvertently adding trailing whitespace :(

Sorry for the noise.

Rich:
Hi GNUser

--- Quote from: GNUser on March 24, 2025, 07:22:49 PM ---Hi Rich. Wow, my head is spinning. You're right! ...
--- End quote ---

Well, I never doubted you for a second. That's why I triple checked by also
examining dep.db in the TC15 and TC14 repos before saying anything. :)

gadget42:
@GNUser, would be interested in your final disposition on this when you get it sorted. Thanks!

Navigation

[0] Message Index

[#] Next page

Go to full version