• The forum software that supports hummy.tv has been upgraded to XenForo 2.3!

    Please bear with us as we continue to tweak things, and feel free to post any questions, issues or suggestions in the upgrade thread.

Developers' corner

Apparently the expression evaluator doesn't know about $(...), whether accidentally or by design. I guess there is some processing to parse $(...) in the top level of Jim parsing that is not available when an expression is parsed. You might compare it with a C preprocessor macro.
 
It would seem to be this (expr sugar) at line 9107 in jim.c:
C:
        case '$':
            if (JimParseVar(pc) == JIM_ERR)
                return JimParseExprOperator(pc);
            else {
                /* Don't allow expr sugar in expressions */
                if (pc->tt == JIM_TT_EXPRSUGAR) {
                    return JIM_ERR;
                }
                return JIM_OK;
            }
            break;
Bypassing the JIM_ERR return makes some things work, but breaks others.
The annoying thing is that the documentation says "Jim supports a shorthand syntax for expr as $(...)" and "...are identical", when clearly they are not.
 
Speaking of Jim, has anyone got any comments about what's going on here, as $(x) is supposed to be equivalent to [expr {x}]
It looks to be something related to nesting expressions. If you're in an if block then you're already in an expression, and so this works.
Code:
. if { 3 - 1 == 2 } { puts "true" }
true

From your other examples, it looks like you can't embed the $() form inside an existing expression. I'll be interested to see what the author says.
 
Here's Steve's description of the $() syntax with a link to some discussion of possible expr syntax shortcuts for real TCL, including the announcement of $(). $[] might have been more acceptable and just as easy to add.
 
A few questions on esoteric Humax programming issues:

  1. Is there anyway to modify or cancel a recording schedule entry once it has past the recording time has started (even if the recording is not actually recording) other than using the IR stop button which is not easy to do programmatically.
  2. Is there any way to determine how long a recording started using the IR record button has been scheduled for - there is no entry created in the rsv.db for such recordings and no entry in the timer list.
  3. nugget recordings or nugget tuners.dump shows the name of the file holding the recording but as I far as I can tell no link to the corresponding reservation entry, channel, end time etc. In schedchk I have to match programme name in reservation against file name to see if a scheduled entry is actually recording which seems somewhat clumsy.
One of the things that annoys me about the Humax is that while it automatically restarts after some crashes it does not restart any recordings that were active at the time of the crash. I'm looking at updating schedchk to detect, at startup, recordings that were in progress and restart them to minimise the lost recording time, and also to detect and restart zero length recordings.
I can attempt to reschedule recordings where there is a repeat in the schedule but too often there are no repeats.
 
On another topic:
Code:
# git add -i
fatal: 'add--interactive' appears to be a git command, but we were not
able to execute it. Maybe git-add--interactive is broken?
It would be better if "we" were able to execute it. But apparently it's a Perl script, and needs some Git module that won't be available.

Also, the git package populates /mod/libexec/git-core/ with dozens of apparently identical executables of size 4337032 that ought to be linked but aren't (1 hard link each).
 
Last edited:
Presumably you can spawn an ir command?
Yes, but if you have two recordings in progress you get the pop-up asking you which you want to cancel and it becomes virtually impossible to specify which you want to cancel plus if SWBO is playing a recording you will cancel that instead :frantic:
 
the git package populates /mod/libexec/git-core/ with dozens of apparently identical executables of size 4337032 that ought to be linked but aren't
I wonder if any of the that stuff is actually used. Same with the stuff in /mod/share . No wonder the package size is so horrendous. Probably only uses the one file /mod/bin/git
 
I assume that running (eg) git add ... invokes /mod/libexec/git-core/git-add ... and the processing uses args[0] to control which subcommand is being run.

Here's an equivalent Ubuntu git installation (2.43):
Code:
$ ls -l $(which git)
-rwxr-xr-x 1 root root 4105020 Nov 22 19:16 /usr/bin/git
$ ls -l /usr/lib/git-core/
total 25628
-rwxr-xr-x 1 root root 4105020 Nov 22 19:16 git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-add -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-am -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-credential-store -> git
-rwxr-xr-x 1 root root 2417172 Nov 22 19:16 git-daemon
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-describe -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-difftool -> git
-rwxr-xr-x 1 root root    2609 Nov 22 19:16 git-difftool--helper
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-diff-tree -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-fetch-pack -> git
-rwxr-xr-x 1 root root   15857 Nov 22 19:16 git-filter-branch
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-fmt-merge-msg -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-hook -> git
-rwxr-xr-x 1 root root 2409044 Nov 22 19:16 git-http-backend
-rwxr-xr-x 1 root root 2450308 Nov 22 19:16 git-http-fetch
-rwxr-xr-x 1 root root 2462692 Nov 22 19:16 git-http-push
-rwxr-xr-x 1 root root 2454756 Nov 22 19:16 git-imap-send
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-index-pack -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-init -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-init-db -> git
-rwxr-xr-x 1 root root   22161 Nov 22 19:16 git-instaweb
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-interpret-trailers -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-merge-index -> git
-rwxr-xr-x 1 root root    2477 Nov 22 19:16 git-merge-octopus
-rwxr-xr-x 1 root root    3695 Nov 22 19:16 git-merge-one-file
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-merge-ours -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-merge-recursive -> git
-rwxr-xr-x 1 root root    1226 Nov 22 19:16 git-merge-resolve
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-merge-subtree -> git
-rwxr-xr-x 1 root root   11693 Nov 22 19:16 git-mergetool
-rw-r--r-- 1 root root   10728 Nov 22 19:16 git-mergetool--lib
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-merge-tree -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-push -> git
-rwxr-xr-x 1 root root    3693 Nov 22 19:16 git-quiltimport
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-range-diff -> git
...
lrwxrwxrwx 1 root root      15 Nov 22 19:16 git-remote-ftps -> git-remote-http
-rwxr-xr-x 1 root root 2470820 Nov 22 19:16 git-remote-http
lrwxrwxrwx 1 root root      15 Nov 22 19:16 git-remote-https -> git-remote-http
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-repack -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-replace -> git
-rwxr-xr-x 1 root root    4147 Nov 22 19:16 git-request-pull
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-rerere -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-send-pack -> git
-rwxr-xr-x 1 root root 2400660 Nov 22 19:16 git-shell
-rw-r--r-- 1 root root    1683 Nov 22 19:16 git-sh-i18n
-rwxr-xr-x 1 root root 2400596 Nov 22 19:16 git-sh-i18n--envsubst
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-shortlog -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-show-ref -> git
-rw-r--r-- 1 root root   18372 Nov 22 19:16 git-sh-prompt
-rw-r--r-- 1 root root    8398 Nov 22 19:16 git-sh-setup
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-sparse-checkout -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-stripspace -> git
-rwxr-xr-x 1 root root   10508 Nov 22 19:16 git-submodule
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-submodule--helper -> git
-rwxr-xr-x 1 root root   25019 Nov 22 19:16 git-subtree
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-switch -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-upload-pack -> git
...
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-version -> git
-rwxr-xr-x 1 root root    4401 Nov 22 19:16 git-web--browse
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-whatchanged -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-worktree -> git
lrwxrwxrwx 1 root root       3 Nov 22 19:16 git-write-tree -> git
drwxr-xr-x 2 root root    4096 Nov 28 02:12 mergetools
-rwxr-xr-x 1 root root 2443972 Nov 22 19:16 scalar
$ cmp /usr/bin/git /usr/lib/git-core/git || echo different
$
The mergetools directory contains scripts to launch various diff/merge UI tools.

git add --interactive appears to be run via git-add with no Perl script.
 
git-add--interactive is on my Linux PC in /usr/lib/git-core/ but doesn't exist on the Humax, which is presumably why it doesn't work.
It is a Perl script which starts:
Code:
#!/usr/bin/perl

use lib (split(/:/, $ENV{GITPERLLIB} || '/usr/share/perl5'));

use 5.008;
use strict;
use warnings;
use Git qw(unquote_path);
use Git::I18N;

binmode(STDOUT, ":raw");

my $repo = Git->repository();
I've no idea about Perl at all. Would this transfer and run presumably just changing /usr to /mod ?

I've repacked the git package to use hard links as suggested, and it is now 1/15th the size and installs in about 30s compared to several minutes. There was also a random core file in the package which seemed weird, so I've deleted that too.
It's in the Beta repository now if anyone would care to try it.
 
Yes, there are (at least) 2 packages, but unlike the CF python the Perls don't come with a standard library that has wide functionality. So useful Perl packages need external modules: because Perl is pretty much a text processor with pretensions these modules are often written in some more capable programming language, C or C++, say, but the Perl import mechanism that builds the module on-box doesn't work. And this is why get_iplayer was rejected in favour of youtube-dl. (The equivalent Python mechanism doesn't work either, which is why we can't install a more modern ssl module and the CF youtube-dl fork has to invoke wget for network access).

As I originally noted:
... But apparently [git-add--interactive is] a Perl script, and needs some Git module that won't be available.

But the script version seems to have been superseded in the git version that I have on the laptop. Maybe a newer version can be built. Apparently (bullet 4) even 2.26 might solve the problem with the right settings.
 
Maybe a newer version can be built.
If anyone knew how, since there are absolutely no instructions. Cobbling things together, I ended up runing autoconf and make and then guessing at what -dev packages to install based on what error the build chucked out. Eventually that produced a load of binaries in the same directory as the source. How anyone is supposed to sort out this mess is beyond me, but it seems a fairly common thing to do amongst lazy developers.
I tried to find another make target other than install which looked as though it might do something to build an installable package of some/any sort, but failed.
This was all on x86 of course. The usual things you feed to configure to make it cross-compile seem not to work. I then hacked at config.mak.autogen to bodge in compilers and options etc. but it just dies with millions of warnings about f* knows what.
I then tried it on the Humax and it dies even trying to clone the repository:
Code:
humax# git clone https://github.com/git/git/
Cloning into 'git'...
remote: Enumerating objects: 358413, done.
remote: Counting objects: 100% (652/652), done.
remote: Compressing objects: 100% (325/325), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
I give up with this stuff.
 
I suppose the build parameters weren't uploaded by the original dev (it was only 2020)?

The top SO answer suggests that the problem is too much history. Although it didn't suggest this specific solution, I tried ignoring stuff from before 2.25:
Code:
humax# git clone --shallow-since 2020-01-01 'https://github.com/git/git.git'
Cloning into 'git'...
remote: Enumerating objects: 87827, done.
remote: Counting objects: 100% (87827/87827), done.
remote: Compressing objects: 100% (31659/31659), done.
remote: Total 87827 (delta 67735), reused 74648 (delta 55743), pack-reused 0
Receiving objects: 100% (87827/87827), 83.53 MiB | 356.00 KiB/s, done.
Resolving deltas: 100% (67735/67735), done.
Checking connectivity: 87644, done.
Updating files: 100% (4411/4411), done.
humax#
This took a big chunk of an hour and the "Checking connectivity" stage broke up the TV picture a bit.

And then with my first guess at a config (at least the first that told make where to find the compiler) all the .c files compile but linking loses, so at least two items need to be tweaked: solved in post #42.
 
Last edited:
I have some notes from 2020, I don't know if they'll work with newer versions. This is for cross compiling from a Linux host.

Code:
CC='mipsel-linux-gcc' \
CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \
LDFLAGS="-Wl,-R/mod/lib" \
CURL_LDFLAGS="-L/opt/toolchains/hdr/lib -lcurl" \
./configure \
        --prefix=/mod \
        --host=mipsel-linux \
        --target=mipsel-linux \
        --without-tcltk \
        --with-iconv=no \
        --with-curl=/opt/toolchains/hdr \
        --with-openssl=/opt/toolchains/hdr \
        CURL_LDFLAGS=-lcurl \
        ac_cv_fread_reads_directories=no \
        ac_cv_snprintf_returns_bogus=no

make CURL_LDFLAGS=-lcurl

Where /opt/toolchains/hdr on this box is a symlink /opt/toolchains/hdr -> crosstools_hf-linux-2.6.18.0_gcc-4.2-11ts_uclibc-nptl-0.9.29-20070423_20090508/mipsel-linux-uclibc/
 
The old version built OK with this (just downloaded the v2.25.1.zip).
The new one (master, cloned with --depth 1) needs a couple more things: -std=gnu99 -D__FORCE_NOGLIBC
and a fix for some "inline" use-before-definition stupidity in remote.c which generates a warning. Otherwise builds clean.
Code:
humax ~ # git --version
git version 2.25.1
humax ~ # /tmp/git --version
git version 2.43.0.dirty
humax /mnt/hd2/mod/git/hummypkg/webif # /tmp/git add -i

*** Commands ***
  1: status       2: update       3: revert       4: add untracked
  5: patch        6: diff         7: quit         8: help
What now> 7
Bye.
Still not sure how you know what to copy to build the package though, other than laborious manual guesswork based on build timestamps.
 
Back
Top