Skip to content

Running Package Builds with OSH

Samuel Hierholzer edited this page May 17, 2025 · 5 revisions

This document describes issues and notes on running OSH as Shell replacement in package building (either as /bin/bash and/or /bin/sh)

Nixpkgs

Oily Nixpkgs is an attempt at replacing bash with Oils in the stdenv.

Bugs/incompatibilities with nixpkgs (closed means it's fixed. TODO means there is a workaround in place)

  • zulip, PR - "${a[@]+default}" doesn't properly expand as bash
  • zulip, commit - ${mystr[@]} errors (e.g. it's a string) are often silent in bash
  • zulip, commit - :& and ;;& in a case statement are missing in Oils
  • zulip, commit - export x; x=(a b c) fails as only strings can be exported
  • zulip - let is not implemented
    • Workaround (( EXPR )) | true, path in oily-nixpkgs
  • zulip, zulip thread - Oils requires quotes in certain assoc array expansions, e.g. ${myarr[a]-} needs to be ${myarr['a']} in Osh. See also blog post
    • patch in oily-nixpkgs
  • [[ -v assoc[arr] ]] failed silently. Fixed but need to find link in zulip
  • zulip, gh issue, certain [[ ... =~ ... ]] are a syntax err in Oils
  • zulip, commit if (( )); then doesn't work on bash
    • sane alternative: if (( 0 ));
  • zulip - (( a ) b ) is parsed as arithmetic in Osh ending in a syntax err instead of as nested subshells
  • zulip Bug with IFS=\
    • TODO (fixed with check_ifs_backshlash_broken=:
  • zulip read -u $FD is not implemented (fix: read <&$FD)
  • zulip commit nested make in different directory fails with Directory not found

Alpine

Oily Pine is an attempt at replacing /bin/sh and /bin/bash with Oils using the package in testing which provides packages oils-for-unix-binsh and oils-for-unix-bash.

Bugs/incompatibilities with nixpkgs (closed means it's fixed. TODO means there is a workaround in place)

  • zulip commit Repro of nested make in different directory fails with Directory not found found in nixpkgs
  • zulip =word is a parsing error in OSH (should return =word command not found when executed - shopt -s strict_eval should be ysh only)

Related: Running ble.sh with OSH

Clone this wiki locally