WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: submitqc not invoking ldd correctly?  (Read 137 times)

Offline vext01

  • Newbie
  • *
  • Posts: 22
submitqc not invoking ldd correctly?
« on: June 11, 2026, 05:04:16 PM »
I notice ldd borks in submitqc:

Code: [Select]
$ submitqc --libs
...
submitqc: gmid.tcz list file looks ok? Ok.
submitqc: gmid.tcz comparing list to mirror copy. Not on mirror.
submitqc: gmid.tcz dep file includes all necessary libraries? ldd: missing file arguments
Try `ldd --help' for more information.
Ok!
submitqc: gmid.tcz info file structure ok? Ok.
submitqc: gmid.tcz contains redundant dependencies (extension families) in .dep file ? No redundant dependencies found in gmid.tcz.dep file.

Thought the devs might like to know.

This is on:
NAME=piCore
VERSION="16.0"

And submitqc as of now (51726af5241)

Cheers

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12842
Re: submitqc not invoking ldd correctly?
« Reply #1 on: Today at 01:11:55 AM »
Hi vext01
...
Code: [Select]
----- Snip -----
submitqc: gmid.tcz dep file includes all necessary libraries? ldd: missing file arguments
Try `ldd --help' for more information.
 ----- Snip -----
Took me a while to figure out where those ldd messages might
be coming from. The stock ldd command does not contain any
of those messages.

glibc_apps has an ldd that does contain those messages. That
ldd relies on bash to run.

Here's where it gets interesting. Both the stock and the glibc_apps
ldd versions are listed as  /usr/bin/ldd. However, when you install
an extension that contains a file that already exists, it's not supposed
to overwrite it with its own version.

Running the glibc_apps ldd without a target produces this:
Code: [Select]
tc@HP-G62:~$ /tmp/tcloop/glibc_apps/usr/bin/ldd
ldd: missing file arguments
Try `ldd --help' for more information.
tc@HP-G62:~$

Running the stock ldd without a target produces this:
Code: [Select]
tc@HP-G62:~$ /usr/bin/ldd
tc@HP-G62:~$

So my questions are:
1. Do you have glibc_apps installed?
2. Did the glibc_apps version of ldd replace the stock version?
3. If you don't install glibc_apps, does submitqc --libs run normally?

Offline vext01

  • Newbie
  • *
  • Posts: 22
Re: submitqc not invoking ldd correctly?
« Reply #2 on: Today at 04:00:15 AM »
You've nailed it!

Quote
1. Do you have glibc_apps installed?

Yes, getlocale.tcz pulled it in.

Quote
2. Did the glibc_apps version of ldd replace the stock version?

Yes, but only after a reboot, which is curious. Check this out (I started without glibc_apps installed):

Code: [Select]
$ ldd
$ which ldd
/usr/bin/ldd
$ md5sum /usr/bin/ldd
d35d59f5e43a68d10895dfc70ad4fc65  /usr/bin/ldd
$ tce-load -i glibc_apps
bash.tcz: OK
glibc_apps.tcz: OK
$ ldd
$ which ldd
/usr/bin/ldd
$ md5sum /usr/bin/ldd
d35d59f5e43a68d10895dfc70ad4fc65  /usr/bin/ldd
$ echo "glibc_apps.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
$ sudo reboot
... system reboots ... wait for it to come up and ssh back in
$ ldd
ldd: missing file arguments
Try `ldd --help' for more information.
$ which ldd
/usr/bin/ldd
$ md5sum /usr/bin/ldd
c514c1d37215c3820d676919c0c1d16a  /usr/bin/ldd

Quote
3. If you don't install glibc_apps, does submitqc --libs run normally?

It does!

Code: [Select]
...
submitqc: tmux.tcz list file looks ok? Ok.
submitqc: tmux.tcz comparing list to mirror copy. Not on mirror.
submitqc: tmux.tcz dep file includes all necessary libraries? Ok!
submitqc: tmux.tcz info file structure ok? Ok.
...

So there's your bug: under some circumstances an extension can replace a TCB binary!
« Last Edit: Today at 04:02:45 AM by vext01 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12842
Re: submitqc not invoking ldd correctly?
« Reply #3 on: Today at 08:40:22 AM »
Hi vext01
...
Quote
2. Did the glibc_apps version of ldd replace the stock version?

Yes, but only after a reboot, which is curious. ...
That is curious. So I tried it on my TC14 x86_64 system and the
stock version of ldd was not replaced.

I then examined the root file system of piCore15 and found that
tce-setup was calling a python script:
Code: [Select]
        [ "$applist" ] && su "$USER" -c "/usr/bin/micropython /usr/bin/tce-bootload `dirname $1` $applist"
I don't speak python, but even I had some idea what was happening here:
Code: [Select]
                if copy2fsflg:
                        system_command('sudo busybox cp -r ' + root + '/tmp/tcloop/' + p[:-4] + '/* /', p[:-4])
                        system_command('sudo busybox.suid umount ' + root + '/tmp/tcloop/' + p[:-4], p[:-4])
                        system_command('sudo busybox rm -r -f ' + root + '/tmp/tcloop/' + p[:-4], p[:-4])
                else:                           
                        system_command('sudo busybox cp -r -f -s ' + root + '/tmp/tcloop/' + p[:-4] + '/* ' + root + '/', p[:-4])

I'm not sure how the cp command in the  if  clause will behave, but the cp
command in the else clause uses the -f flag to force an overwrite.

tce-load tries to preserve the original file (unless you pass it -f):
Code: [Select]
yes "$FORCE" | sudo /bin/cp -ais /tmp/tcloop/"$APPNAME"/* / 2>/dev/nullFORCE defaults to "no" unless you pass  -f  to  tce-load.

and the  -ais  flags preserve the existing files.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1576
Re: submitqc not invoking ldd correctly?
« Reply #4 on: Today at 01:28:58 PM »
I can look at the python script. but its just calling the same shell commands. piping yes/no to the command might need to be handled a little different though. 

but would it also mean that if bash was a dependency of glibc_apps.  It would work fine too.