mainThe GNU Bourne-Again SHell - Support: sr #110559, Reloading loadables not working


sr #110559: Reloading loadables not working

Submitter:  Dominik Kummer <domson>
Submitted:  Thu 04 Nov 2021 04:00:08 PM UTC
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 05 Nov 2021 03:06:55 PM UTC, comment #7: 

I see. local_dlclose() is just a wrapper to deal with different versions of dlcose() (mostly older versions) having different return values.

Chet Ramey <chet>
Group administrator
Fri 05 Nov 2021 02:45:03 PM UTC, comment #6: 

Ah nice, I still use 5.1.8. but it can wait.

Ok I see! I thought it has to do with local_dlclose also. So I will add dlclose to my loadables as needed. I think I will port picohttpparser, Strozzi NoSQL and Starbase to bash loadables too! :-D
Such an awesome thingy these loadables! Took me years to find out about it.

Thank you for the great work and support Chet!

Dominik Kummer <domson>
Fri 05 Nov 2021 02:39:37 PM UTC, comment #5: 

Bash-5.2 will use that proposed shortcut. If `enable bname' doesn't succeed (bname is not a current builtin), enable will
try the equivalent of `enable -f bname bname'.

Chet Ramey <chet>
Group administrator
Fri 05 Nov 2021 02:29:41 PM UTC, comment #4: 

I'm not sure what you mean about dlclose(). It's a libc function.

If it's present and working, and configure can find it, bash will use it. It's not something that loadable builtins have to provide.

Chet Ramey <chet>
Group administrator
Fri 05 Nov 2021 02:19:24 PM UTC, comment #3: 

it is off topic, but I ask anyway.

If BASH_LOADABLES_PATH is given a valid path, shouldn't

$ enable bperl

be sufficient? instead of

$ enable -f bperl bperl

its actually just cosmetics.

Dominik Kummer <domson>
Fri 05 Nov 2021 02:12:28 PM UTC, comment #2: 

Oh thats perfect!!

It seems that examples/loadables do not show any use case of dlclose(handle)

In fact I cannot find any use case to rely on in bash source at all. but the function is in enable.def.

Should all loadable builtins have a working dlclose?

Dominik Kummer <domson>
Fri 05 Nov 2021 02:01:49 PM UTC, comment #1: 

It works if you have a working dlclose() and the reference count for the shared object is 1.

It works for me on macOS and Linux (Solus).

Chet Ramey <chet>
Group administrator
Thu 04 Nov 2021 04:00:08 PM UTC, original submission:  


$ enable -f /lib/bash/myloadable myloadable

does work. But as soon as a new version of myloadable is installed, I would like to reload the builtin with:

$ enable -d myloadable
$ enable -f /bash/myloadable myloadable

but the builtin is not reloaded.

is this even possible with shared libraries?

Dominik Kummer <domson>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by domson (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-05 chet StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-1277.
    Corresponding source code