Skip to content

Enhancement: Write bpkg in terms of POSIX sh #90

Open

Description

@mcandre

bpkg is amazing, would be great for managing zsh and ksh scripts as well! What do you think of writing bpkg's internals in terms of POSIX sh, so that bash isn't actually required for bpkg?

For example, [[ -f "$CONFIG_FILE" ]] could be accomplished with test -f "$CONFIG_FILE"

Activity

  1. jwerle commented on Aug 8, 2017

    @jwerle
    Member

    @mcandre i love that idea! we'd happily accept a PR

  2. mcandre commented on Aug 8, 2017

    @mcandre
    Author

    :)

    As a prototype, I pushed https://github.com/mcandre/shaggy . Functionality is rather basic, but it shows what is possible with pure POSIX sh, and what the syntax looks like. Also features an example of checkbashisms, a linter that helps to warn on the presence of bash-specific code, for projects where you want to distinguish between bash and POSIX sh code.

  3. jwerle commented on Aug 8, 2017

    @jwerle
    Member

    @mcandre very nice :]

  4. Potherca commented on Oct 3, 2017

    @Potherca
    Member

    If the workload to make bpkg POSIX compliant is too large, I wouldn't mind donating some time to help.

    Just a thought but would it be useful to use BASH POSIX mode (with set -o posix) to migrate to POSIX in increments?

    Similar to checkbashisms, shellcheck can be made to check scripts for POSIX compliance by using the flag -s sh .


    Obligatory links to https://wiki.ubuntu.com/DashAsBinSh and http://mywiki.wooledge.org/Bashism after mention of POSIX portability and bashisms

  5. jwerle commented on Oct 3, 2017

    @jwerle
    Member

    @Potherca sounds good to me. we'd happily accept a PR!

  6. hyperupcall commented on Aug 25, 2023

    @hyperupcall
    Member

    In general, porting Bash shell code to POSIX-compliant shell code negatively impacts performance. Bash has more features under variable expansion and flags to builtins that would otherwise require costly subshells or running external programs. We do have some documented performance issues at #129, so I'm not sure this is the right way to go usability and performance-wise. So in my opinion, I'm inclined to close this issue. Not sure what else has changed since 2017.

  7. Potherca commented on Sep 27, 2023

    @Potherca
    Member

    As per #122 I would rather spend energy on stability (i.e. tests) and usability (docs, installation, publishing) before moving on to portability.

  8. samlikins commented on Sep 27, 2023

    @samlikins
    Member

    @Potherca, I currently have a significant number of tests that I've created for a large amount of the project (using shUnit2). Sadly got a denser workload right now, so had to put it on pause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions