bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building loadable builtin


From: Chet Ramey
Subject: Re: Building loadable builtin
Date: Thu, 14 Apr 2022 14:39:38 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

On 4/14/22 12:52 PM, Robert E. Griffith wrote:
I am developing a loadable builtin and I have a question about building it for distribution.

I am currently building it in the "Bash-5.0 patch 17" git commit and it works fine when I run it in the bash executable built from that same commit (5.0.17(4)) but it fails when I run it in the bash from the Ubuntu 20.04 repository which is almost the same version 5.0.17(1).

    *bobg@goodplace:~/github/bashParse/examples/loadables$*  ./ooTest.sh
    5.0.17(1)-release
    bash: symbol lookup error: ./_bgclassCallSetup: undefined symbol:
    sh_xmalloc
   *bobg@goodplace:~/github/bashParse/examples/loadables$*  ../../bash ./ooTest.sh
    5.0.17(4)-release
    iamgrut _OID='myObj' _CLASS='MyObject'
    declare -- this="myObj"

Question 1: what is the meaning of the (1) or (4) at the end of the bash version?

It's a count of the number of times that version of bash has been built in
that particular build directory.


Question 2: is this (...undefined symbol: sh_xmalloc) error indicative of a compiler/link option mismatch and what would it be?

Bash has a number of optional features that you can build in or out,
specified at configuration time. One of those options is to build bash
using the version of malloc shipped with the bash source (lib/malloc)
instead of the system malloc in  libc. Doing that enables malloc tracing
using a wrapper function named sh_xmalloc.

It looks like you built bash with the default options and Debian/Ubuntu
built the version they distribute without the bash malloc.


Question 3: what is the best practice for maintaining loadable builtins? Can anyone suggest an existing loadable builtin project that I could model mine after?

There is no real best practice. You can model yours after the template in
examples/loadables/template.c or examples/loadables/hello.c.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]