help-bash
[Top][All Lists]
Advanced

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

Re: How to write a bash builtin compatible with version 3+


From: Chet Ramey
Subject: Re: How to write a bash builtin compatible with version 3+
Date: Sun, 10 Sep 2023 16:31:14 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

On 8/27/23 7:14 PM, Bren Eser wrote:
Hello,

I am in the process of writing a bash builtin which is compiled against
Bash 3. I am wondering if a builtin compiled against Bash 3 would work with
later versions of Bash.

It has the same restrictions as any other dynamic object: have any of
the functions it calls changed the ABI?


Would I need to compile the code against the version of bash that is
currently installed on a machine?

That's system-specific, but it's always the safest bet.

Would it be safe to assume a builtin
compiled against Bash 3 would work with Bash 5?  ( Ignoring different
machine architectures).

Depends on the ABI, as above.

What is the backward compatibility of Bash C
headers?

I don't change things very often, but the internal ABI does change
occasionally (as opposed to adding functions, which is an API change only).
It's mostly adding arguments to functions or changing argument types.
For instance, bash underwent a pretty significant set of int -> size_t
changes as the result of changes to support modern C versions.

The code is not relying heavily on bash API, only the interface for
builtin's that receives the word list.

That's not going to change.

Some functions including exit_shell
and finding/binding variables in shell is used with the builtin program.

exit_shell's not changing, but it's possible that functions to find and
bind variables have changed in the ten years between bash-3.2 and now.
It's hard to say without more information.

In the end, the best thing you can do is try it out.

--
``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]