Skip to content

Running Oils as build shell

Samuel Hierholzer edited this page Nov 4, 2024 · 4 revisions

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

Nixpkgs

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

Bugs/incompatibilities found with nixpkgs

  • 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](https://oilshell.zulipchat.com/#narrow/channel/307442-nix/topic/Assoc.20Array.20Quoting] - 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
Clone this wiki locally