diff --git a/.circleci/config.yml b/.circleci/config.yml index 69f492a2..ab3b84fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,24 +1,25 @@ version: 2.1 # Define the executor type +# https://circleci.com/docs/using-macos/ executors: - xcode10: + macos11: # macOS Version: 11.4.0 macos: - xcode: 10.3.0 # Mojave 10.14.4 - xcode11: + xcode: 12.5.1 + macos12: # macOS Version: 12.6 macos: - xcode: 11.7.0 # Catalina 10.15.5 - xcode12: + xcode: 14.2.0 + macos13: # macOS Version: 13.5.1 macos: - xcode: 12.5.1 # Big Sur 11.6.2 - xcode13: + xcode: 15.0.0 + macos14: # macOS Version: 14.3.1 macos: - xcode: 13.3.1 # Monterey 12.3.1 + xcode: 15.3.0 jobs: lint: docker: - - image: koalaman/shellcheck-alpine:v0.8.0 + - image: koalaman/shellcheck-alpine:v0.10.0 steps: - checkout - run: shellcheck shellspec $(find lib libexec spec examples -name '*.sh') @@ -70,22 +71,22 @@ workflows: requires: - lint - report - daily_update_schedule: - jobs: - - lint - - coverage: - requires: - - lint - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - master - all-tests: - jobs: - - test: - matrix: - parameters: - os: [xcode10, xcode11, xcode12, xcode13] +# daily_update_schedule: +# jobs: +# - lint +# - coverage: +# requires: +# - lint +# triggers: +# - schedule: +# cron: "0 0 * * *" +# filters: +# branches: +# only: +# - master +# all-tests: +# jobs: +# - test: +# matrix: +# parameters: +# os: [macos11, macos12, macos13, macos14] diff --git a/.cirrus.yml b/.cirrus.yml index c572efde..d5dee446 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,11 +1,13 @@ env: FORCE_COLOR: 1 +# https://cirrus-ci.org/guide/FreeBSD/ freebsd_task: freebsd_instance: matrix: - - image_family: freebsd-12-3 - - image_family: freebsd-13-0 + - image_family: freebsd-13-3 + - image_family: freebsd-14-1 + - image_family: freebsd-15-0-snap install_script: pkg install -y dash bash zsh ksh93 mksh oksh prepare_script: - ./shellspec --task fixture:stat:prepare diff --git a/.dockerignore b/.dockerignore index fddeaefd..de5bb03b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,3 +17,4 @@ helper/fixture/stat/* !Makefile !package.json !*.sh +!.shellcheckrc diff --git a/.github/workflows/dragonflybsd-6.4.yml b/.github/workflows/dragonflybsd-6.4.yml new file mode 100644 index 00000000..62950f67 --- /dev/null +++ b/.github/workflows/dragonflybsd-6.4.yml @@ -0,0 +1,23 @@ +name: DragonFlyBSD 6.4 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + dragonflybsd-6_4: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/dragonflybsd-vm@v1 + with: + usesh: true + release: "6.4.0" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/freebsd-12.yml b/.github/workflows/freebsd-12.yml new file mode 100644 index 00000000..8d2b70f3 --- /dev/null +++ b/.github/workflows/freebsd-12.yml @@ -0,0 +1,23 @@ +name: FreeBSD 12 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + freebsd-12: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/freebsd-vm@v1 + with: + usesh: true + release: "12.4" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/freebsd-13.yml b/.github/workflows/freebsd-13.yml new file mode 100644 index 00000000..61f95d78 --- /dev/null +++ b/.github/workflows/freebsd-13.yml @@ -0,0 +1,23 @@ +name: FreeBSD 13 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + freebsd-13: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/freebsd-vm@v1 + with: + usesh: true + release: "13.3" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/freebsd-14.yml b/.github/workflows/freebsd-14.yml new file mode 100644 index 00000000..30a01ef8 --- /dev/null +++ b/.github/workflows/freebsd-14.yml @@ -0,0 +1,23 @@ +name: FreeBSD 14 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + freebsd-14: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/freebsd-vm@v1 + with: + usesh: true + release: "14.0" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/macos-catalina.yml b/.github/workflows/macos-monterey.yml similarity index 92% rename from .github/workflows/macos-catalina.yml rename to .github/workflows/macos-monterey.yml index e684c348..9f487f48 100644 --- a/.github/workflows/macos-catalina.yml +++ b/.github/workflows/macos-monterey.yml @@ -1,4 +1,4 @@ -name: macOS Catalina +name: macOS Monterey on: [push, pull_request] @@ -7,7 +7,7 @@ env: jobs: macos-catalina: - runs-on: macos-10.15 + runs-on: macos-12 if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: matrix: diff --git a/.github/workflows/macos-sonoma.yml b/.github/workflows/macos-sonoma.yml new file mode 100644 index 00000000..826e68ed --- /dev/null +++ b/.github/workflows/macos-sonoma.yml @@ -0,0 +1,24 @@ +name: macOS Sonoma + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + macos-catalina: + runs-on: macos-14 + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + - {shell: dash} + - {shell: bash} + - {shell: ksh} + - {shell: zsh} + fail-fast: false + steps: + - uses: actions/checkout@v2 + - run: ${{ matrix.shells.shell }} ./shellspec --shell "${{ matrix.shells.shell }}" --task fixture:stat:prepare + - run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/macos-ventura.yml b/.github/workflows/macos-ventura.yml new file mode 100644 index 00000000..124eed60 --- /dev/null +++ b/.github/workflows/macos-ventura.yml @@ -0,0 +1,24 @@ +name: macOS Ventura + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + macos-catalina: + runs-on: macos-13 + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + - {shell: dash} + - {shell: bash} + - {shell: ksh} + - {shell: zsh} + fail-fast: false + steps: + - uses: actions/checkout@v2 + - run: ${{ matrix.shells.shell }} ./shellspec --shell "${{ matrix.shells.shell }}" --task fixture:stat:prepare + - run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/netbsd-10.yml b/.github/workflows/netbsd-10.yml new file mode 100644 index 00000000..0f7a4d72 --- /dev/null +++ b/.github/workflows/netbsd-10.yml @@ -0,0 +1,23 @@ +name: NetBSD 10 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + netbsd-10: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/netbsd-vm@v1 + with: + usesh: true + release: "10.0" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/netbsd-9.yml b/.github/workflows/netbsd-9.yml new file mode 100644 index 00000000..25627031 --- /dev/null +++ b/.github/workflows/netbsd-9.yml @@ -0,0 +1,23 @@ +name: NetBSD 9 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + netbsd-9: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/netbsd-vm@v1 + with: + usesh: true + release: "9.3" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/openbsd7.3.yml b/.github/workflows/openbsd7.3.yml new file mode 100644 index 00000000..0471a4f0 --- /dev/null +++ b/.github/workflows/openbsd7.3.yml @@ -0,0 +1,24 @@ +name: OpenBSD 7.3 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + openbsd-7_3: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + - {shell: ksh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/openbsd-vm@v1 + with: + usesh: true + release: "7.3" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/openbsd7.4.yml b/.github/workflows/openbsd7.4.yml new file mode 100644 index 00000000..2cdeaa80 --- /dev/null +++ b/.github/workflows/openbsd7.4.yml @@ -0,0 +1,24 @@ +name: OpenBSD 7.4 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + openbsd-7_4: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + - {shell: ksh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/openbsd-vm@v1 + with: + usesh: true + release: "7.4" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/openbsd7.5.yml b/.github/workflows/openbsd7.5.yml new file mode 100644 index 00000000..38f3e78c --- /dev/null +++ b/.github/workflows/openbsd7.5.yml @@ -0,0 +1,24 @@ +name: OpenBSD 7.5 + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + openbsd-7_5: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + - {shell: ksh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/openbsd-vm@v1 + with: + usesh: true + release: "7.5" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/solaris-11.4.yml b/.github/workflows/solaris-11.4.yml new file mode 100644 index 00000000..deb6973e --- /dev/null +++ b/.github/workflows/solaris-11.4.yml @@ -0,0 +1,28 @@ +name: Solaris 11.4 + +on: [push, pull_request] + +env: + LANG: C + FORCE_COLOR: 1 + +jobs: + solaris-11_4: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: sh} + - {shell: ksh} + - {shell: bash} + - {shell: zsh} + - {shell: /usr/xpg4/bin/sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/solaris-vm@v1 + with: + usesh: true + release: "11.4" + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/ubuntu-jammy.yml b/.github/workflows/ubuntu-jammy.yml new file mode 100644 index 00000000..6f9d7c7b --- /dev/null +++ b/.github/workflows/ubuntu-jammy.yml @@ -0,0 +1,28 @@ +name: Ubuntu Jammy Jellyfish + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + ubuntu-jammy: + runs-on: ubuntu-22.04 + if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: + matrix: + shells: + - {shell: dash, package: dash} + - {shell: bash, package: bash} + - {shell: busybox ash, package: busybox} + - {shell: ksh, package: ksh} + - {shell: mksh, package: mksh} + - {shell: posh, package: posh} + - {shell: yash, package: yash} + - {shell: zsh, package: zsh} + fail-fast: false + steps: + - uses: actions/checkout@v2 + - run: sudo apt-get install -y ${{ matrix.shells.package }} + - run: sudo ${{ matrix.shells.shell }} ./shellspec --task fixture:stat:prepare + - run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh diff --git a/.github/workflows/ubuntu-bionic.yml b/.github/workflows/ubuntu-noble.yml similarity index 92% rename from .github/workflows/ubuntu-bionic.yml rename to .github/workflows/ubuntu-noble.yml index 79e26e77..f39e11a6 100644 --- a/.github/workflows/ubuntu-bionic.yml +++ b/.github/workflows/ubuntu-noble.yml @@ -1,4 +1,4 @@ -name: Ubuntu Bionic Beaver +name: Ubuntu Noble Numbat on: [push, pull_request] @@ -6,8 +6,8 @@ env: FORCE_COLOR: 1 jobs: - ubuntu-bionic: - runs-on: ubuntu-18.04 + ubuntu-noble: + runs-on: ubuntu-24.04 if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: matrix: diff --git a/.github/workflows/windows-busybox.yml b/.github/workflows/windows-busybox.yml index 4e0284cb..541128bc 100644 --- a/.github/workflows/windows-busybox.yml +++ b/.github/workflows/windows-busybox.yml @@ -23,6 +23,6 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v2 - - run: choco install -y --no-progress busybox --version=4487.0 + - run: choco install -y --no-progress busybox --version=5301.0 - run: busybox ${{ matrix.shells.shell }} ./shellspec --task fixture:stat:prepare - run: busybox ${{ matrix.shells.shell }} ./shellspec diff --git a/.shellcheck-version b/.shellcheck-version index b19b5211..bf057dbf 100644 --- a/.shellcheck-version +++ b/.shellcheck-version @@ -1 +1 @@ -v0.8.0 +v0.10.0 diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000..0b9bd325 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +disable=SC2317 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ddf2cf5e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: shell -os: linux -dist: bionic -addons: - apt: - update: true -jobs: - include: - - os: osx # macOS 10.10 Yosemite 2014-06 - osx_image: xcode6.4 - env: SHELLS="sh bash zsh ksh" - - os: osx # macOS 10.11 El Capitan 2015-06 - osx_image: xcode8 - env: SHELLS="sh bash zsh ksh" - - os: osx # macOS 10.12 Sierra 2016-06 - osx_image: xcode9.2 - env: SHELLS="sh bash zsh ksh" - - os: osx # macOS 10.13 High Sierra 2017-06 - osx_image: xcode10.1 - env: SHELLS="sh bash zsh ksh" - - os: osx # macOS 10.14 Mojave 2018-06 - osx_image: xcode10.2 - env: SHELLS="sh bash zsh ksh" -before_script: - - ./shellspec --shell sh --task fixture:stat:prepare -script: - - contrib/all.sh contrib/various_test.sh diff --git a/README.md b/README.md index 539eaaf7..724d0b7a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,32 @@ -# ShellSpec - -ShellSpec is a **full-featured BDD unit testing framework** for dash, bash, ksh, zsh and **all POSIX shells** that provides first-class features such as code coverage, mocking, parameterized test, parallel execution and more. It was developed as a dev/test tool for **cross-platform shell scripts and shell script libraries**. ShellSpec is a new modern testing framework released in 2019, but it's already stable enough. With lots of practical CLI features and simple yet powerful syntax, it provides you with a fun shell script test environment. +# ShellSpec: full-featured BDD unit testing framework + +ShellSpec is a **full-featured [BDD](https://en.wikipedia.org/wiki/Behavior-driven_development) unit testing framework** for dash, bash, ksh, zsh and **all POSIX shells** that provides first-class features such as code coverage, mocking, parameterized test, parallel execution and more. It was developed as a dev/test tool for **cross-platform shell scripts and shell script libraries**. ShellSpec is a new modern testing framework released in 2019, but it's already stable enough. With lots of practical CLI features and simple yet powerful syntax, it provides you with a fun shell script test environment. + +[![Ubuntu](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/ubuntu-jammy.yml?label=Ubuntu&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/ubuntu-jammy.yml) +[![macOS](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/macos-sonoma.yml?label=macOS&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/macos-sonoma.yml) +[![FreeBSD](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/freebsd-14.yml?label=FreeBSD&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/freebsd-14.yml) +[![NetBSD](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/netbsd-10.yml?label=NetBSD&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/netbsd-10.yml) +[![OpenBSD](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/openbsd7.5.yml?label=OpenBSD&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/openbsd7.5.yml) +[![DragonFlyBSD](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/dragonflybsd-6.4.yml?label=DragonFlyBSD&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/dragonflybsd-6.4.yml) +[![Solaris11](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/solaris-11.4.yml?label=Solaris11&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/solaris-11.4.yml)
+[![gitbash](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/windows-gitbash.yml?label=Windows%20(gitbash)&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/windows-gitbash.yml) +[![cygwin](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/windows-cygwin.yml?label=Windows%20(cygwin)&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/windows-cygwin.yml) +[![msys](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/windows-msys.yml?label=Windows%20(msys)&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/windows-msys.yml) +[![busybox](https://img.shields.io/github/actions/workflow/status/shellspec/shellspec/windows-busybox.yml?label=Windows%20(busybox)&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/windows-busybox.yml)
+[![bash](https://img.shields.io/badge/bash-≥2.03-lightgrey.svg?style=flat)](https://www.gnu.org/software/bash/) +[![bosh](https://img.shields.io/badge/bosh-≥2018%2F10%2F07-lightgrey.svg?style=flat)](https://codeberg.org/schilytools/schilytools) +[![busybox](https://img.shields.io/badge/busybox-≥1.20.0-lightgrey.svg?style=flat)](https://www.busybox.net/) +[![dash](https://img.shields.io/badge/dash-≥0.5.4-lightgrey.svg?style=flat)](http://gondor.apana.org.au/~herbert/dash/) +[![ksh](https://img.shields.io/badge/ksh-≥93r-lightgrey.svg?style=flat)](https://github.com/ksh93/ksh) +[![mksh](https://img.shields.io/badge/mksh-≥R28-lightgrey.svg?style=flat)](http://www.mirbsd.org/mksh.htm) +[![posh](https://img.shields.io/badge/posh-≥0.3.14-lightgrey.svg?style=flat)](https://salsa.debian.org/clint/posh) +[![yash](https://img.shields.io/badge/yash-≥2.29-lightgrey.svg?style=flat)](https://magicant.github.io/yash/) +[![zsh](https://img.shields.io/badge/zsh-≥3.1.9-lightgrey.svg?style=flat)](https://www.zsh.org/) -[![GitHub Actions Status](https://img.shields.io/github/workflow/status/shellspec/shellspec/Release?label=GithubActions&style=flat-square)](https://github.com/shellspec/shellspec/actions) -[![Travis CI](https://img.shields.io/travis/com/shellspec/shellspec/master.svg?label=TravisCI&style=flat-square)](https://travis-ci.com/shellspec/shellspec) [![Cirrus CI](https://img.shields.io/cirrus/github/shellspec/shellspec.svg?label=CirrusCI&style=flat-square)](https://cirrus-ci.com/github/shellspec/shellspec) [![Circle CI](https://img.shields.io/circleci/build/github/shellspec/shellspec.svg?label=CircleCI&style=flat-square)](https://circleci.com/gh/shellspec/shellspec) -[![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/shellspec/shellspec?style=flat-square&label=DockerHub)![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/shellspec/shellspec?style=flat-square&label=builds)](https://hub.docker.com/r/shellspec/shellspec)
-[![Kcov](https://img.shields.io/badge/dynamic/json.svg?label=Kcov&query=percent_covered&suffix=%25&url=https%3A%2F%2Fcircleci.com%2Fapi%2Fv1.1%2Fproject%2Fgithub%2Fshellspec%2Fshellspec%2Flatest%2Fartifacts%2F0%2Fcoverage%2Fcoverage.json%3Fbranch%3Dmaster&style=flat-square)](https://circleci.com/api/v1.1/project/github/shellspec/shellspec/latest/artifacts/0/coverage/index.html?branch=master) +[![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/shellspec/shellspec?style=flat-square&label=DockerHub)![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/shellspec/shellspec?style=flat-square&label=builds)](https://hub.docker.com/r/shellspec/shellspec) +[![Kcov](https://img.shields.io/badge/dynamic/json.svg?label=Kcov&query=percent_covered&suffix=%25&url=https%3A%2F%2Fcircleci.com%2Fapi%2Fv1.1%2Fproject%2Fgithub%2Fshellspec%2Fshellspec%2Flatest%2Fartifacts%2F0%2Fcoverage%2Fcoverage.json%3Fbranch%3Dmaster&style=flat-square)](https://circleci.com/api/v1.1/project/github/shellspec/shellspec/latest/artifacts/0/coverage/index.html?branch=master)
[![Coveralls](https://img.shields.io/coveralls/github/shellspec/shellspec.svg?label=Coveralls&style=flat-square)](https://coveralls.io/github/shellspec/shellspec?branch=master) [![Code Climate](https://img.shields.io/codeclimate/coverage/shellspec/shellspec?label=CodeClimate&style=flat-square)](https://codeclimate.com/github/shellspec/shellspec) [![Codecov](https://img.shields.io/codecov/c/github/shellspec/shellspec.svg?label=Codecov&style=flat-square)](https://codecov.io/gh/shellspec/shellspec) @@ -16,16 +35,6 @@ ShellSpec is a **full-featured BDD unit testing framework** for dash, bash, ksh, [![GitHub release](https://img.shields.io/github/release/shellspec/shellspec.svg?style=flat-square)](https://github.com/shellspec/shellspec/releases/latest) [![License](https://img.shields.io/github/license/shellspec/shellspec.svg?style=flat-square)](https://github.com/shellspec/shellspec/blob/master/LICENSE) -[![bash](https://img.shields.io/badge/bash-≥2.03-lightgrey.svg?style=flat)](https://www.gnu.org/software/bash/) -[![bosh](https://img.shields.io/badge/bosh-≥2018%2F10%2F07-lightgrey.svg?style=flat)](http://schilytools.sourceforge.net/bosh.html) -[![busybox](https://img.shields.io/badge/busybox-≥1.20.0-lightgrey.svg?style=flat)](https://www.busybox.net/) -[![dash](https://img.shields.io/badge/dash-≥0.5.4-lightgrey.svg?style=flat)](http://gondor.apana.org.au/~herbert/dash/) -[![ksh](https://img.shields.io/badge/ksh-≥93s-lightgrey.svg?style=flat)](http://kornshell.org) -[![mksh](https://img.shields.io/badge/mksh-≥R28-lightgrey.svg?style=flat)](http://www.mirbsd.org/mksh.htm) -[![posh](https://img.shields.io/badge/posh-≥0.3.14-lightgrey.svg?style=flat)](https://salsa.debian.org/clint/posh) -[![yash](https://img.shields.io/badge/yash-≥2.29-lightgrey.svg?style=flat)](https://yash.osdn.jp/) -[![zsh](https://img.shields.io/badge/zsh-≥3.1.9-lightgrey.svg?style=flat)](https://www.zsh.org/) - ---- **Version 0.28.0** has a lot of enhancements in the CLI. It is basically compatible, but there are some changes that you need to be aware of. See [Migration Guide to Version 0.28.0](https://github.com/shellspec/shellspec/wiki/Migration-Guide-to-Version-0.28.0) for details. @@ -117,6 +126,7 @@ NOTE: This documentation contains unreleased features. Check them in the changel - [`BeforeAll`, `AfterAll` - example group hook](#beforeall-afterall---example-group-hook) - [`BeforeCall`, `AfterCall` - call evaluation hook](#beforecall-aftercall---call-evaluation-hook) - [`BeforeRun`, `AfterRun` - run evaluation hook](#beforerun-afterrun---run-evaluation-hook) + - [Pitfalls](#pitfalls) - [Helpers](#helpers) - [`Dump` - dump stdout, stderr, and status for debugging](#dump---dump-stdout-stderr-and-status-for-debugging) - [`Include` - include a script file](#include---include-a-script-file) @@ -153,7 +163,7 @@ NOTE: This documentation contains unreleased features. Check them in the changel - [`Intercept`](#intercept) - [`test || __() { :; }`](#test--__---) - [`__`](#__) -- [spec_helper](#spec_helper) +- [spec\_helper](#spec_helper) - [`_precheck`](#module_precheck) - [`minimum_version`](#minimum_version) - [`error`, `warn`, `info`](#error-warn-info) @@ -215,13 +225,12 @@ NOTE: This documentation contains unreleased features. Check them in the changel | Platform | Test | | ---------------------------------------------------------------- | -------------------------------------------------- | | Linux (Debian, Ubuntu, Fedora, CentOS, Alpine, Busybox, OpenWrt) | [GitHub Actions][Actions] or [Docker][Docker] | -| macOS (Default installed shells, Homebrew) | [GitHub Actions][Actions] or [Travis CI][TravisCI] | +| macOS (Default installed shells, Homebrew) | [GitHub Actions][Actions] | | Windows (Git bash, msys2, cygwin, busybox-w32, WSL) | [GitHub Actions][Actions] | | BSD (FreeBSD, OpenBSD, NetBSD) | [Cirrus CI][CirrusCI] (FreeBSD) or Manual (Others) | | Unix (Solaris, AIX) | Manual only | [Actions]: https://github.com/shellspec/shellspec/actions -[TravisCI]: https://travis-ci.com/shellspec/shellspec [CirrusCI]: https://cirrus-ci.com/github/shellspec/shellspec [Docker]: dockerfiles @@ -1315,13 +1324,13 @@ Describe 'run evaluation hook' End ``` -#### Pitfalls +#### Pitfalls -The hooks may fail in subtle ways if there is output to stderr, even if the -return code / exit code is `0`. +The hooks may fail in subtle ways if there is output to stderr, even if the +return code / exit code is `0`. -Commands like `git checkout` routinely write to stderr, even if there was no actual -failure, so be aware that your hooks may fail because of this. +Commands like `git checkout` routinely write to stderr, even if there was no actual +failure, so be aware that your hooks may fail because of this. ### Helpers @@ -2205,3 +2214,7 @@ reliability and portability, and the external commands allowed to use are greatl We recommend that you create WIP PR early or offer suggestions in discussions to avoid ruining your work. See [CONTRIBUTING.md](CONTRIBUTING.md) + +--- + +Author: Koichi Nakashima ([ko1nksm](https://github.com/ko1nksm)) diff --git a/contrib/various_test.sh b/contrib/various_test.sh index 04647dfc..d10f5773 100755 --- a/contrib/various_test.sh +++ b/contrib/various_test.sh @@ -2,6 +2,8 @@ set -eu +locale + : "${SH:=sh}" # Workaround for GitHub Actions (SIGPIPE) diff --git a/dockerfiles/.gwsh-snapshot-20190627 b/dockerfiles/.gwsh-snapshot-20190627 deleted file mode 100644 index 3c14a2e8..00000000 --- a/dockerfiles/.gwsh-snapshot-20190627 +++ /dev/null @@ -1,15 +0,0 @@ -FROM buildpack-deps:bullseye as builder -ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes -RUN apt-get update -RUN VERSION=snapshot-20190921 \ - && URL=https://github.com/hvdijk/gwsh/archive/$VERSION.tar.gz \ - && wget -nv -O- --trust-server-names "$URL" | tar xzf - \ - && cd gwsh-$VERSION \ - && ./autogen.sh \ - && ./configure \ - && make install - -FROM debian:bullseye-slim -COPY --from=builder /usr/local/bin* /usr/local/bin/ -RUN useradd -m user -ENV SH=/usr/local/bin/gwsh diff --git a/dockerfiles/almalinux-8.5-20220306-sh-4.4.20 b/dockerfiles/almalinux-8.9-20240410-sh-4.4.20 similarity index 55% rename from dockerfiles/almalinux-8.5-20220306-sh-4.4.20 rename to dockerfiles/almalinux-8.9-20240410-sh-4.4.20 index 30f07182..7fa9095e 100644 --- a/dockerfiles/almalinux-8.5-20220306-sh-4.4.20 +++ b/dockerfiles/almalinux-8.9-20240410-sh-4.4.20 @@ -1,3 +1,3 @@ -FROM almalinux:8.5-20220306 +FROM almalinux:8.9-20240410 RUN useradd -m user ENV SH=/bin/sh diff --git a/dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 b/dockerfiles/almalinux-9.4-20240506-sh-5.1.8 similarity index 54% rename from dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 rename to dockerfiles/almalinux-9.4-20240506-sh-5.1.8 index ada36233..466fa9ec 100644 --- a/dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 +++ b/dockerfiles/almalinux-9.4-20240506-sh-5.1.8 @@ -1,3 +1,3 @@ -FROM rockylinux:8.5.20220308 +FROM almalinux:9.4-20240506 RUN useradd -m user ENV SH=/bin/sh diff --git a/dockerfiles/alpine-3.15.4-bash-5.1.16 b/dockerfiles/alpine-3.15.4-bash-5.1.16 deleted file mode 100644 index 8dea581e..00000000 --- a/dockerfiles/alpine-3.15.4-bash-5.1.16 +++ /dev/null @@ -1,3 +0,0 @@ -FROM alpine:3.15.4 -RUN adduser -D user && apk add --no-cache bash -ENV SH=/bin/bash diff --git a/dockerfiles/alpine-3.15.4-loksh-7.0 b/dockerfiles/alpine-3.19.1-loksh-7.4 similarity index 77% rename from dockerfiles/alpine-3.15.4-loksh-7.0 rename to dockerfiles/alpine-3.19.1-loksh-7.4 index 840c131d..0a4694c4 100644 --- a/dockerfiles/alpine-3.15.4-loksh-7.0 +++ b/dockerfiles/alpine-3.19.1-loksh-7.4 @@ -1,3 +1,3 @@ -FROM alpine:3.15.4 +FROM alpine:3.19.1 RUN adduser -D user && apk add --no-cache loksh ENV SH=/bin/ksh diff --git a/dockerfiles/alpine-3.19.1-oksh-7.4 b/dockerfiles/alpine-3.19.1-oksh-7.4 new file mode 100644 index 00000000..23667470 --- /dev/null +++ b/dockerfiles/alpine-3.19.1-oksh-7.4 @@ -0,0 +1,3 @@ +FROM alpine:3.19.1 +RUN adduser -D user && apk add --no-cache oksh +ENV SH=/bin/oksh diff --git a/dockerfiles/alpine-3.15.4-sh-1.34.1 b/dockerfiles/alpine-3.19.1-sh-1.36.1 similarity index 65% rename from dockerfiles/alpine-3.15.4-sh-1.34.1 rename to dockerfiles/alpine-3.19.1-sh-1.36.1 index 19a3e564..701e4eab 100644 --- a/dockerfiles/alpine-3.15.4-sh-1.34.1 +++ b/dockerfiles/alpine-3.19.1-sh-1.36.1 @@ -1,3 +1,3 @@ -FROM alpine:3.15.4 +FROM alpine:3.19.1 RUN adduser -D user ENV SH=/bin/ash diff --git a/dockerfiles/alpine-edge-loksh-7.1 b/dockerfiles/alpine-edge-loksh-7.5 similarity index 100% rename from dockerfiles/alpine-edge-loksh-7.1 rename to dockerfiles/alpine-edge-loksh-7.5 diff --git a/dockerfiles/alpine-edge-oksh-7.0 b/dockerfiles/alpine-edge-oksh-7.0 deleted file mode 100644 index c1dbdc0c..00000000 --- a/dockerfiles/alpine-edge-oksh-7.0 +++ /dev/null @@ -1,4 +0,0 @@ -FROM alpine:edge -RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories -RUN adduser -D user && apk add --no-cache oksh@testing -ENV SH=/bin/oksh diff --git a/dockerfiles/alpine-edge-oksh-7.5 b/dockerfiles/alpine-edge-oksh-7.5 new file mode 100644 index 00000000..ef0ab8a6 --- /dev/null +++ b/dockerfiles/alpine-edge-oksh-7.5 @@ -0,0 +1,3 @@ +FROM alpine:edge +RUN adduser -D user && apk add --no-cache oksh +ENV SH=/bin/oksh diff --git a/dockerfiles/bash-5.2.26 b/dockerfiles/bash-5.2.26 new file mode 100644 index 00000000..591466fc --- /dev/null +++ b/dockerfiles/bash-5.2.26 @@ -0,0 +1,3 @@ +FROM bash:5.2.26 +RUN adduser -D user +ENV SH=/usr/local/bin/bash diff --git a/dockerfiles/bash-5.3-alpha b/dockerfiles/bash-5.3-alpha new file mode 100644 index 00000000..8e583dc5 --- /dev/null +++ b/dockerfiles/bash-5.3-alpha @@ -0,0 +1,3 @@ +FROM bash:5.3-alpha +RUN adduser -D user +ENV SH=/usr/local/bin/bash diff --git a/dockerfiles/bash-devel b/dockerfiles/bash-devel new file mode 100644 index 00000000..554aa7b3 --- /dev/null +++ b/dockerfiles/bash-devel @@ -0,0 +1,3 @@ +FROM bash:devel +RUN adduser -D user +ENV SH=/usr/local/bin/bash diff --git a/dockerfiles/busybox-1.34.1-sh-1.34.1 b/dockerfiles/busybox-1.34.1-sh-1.34.1 index 0a10d61e..90a79854 100644 --- a/dockerfiles/busybox-1.34.1-sh-1.34.1 +++ b/dockerfiles/busybox-1.34.1-sh-1.34.1 @@ -1,3 +1,3 @@ -FROM busybox:1.32.1 +FROM busybox:1.34.1 RUN adduser -D user ENV SH=/bin/ash diff --git a/dockerfiles/busybox-1.35.0-sh-1.35.0 b/dockerfiles/busybox-1.35.0-sh-1.35.0 index 5a802cd8..1f22f237 100644 --- a/dockerfiles/busybox-1.35.0-sh-1.35.0 +++ b/dockerfiles/busybox-1.35.0-sh-1.35.0 @@ -1,3 +1,3 @@ -FROM busybox:1.33.0 +FROM busybox:1.35.0 RUN adduser -D user ENV SH=/bin/ash diff --git a/dockerfiles/busybox-1.36.1-sh-1.36.1 b/dockerfiles/busybox-1.36.1-sh-1.36.1 new file mode 100644 index 00000000..eb6d37e7 --- /dev/null +++ b/dockerfiles/busybox-1.36.1-sh-1.36.1 @@ -0,0 +1,3 @@ +FROM busybox:1.36.1 +RUN adduser -D user +ENV SH=/bin/ash diff --git a/dockerfiles/centos-stream8-sh-4.4.20 b/dockerfiles/centos-stream8-sh-4.4.20 new file mode 100644 index 00000000..b846a0f1 --- /dev/null +++ b/dockerfiles/centos-stream8-sh-4.4.20 @@ -0,0 +1,3 @@ +FROM quay.io/centos/centos:stream8 +RUN useradd -m user +ENV SH=/bin/sh diff --git a/dockerfiles/centos-stream9-sh-6.1.8 b/dockerfiles/centos-stream9-sh-6.1.8 new file mode 100644 index 00000000..3d7f54d2 --- /dev/null +++ b/dockerfiles/centos-stream9-sh-6.1.8 @@ -0,0 +1,3 @@ +FROM quay.io/centos/centos:stream9 +RUN useradd -m user +ENV SH=/bin/sh diff --git a/dockerfiles/chimera-latest-sh b/dockerfiles/chimera-latest-sh new file mode 100644 index 00000000..43e0ee1d --- /dev/null +++ b/dockerfiles/chimera-latest-sh @@ -0,0 +1,4 @@ +FROM chimeralinux/chimera +RUN apk update && apk add shadow bsdtar +RUN useradd -m user +ENV SH=/bin/sh diff --git a/dockerfiles/debian-10.12-bash-5.0.3 b/dockerfiles/debian-10.13-bash-5.0.3 similarity index 80% rename from dockerfiles/debian-10.12-bash-5.0.3 rename to dockerfiles/debian-10.13-bash-5.0.3 index 448e6fcf..fe85ba11 100644 --- a/dockerfiles/debian-10.12-bash-5.0.3 +++ b/dockerfiles/debian-10.13-bash-5.0.3 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/bash diff --git a/dockerfiles/debian-10.12-busybox-1.30.1 b/dockerfiles/debian-10.13-busybox-1.30.1 similarity index 88% rename from dockerfiles/debian-10.12-busybox-1.30.1 rename to dockerfiles/debian-10.13-busybox-1.30.1 index 8d87165f..a457d4ae 100644 --- a/dockerfiles/debian-10.12-busybox-1.30.1 +++ b/dockerfiles/debian-10.13-busybox-1.30.1 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install busybox \ diff --git a/dockerfiles/debian-10.12-dash-0.5.10.2 b/dockerfiles/debian-10.13-dash-0.5.10.2 similarity index 80% rename from dockerfiles/debian-10.12-dash-0.5.10.2 rename to dockerfiles/debian-10.13-dash-0.5.10.2 index 3475481a..92a04ab1 100644 --- a/dockerfiles/debian-10.12-dash-0.5.10.2 +++ b/dockerfiles/debian-10.13-dash-0.5.10.2 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/dash diff --git a/dockerfiles/debian-10.12-ksh-93u b/dockerfiles/debian-10.13-ksh-93u similarity index 85% rename from dockerfiles/debian-10.12-ksh-93u rename to dockerfiles/debian-10.13-ksh-93u index 4d55c9c0..d3aa8169 100644 --- a/dockerfiles/debian-10.12-ksh-93u +++ b/dockerfiles/debian-10.13-ksh-93u @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install ksh diff --git a/dockerfiles/debian-10.12-lksh-57 b/dockerfiles/debian-10.13-lksh-57 similarity index 86% rename from dockerfiles/debian-10.12-lksh-57 rename to dockerfiles/debian-10.13-lksh-57 index e35acaa0..eeecb1f6 100644 --- a/dockerfiles/debian-10.12-lksh-57 +++ b/dockerfiles/debian-10.13-lksh-57 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install mksh diff --git a/dockerfiles/debian-10.12-mksh-57 b/dockerfiles/debian-10.13-mksh-57 similarity index 86% rename from dockerfiles/debian-10.12-mksh-57 rename to dockerfiles/debian-10.13-mksh-57 index 8c9622b8..71537e05 100644 --- a/dockerfiles/debian-10.12-mksh-57 +++ b/dockerfiles/debian-10.13-mksh-57 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install mksh diff --git a/dockerfiles/debian-10.12-posh-0.13.2 b/dockerfiles/debian-10.13-posh-0.13.2 similarity index 87% rename from dockerfiles/debian-10.12-posh-0.13.2 rename to dockerfiles/debian-10.13-posh-0.13.2 index d014262a..f0719045 100644 --- a/dockerfiles/debian-10.12-posh-0.13.2 +++ b/dockerfiles/debian-10.13-posh-0.13.2 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install posh procps diff --git a/dockerfiles/debian-10.12-yash-2.48 b/dockerfiles/debian-10.13-yash-2.48 similarity index 86% rename from dockerfiles/debian-10.12-yash-2.48 rename to dockerfiles/debian-10.13-yash-2.48 index 3b91a01a..cea69483 100644 --- a/dockerfiles/debian-10.12-yash-2.48 +++ b/dockerfiles/debian-10.13-yash-2.48 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install yash diff --git a/dockerfiles/debian-10.12-zsh-5.7.1 b/dockerfiles/debian-10.13-zsh-5.7.1 similarity index 86% rename from dockerfiles/debian-10.12-zsh-5.7.1 rename to dockerfiles/debian-10.13-zsh-5.7.1 index 89f08642..d09a3ea0 100644 --- a/dockerfiles/debian-10.12-zsh-5.7.1 +++ b/dockerfiles/debian-10.13-zsh-5.7.1 @@ -1,4 +1,4 @@ -FROM debian:10.12-slim +FROM debian:10.13-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install zsh diff --git a/dockerfiles/debian-11.3-bash-5.1.4 b/dockerfiles/debian-11.9-bash-5.1.4 similarity index 81% rename from dockerfiles/debian-11.3-bash-5.1.4 rename to dockerfiles/debian-11.9-bash-5.1.4 index 47f6a6d7..670e1081 100644 --- a/dockerfiles/debian-11.3-bash-5.1.4 +++ b/dockerfiles/debian-11.9-bash-5.1.4 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/bash diff --git a/dockerfiles/debian-11.3-busybox-1.30.1 b/dockerfiles/debian-11.9-busybox-1.30.1 similarity index 88% rename from dockerfiles/debian-11.3-busybox-1.30.1 rename to dockerfiles/debian-11.9-busybox-1.30.1 index 27d7c490..404ce573 100644 --- a/dockerfiles/debian-11.3-busybox-1.30.1 +++ b/dockerfiles/debian-11.9-busybox-1.30.1 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install busybox \ diff --git a/dockerfiles/debian-11.3-dash-0.5.11 b/dockerfiles/debian-11.9-dash-0.5.11 similarity index 81% rename from dockerfiles/debian-11.3-dash-0.5.11 rename to dockerfiles/debian-11.9-dash-0.5.11 index 436be250..142f613b 100644 --- a/dockerfiles/debian-11.3-dash-0.5.11 +++ b/dockerfiles/debian-11.9-dash-0.5.11 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/dash diff --git a/dockerfiles/debian-11.3-ksh-93u b/dockerfiles/debian-11.9-ksh-93u similarity index 86% rename from dockerfiles/debian-11.3-ksh-93u rename to dockerfiles/debian-11.9-ksh-93u index 0dce93f8..6b1d446f 100644 --- a/dockerfiles/debian-11.3-ksh-93u +++ b/dockerfiles/debian-11.9-ksh-93u @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install ksh diff --git a/dockerfiles/debian-11.3-lksh-59 b/dockerfiles/debian-11.9-lksh-59 similarity index 86% rename from dockerfiles/debian-11.3-lksh-59 rename to dockerfiles/debian-11.9-lksh-59 index 01f2351e..0964d649 100644 --- a/dockerfiles/debian-11.3-lksh-59 +++ b/dockerfiles/debian-11.9-lksh-59 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install mksh diff --git a/dockerfiles/debian-11.3-mksh-59 b/dockerfiles/debian-11.9-mksh-59 similarity index 86% rename from dockerfiles/debian-11.3-mksh-59 rename to dockerfiles/debian-11.9-mksh-59 index 107b5ed8..9205c271 100644 --- a/dockerfiles/debian-11.3-mksh-59 +++ b/dockerfiles/debian-11.9-mksh-59 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install mksh diff --git a/dockerfiles/debian-11.3-posh-0.14.1 b/dockerfiles/debian-11.9-posh-0.14.1 similarity index 87% rename from dockerfiles/debian-11.3-posh-0.14.1 rename to dockerfiles/debian-11.9-posh-0.14.1 index 83c9d518..210d9db9 100644 --- a/dockerfiles/debian-11.3-posh-0.14.1 +++ b/dockerfiles/debian-11.9-posh-0.14.1 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install posh procps diff --git a/dockerfiles/debian-11.3-yash-2.50 b/dockerfiles/debian-11.9-yash-2.50 similarity index 86% rename from dockerfiles/debian-11.3-yash-2.50 rename to dockerfiles/debian-11.9-yash-2.50 index 4bc8063d..98f2b074 100644 --- a/dockerfiles/debian-11.3-yash-2.50 +++ b/dockerfiles/debian-11.9-yash-2.50 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install yash diff --git a/dockerfiles/debian-11.3-zsh-5.8 b/dockerfiles/debian-11.9-zsh-5.8 similarity index 86% rename from dockerfiles/debian-11.3-zsh-5.8 rename to dockerfiles/debian-11.9-zsh-5.8 index 6a2110ae..48f7b73f 100644 --- a/dockerfiles/debian-11.3-zsh-5.8 +++ b/dockerfiles/debian-11.9-zsh-5.8 @@ -1,4 +1,4 @@ -FROM debian:11.3-slim +FROM debian:11.9-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install zsh diff --git a/dockerfiles/debian-bookworm-bash-5.1.16 b/dockerfiles/debian-12.5-bash-5.2.15 similarity index 78% rename from dockerfiles/debian-bookworm-bash-5.1.16 rename to dockerfiles/debian-12.5-bash-5.2.15 index 0cfc2b52..6959d98d 100644 --- a/dockerfiles/debian-bookworm-bash-5.1.16 +++ b/dockerfiles/debian-12.5-bash-5.2.15 @@ -1,4 +1,4 @@ -FROM debian:bookworm-slim +FROM debian:12.5-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/bash diff --git a/dockerfiles/debian-12.5-busybox-1.35.0 b/dockerfiles/debian-12.5-busybox-1.35.0 new file mode 100644 index 00000000..1c3be167 --- /dev/null +++ b/dockerfiles/debian-12.5-busybox-1.35.0 @@ -0,0 +1,6 @@ +FROM debian:12.5-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN useradd -m user \ + && apt-get update && apt-get -y install busybox \ + && /bin/busybox --install -s +ENV SH=/bin/ash diff --git a/dockerfiles/debian-12.5-dash-0.5.12 b/dockerfiles/debian-12.5-dash-0.5.12 new file mode 100644 index 00000000..fc7b9b71 --- /dev/null +++ b/dockerfiles/debian-12.5-dash-0.5.12 @@ -0,0 +1,4 @@ +FROM debian:12.5-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN useradd -m user +ENV SH=/bin/dash diff --git a/dockerfiles/debian-bookworm-ksh93um b/dockerfiles/debian-12.5-ksh93um-1.0.4 similarity index 84% rename from dockerfiles/debian-bookworm-ksh93um rename to dockerfiles/debian-12.5-ksh93um-1.0.4 index e3b85a8d..33e49f7d 100644 --- a/dockerfiles/debian-bookworm-ksh93um +++ b/dockerfiles/debian-12.5-ksh93um-1.0.4 @@ -1,4 +1,4 @@ -FROM debian:bookworm-slim +FROM debian:12.5-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install ksh diff --git a/dockerfiles/debian-12.5-lksh-59 b/dockerfiles/debian-12.5-lksh-59 new file mode 100644 index 00000000..559a4ddc --- /dev/null +++ b/dockerfiles/debian-12.5-lksh-59 @@ -0,0 +1,5 @@ +FROM debian:12.5-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN useradd -m user \ + && apt-get update && apt-get -y install mksh +ENV SH=/bin/lksh diff --git a/dockerfiles/debian-12.5-mksh-59 b/dockerfiles/debian-12.5-mksh-59 new file mode 100644 index 00000000..c96834c3 --- /dev/null +++ b/dockerfiles/debian-12.5-mksh-59 @@ -0,0 +1,5 @@ +FROM debian:12.5-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN useradd -m user \ + && apt-get update && apt-get -y install mksh +ENV SH=/bin/mksh diff --git a/dockerfiles/debian-12.5-posh-0.14.1 b/dockerfiles/debian-12.5-posh-0.14.1 new file mode 100644 index 00000000..02d4a8e6 --- /dev/null +++ b/dockerfiles/debian-12.5-posh-0.14.1 @@ -0,0 +1,5 @@ +FROM debian:12.5-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN useradd -m user \ + && apt-get update && apt-get -y install posh procps +ENV SH=/usr/bin/posh diff --git a/dockerfiles/debian-bookworm-yash-2.52 b/dockerfiles/debian-12.5-yash-2.52 similarity index 84% rename from dockerfiles/debian-bookworm-yash-2.52 rename to dockerfiles/debian-12.5-yash-2.52 index 1dbd32cb..4da2f43b 100644 --- a/dockerfiles/debian-bookworm-yash-2.52 +++ b/dockerfiles/debian-12.5-yash-2.52 @@ -1,4 +1,4 @@ -FROM debian:bookworm-slim +FROM debian:12.5-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install yash diff --git a/dockerfiles/debian-bookworm-zsh-5.8.1 b/dockerfiles/debian-12.5-zsh-5.9 similarity index 84% rename from dockerfiles/debian-bookworm-zsh-5.8.1 rename to dockerfiles/debian-12.5-zsh-5.9 index b6715824..70a272a2 100644 --- a/dockerfiles/debian-bookworm-zsh-5.8.1 +++ b/dockerfiles/debian-12.5-zsh-5.9 @@ -1,4 +1,4 @@ -FROM debian:bookworm-slim +FROM debian:12.5-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user \ && apt-get update && apt-get -y install zsh diff --git a/dockerfiles/.debian-4.0r9-ksh-93r-! b/dockerfiles/debian-4.0r9-ksh-93r similarity index 100% rename from dockerfiles/.debian-4.0r9-ksh-93r-! rename to dockerfiles/debian-4.0r9-ksh-93r diff --git a/dockerfiles/debian-8.11-bash-4.3.30 b/dockerfiles/debian-8.11-bash-4.3.30 index 5cd9919e..0b6051a5 100644 --- a/dockerfiles/debian-8.11-bash-4.3.30 +++ b/dockerfiles/debian-8.11-bash-4.3.30 @@ -1,4 +1,4 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/bash diff --git a/dockerfiles/debian-8.11-busybox-1.22.0 b/dockerfiles/debian-8.11-busybox-1.22.0 index 0a3f1db5..8ba561c4 100644 --- a/dockerfiles/debian-8.11-busybox-1.22.0 +++ b/dockerfiles/debian-8.11-busybox-1.22.0 @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install busybox \ && /bin/busybox --install -s diff --git a/dockerfiles/debian-8.11-dash-0.5.7 b/dockerfiles/debian-8.11-dash-0.5.7 index a1ec0f94..52cb016d 100644 --- a/dockerfiles/debian-8.11-dash-0.5.7 +++ b/dockerfiles/debian-8.11-dash-0.5.7 @@ -1,4 +1,4 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/dash diff --git a/dockerfiles/debian-8.11-ksh-93u b/dockerfiles/debian-8.11-ksh-93u index bf21060a..e19e2c83 100644 --- a/dockerfiles/debian-8.11-ksh-93u +++ b/dockerfiles/debian-8.11-ksh-93u @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install ksh ENV SH=/bin/ksh diff --git a/dockerfiles/debian-8.11-lksh-50d b/dockerfiles/debian-8.11-lksh-50d index ef6a085c..e6905480 100644 --- a/dockerfiles/debian-8.11-lksh-50d +++ b/dockerfiles/debian-8.11-lksh-50d @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install mksh ENV SH=/bin/lksh diff --git a/dockerfiles/debian-8.11-mksh-50d b/dockerfiles/debian-8.11-mksh-50d index c7776d17..fb8b24d8 100644 --- a/dockerfiles/debian-8.11-mksh-50d +++ b/dockerfiles/debian-8.11-mksh-50d @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install mksh ENV SH=/bin/mksh diff --git a/dockerfiles/debian-8.11-posh-0.12.3 b/dockerfiles/debian-8.11-posh-0.12.3 index 89b8cf5c..ba7af705 100644 --- a/dockerfiles/debian-8.11-posh-0.12.3 +++ b/dockerfiles/debian-8.11-posh-0.12.3 @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install posh ENV SH=/bin/posh diff --git a/dockerfiles/debian-8.11-yash-2.36 b/dockerfiles/debian-8.11-yash-2.36 index 011be768..bf92fb1b 100644 --- a/dockerfiles/debian-8.11-yash-2.36 +++ b/dockerfiles/debian-8.11-yash-2.36 @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install yash ENV SH=/usr/bin/yash diff --git a/dockerfiles/debian-8.11-zsh-5.0.7 b/dockerfiles/debian-8.11-zsh-5.0.7 index ae869317..5cc6982f 100644 --- a/dockerfiles/debian-8.11-zsh-5.0.7 +++ b/dockerfiles/debian-8.11-zsh-5.0.7 @@ -1,5 +1,7 @@ -FROM debian:8.11-slim +FROM debian/eol:jessie-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/security.debian.org/archive.debian.org/' /etc/apt/sources.list +RUN sed -i '/jessie-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install zsh ENV SH=/usr/bin/zsh diff --git a/dockerfiles/debian-9.13-bash-4.4.12 b/dockerfiles/debian-9.13-bash-4.4.12 index c3201b30..9685b1c4 100644 --- a/dockerfiles/debian-9.13-bash-4.4.12 +++ b/dockerfiles/debian-9.13-bash-4.4.12 @@ -1,4 +1,4 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/bash diff --git a/dockerfiles/debian-9.13-busybox-1.22.0 b/dockerfiles/debian-9.13-busybox-1.22.0 index 2647887d..a6e84958 100644 --- a/dockerfiles/debian-9.13-busybox-1.22.0 +++ b/dockerfiles/debian-9.13-busybox-1.22.0 @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install busybox \ && /bin/busybox --install -s diff --git a/dockerfiles/debian-9.13-dash-0.5.8 b/dockerfiles/debian-9.13-dash-0.5.8 index c8e29b08..429e666a 100644 --- a/dockerfiles/debian-9.13-dash-0.5.8 +++ b/dockerfiles/debian-9.13-dash-0.5.8 @@ -1,4 +1,4 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN useradd -m user ENV SH=/bin/dash diff --git a/dockerfiles/debian-9.13-ksh-93u b/dockerfiles/debian-9.13-ksh-93u index 28efda53..49377664 100644 --- a/dockerfiles/debian-9.13-ksh-93u +++ b/dockerfiles/debian-9.13-ksh-93u @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install ksh ENV SH=/bin/ksh diff --git a/dockerfiles/debian-9.13-lksh-54 b/dockerfiles/debian-9.13-lksh-54 index d6b60609..5202ea34 100644 --- a/dockerfiles/debian-9.13-lksh-54 +++ b/dockerfiles/debian-9.13-lksh-54 @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install mksh ENV SH=/bin/lksh diff --git a/dockerfiles/debian-9.13-mksh-54 b/dockerfiles/debian-9.13-mksh-54 index 3328707c..2e0ca352 100644 --- a/dockerfiles/debian-9.13-mksh-54 +++ b/dockerfiles/debian-9.13-mksh-54 @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install mksh ENV SH=/bin/mksh diff --git a/dockerfiles/debian-9.13-posh-0.12.6 b/dockerfiles/debian-9.13-posh-0.12.6 index 93d6bf9b..7b66d53e 100644 --- a/dockerfiles/debian-9.13-posh-0.12.6 +++ b/dockerfiles/debian-9.13-posh-0.12.6 @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install posh procps ENV SH=/bin/posh diff --git a/dockerfiles/debian-9.13-yash-2.43 b/dockerfiles/debian-9.13-yash-2.43 index c655c16b..0d87b32b 100644 --- a/dockerfiles/debian-9.13-yash-2.43 +++ b/dockerfiles/debian-9.13-yash-2.43 @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install yash ENV SH=/usr/bin/yash diff --git a/dockerfiles/debian-9.13-zsh-5.3.1 b/dockerfiles/debian-9.13-zsh-5.3.1 index 091ae8c9..b80e6d10 100644 --- a/dockerfiles/debian-9.13-zsh-5.3.1 +++ b/dockerfiles/debian-9.13-zsh-5.3.1 @@ -1,5 +1,7 @@ -FROM debian:9.13-slim +FROM debian/eol:stretch-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list +RUN sed -i '/stretch-updates/d' /etc/apt/sources.list RUN useradd -m user \ && apt-get update && apt-get -y install zsh ENV SH=/usr/bin/zsh diff --git a/dockerfiles/debian-i18n-testing b/dockerfiles/debian-i18n-testing new file mode 100644 index 00000000..699e6be1 --- /dev/null +++ b/dockerfiles/debian-i18n-testing @@ -0,0 +1,7 @@ +FROM debian:12-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN apt-get update && apt-get install -y locales-all ksh mksh posh yash zsh +RUN useradd -m user +RUN rm -f /usr/bin/time /bin/time +ENV LC_ALL=de_DE.utf8 +ENV SH=/bin/bash diff --git a/dockerfiles/debian-trixie-yash-2.55 b/dockerfiles/debian-trixie-yash-2.55 new file mode 100644 index 00000000..59d220f8 --- /dev/null +++ b/dockerfiles/debian-trixie-yash-2.55 @@ -0,0 +1,5 @@ +FROM debian:trixie-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN useradd -m user \ + && apt-get update && apt-get -y install yash +ENV SH=/usr/bin/yash diff --git a/dockerfiles/fedora-34-sh-5.1.0 b/dockerfiles/fedora-39-sh-5.2.26 similarity index 70% rename from dockerfiles/fedora-34-sh-5.1.0 rename to dockerfiles/fedora-39-sh-5.2.26 index 1e66699b..bfb450c0 100644 --- a/dockerfiles/fedora-34-sh-5.1.0 +++ b/dockerfiles/fedora-39-sh-5.2.26 @@ -1,3 +1,3 @@ -FROM fedora:34 +FROM fedora:39 RUN useradd -m user ENV SH=/bin/sh diff --git a/dockerfiles/fedora-35-sh-5.1.8 b/dockerfiles/fedora-40-sh-5.2.26 similarity index 70% rename from dockerfiles/fedora-35-sh-5.1.8 rename to dockerfiles/fedora-40-sh-5.2.26 index addae7e3..1e03ac79 100644 --- a/dockerfiles/fedora-35-sh-5.1.8 +++ b/dockerfiles/fedora-40-sh-5.2.26 @@ -1,3 +1,3 @@ -FROM fedora:35 +FROM fedora:40 RUN useradd -m user ENV SH=/bin/sh diff --git a/dockerfiles/gwsh-main b/dockerfiles/gwsh-main new file mode 100644 index 00000000..38f35b34 --- /dev/null +++ b/dockerfiles/gwsh-main @@ -0,0 +1,15 @@ +FROM buildpack-deps:bookworm as builder +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN apt-get update +ENV URL=https://github.com/hvdijk/gwsh/archive/main.tar.gz +RUN wget -nv -O- --trust-server-names "$URL" | tar xzf - --one-top-level=gwsh --strip-components=1 \ + && ls -al \ + && cd gwsh \ + && ./autogen.sh \ + && ./configure \ + && make install + +FROM debian:bookworm-slim +COPY --from=builder /usr/local/bin* /usr/local/bin/ +RUN useradd -m user +ENV SH=/usr/local/bin/gwsh diff --git a/dockerfiles/openwrt-10.03.1-sh-1.15.3-! b/dockerfiles/openwrt-10.03.1-sh-1.15.3-! index e1fd4f7e..c989260d 100644 --- a/dockerfiles/openwrt-10.03.1-sh-1.15.3-! +++ b/dockerfiles/openwrt-10.03.1-sh-1.15.3-! @@ -9,7 +9,7 @@ COPY --from=builder /rootfs/ / CMD ["/bin/sh"] FROM base -RUN mkdir /var/lock /home \ - && opkg update && opkg install shadow-groupadd shadow-useradd \ - && groupadd user && useradd -m user -g user +RUN mkdir -p /home/user \ + && echo 'user:!:1000:' >> /etc/group \ + && echo 'user:x:1000:1000::/home/user:' >> /etc/passwd ENV SH=/bin/sh diff --git a/dockerfiles/openwrt-12.09-sh-1.19.4-! b/dockerfiles/openwrt-12.09-sh-1.19.4-! index c56c1e1e..78ad2f90 100644 --- a/dockerfiles/openwrt-12.09-sh-1.19.4-! +++ b/dockerfiles/openwrt-12.09-sh-1.19.4-! @@ -9,7 +9,7 @@ COPY --from=builder /rootfs/ / CMD ["/bin/sh"] FROM base -RUN mkdir /var/lock /home \ - && opkg update && opkg install shadow-useradd \ - && useradd -m user +RUN mkdir -p /home/user \ + && echo 'user:!:1000:' >> /etc/group \ + && echo 'user:x:1000:1000::/home/user:' >> /etc/passwd ENV SH=/bin/sh diff --git a/dockerfiles/openwrt-14.07-sh-1.22.1 b/dockerfiles/openwrt-14.07-sh-1.22.1 index 29f6e378..39e614bf 100644 --- a/dockerfiles/openwrt-14.07-sh-1.22.1 +++ b/dockerfiles/openwrt-14.07-sh-1.22.1 @@ -9,7 +9,7 @@ COPY --from=builder /rootfs/ / CMD ["/bin/sh"] FROM base -RUN mkdir /var/lock /home \ - && opkg update && opkg install shadow-useradd \ - && useradd -m user +RUN mkdir -p /home/user \ + && echo 'user:!:1000:' >> /etc/group \ + && echo 'user:x:1000:1000::/home/user:' >> /etc/passwd ENV SH=/bin/sh diff --git a/dockerfiles/openwrt-15.05.1-sh-1.23.2 b/dockerfiles/openwrt-15.05.1-sh-1.23.2 index 82833213..968d1473 100644 --- a/dockerfiles/openwrt-15.05.1-sh-1.23.2 +++ b/dockerfiles/openwrt-15.05.1-sh-1.23.2 @@ -9,7 +9,7 @@ COPY --from=builder /rootfs/ / CMD ["/bin/sh"] FROM base -RUN mkdir /var/lock /home \ - && opkg update && opkg install shadow-useradd \ - && useradd -m user +RUN mkdir -p /home/user \ + && echo 'user:!:1000:' >> /etc/group \ + && echo 'user:x:1000:1000::/home/user:' >> /etc/passwd ENV SH=/bin/sh diff --git a/dockerfiles/openwrt-21.02.3-sh-1.33.2 b/dockerfiles/openwrt-21.02.7-sh-1.33.2 similarity index 73% rename from dockerfiles/openwrt-21.02.3-sh-1.33.2 rename to dockerfiles/openwrt-21.02.7-sh-1.33.2 index e9520c41..f2698404 100644 --- a/dockerfiles/openwrt-21.02.3-sh-1.33.2 +++ b/dockerfiles/openwrt-21.02.7-sh-1.33.2 @@ -1,6 +1,6 @@ FROM alpine as builder -ENV base=https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/ -ENV file=openwrt-21.02.3-x86-64-rootfs.tar.gz +ENV base=https://downloads.openwrt.org/releases/21.02.7/targets/x86/64/ +ENV file=openwrt-21.02.7-x86-64-rootfs.tar.gz RUN wget -q "${base}${file}" RUN mkdir /rootfs && tar xf "$file" -C /rootfs diff --git a/dockerfiles/openwrt-22.03.0-rc1-sh-1.35.0 b/dockerfiles/openwrt-22.03.6-sh-1.35.0 similarity index 69% rename from dockerfiles/openwrt-22.03.0-rc1-sh-1.35.0 rename to dockerfiles/openwrt-22.03.6-sh-1.35.0 index 6b648bb2..a80c586e 100644 --- a/dockerfiles/openwrt-22.03.0-rc1-sh-1.35.0 +++ b/dockerfiles/openwrt-22.03.6-sh-1.35.0 @@ -1,6 +1,6 @@ FROM alpine as builder -ENV base=https://downloads.openwrt.org/releases/22.03.0-rc1/targets/x86/64/ -ENV file=openwrt-22.03.0-rc1-x86-64-rootfs.tar.gz +ENV base=https://downloads.openwrt.org/releases/22.03.6/targets/x86/64/ +ENV file=openwrt-22.03.6-x86-64-rootfs.tar.gz RUN wget -q "${base}${file}" RUN mkdir /rootfs && tar xf "$file" -C /rootfs diff --git a/dockerfiles/openwrt-23.05.3-sh-1.36.1 b/dockerfiles/openwrt-23.05.3-sh-1.36.1 new file mode 100644 index 00000000..5b4ec43f --- /dev/null +++ b/dockerfiles/openwrt-23.05.3-sh-1.36.1 @@ -0,0 +1,15 @@ +FROM alpine as builder +ENV base=https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/ +ENV file=openwrt-23.05.3-x86-64-rootfs.tar.gz +RUN wget -q "${base}${file}" +RUN mkdir /rootfs && tar xf "$file" -C /rootfs + +FROM scratch as base +COPY --from=builder /rootfs/ / +CMD ["/bin/sh"] + +FROM base +RUN mkdir /var/lock /home \ + && opkg update && opkg install shadow-useradd \ + && useradd -m user +ENV SH=/bin/sh diff --git a/dockerfiles/.schily-20210918-bosh-20210723 b/dockerfiles/schily-20240321-bosh-20230112 similarity index 52% rename from dockerfiles/.schily-20210918-bosh-20210723 rename to dockerfiles/schily-20240321-bosh-20230112 index 2a590d5e..faf8616d 100644 --- a/dockerfiles/.schily-20210918-bosh-20210723 +++ b/dockerfiles/schily-20240321-bosh-20230112 @@ -1,14 +1,13 @@ -FROM buildpack-deps:bullseye as builder +FROM buildpack-deps:bookworm as builder ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN apt-get update && apt-get -y install e2fslibs-dev -ENV VERSION=schily-2021-09-18 -ENV URL=https://sourceforge.net/projects/schilytools/files/$VERSION.tar.bz2/download -RUN wget -nv -O- --trust-server-names "$URL" | tar xfj - -WORKDIR $VERSION +ENV URL=https://codeberg.org/schilytools/schilytools/archive/2024-03-21.tar.gz +RUN wget -nv -O- --trust-server-names "$URL" | tar xzf - +WORKDIR schilytools RUN make install RUN /opt/schily/bin/bosh -c 'echo ${.sh.version}' -FROM debian:bullseye-slim +FROM debian:bookworm-slim COPY --from=builder /opt/schily/bin/* /usr/local/bin/ RUN useradd -m user ENV SH=/usr/local/bin/bosh diff --git a/dockerfiles/.schily-20210918-pbosh-20210723 b/dockerfiles/schily-20240321-pbosh-20230112 similarity index 52% rename from dockerfiles/.schily-20210918-pbosh-20210723 rename to dockerfiles/schily-20240321-pbosh-20230112 index 9cb15ae8..106e7661 100644 --- a/dockerfiles/.schily-20210918-pbosh-20210723 +++ b/dockerfiles/schily-20240321-pbosh-20230112 @@ -1,14 +1,13 @@ -FROM buildpack-deps:bullseye as builder +FROM buildpack-deps:bookworm as builder ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes RUN apt-get update && apt-get -y install e2fslibs-dev -ENV VERSION=schily-2021-09-18 -ENV URL=https://sourceforge.net/projects/schilytools/files/$VERSION.tar.bz2/download -RUN wget -nv -O- --trust-server-names "$URL" | tar xfj - -WORKDIR $VERSION +ENV URL=https://codeberg.org/schilytools/schilytools/archive/2024-03-21.tar.gz +RUN wget -nv -O- --trust-server-names "$URL" | tar xzf - +WORKDIR schilytools RUN make install RUN /opt/schily/bin/bosh -c 'echo ${.sh.version}' -FROM debian:bullseye-slim +FROM debian:bookworm-slim COPY --from=builder /opt/schily/bin/* /usr/local/bin/ RUN useradd -m user ENV SH=/usr/local/bin/pbosh diff --git a/docs/shells.md b/docs/shells.md index 7b36d381..dc4d81c1 100644 --- a/docs/shells.md +++ b/docs/shells.md @@ -28,10 +28,9 @@ ### Packages -- These are tested by [GitHub Actions][actions], [Travis CI][travis], [Cirrus CI][cirrus] and Docker (`contrib/test_in_docker.sh`). +- These are tested by [GitHub Actions][actions], [Cirrus CI][cirrus] and Docker (`contrib/test_in_docker.sh`). [actions]: https://github.com/shellspec/shellspec/actions -[travis]: https://travis-ci.org/shellspec/shellspec [cirrus]: https://cirrus-ci.com/github/shellspec/shellspec #### Alpine / BusyBox / OpenWrt (LEDE) diff --git a/helper/fixture/time_log.txt b/helper/fixture/time_log.txt index 5297e4d9..dbfb38c2 100644 --- a/helper/fixture/time_log.txt +++ b/helper/fixture/time_log.txt @@ -1,4 +1 @@ - -real 1.23 -user 0.11 -sys 12.45 +real:1.23 user:0.11 sys:12.45 type:external diff --git a/helper/ksh_workaround.sh b/helper/ksh_workaround.sh index a9addf90..69698361 100644 --- a/helper/ksh_workaround.sh +++ b/helper/ksh_workaround.sh @@ -45,6 +45,8 @@ ksh_workaround_loaded() { shellspec_redefinable shellspec_fds_check shellspec_redefinable shellspec_readfile_once shellspec_redefinable shellspec_head + shellspec_redefinable shellspec_od + shellspec_redefinable shellspec_hexdump # for ksh88 and busybox-1.1.3 # These shells do not allow built-in commands cannot be redefined diff --git a/helper/spec_helper.sh b/helper/spec_helper.sh index ebd0d112..59024577 100644 --- a/helper/spec_helper.sh +++ b/helper/spec_helper.sh @@ -4,8 +4,12 @@ set -eu # shellcheck disable=SC2039 spec_helper_precheck() { + info "shellspec minimum version: $SHELLSPEC_VERSION" minimum_version "$SHELLSPEC_VERSION" + setenv SHELLSPEC_PRECHECK_SETENV="dummy" + unsetenv SHELLSPEC_PRECHECK_SETENV + if [ "${PIPEFAIL:-}" ]; then # TODO: set -o pipefail will be allowed in POSIX issue 8 # shellcheck disable=SC3040 diff --git a/helper/support/bin/[ b/helper/support/bin/[ new file mode 100755 index 00000000..e38c8442 --- /dev/null +++ b/helper/support/bin/[ @@ -0,0 +1,4 @@ +#!/bin/false +# Workaround for yash 2.54. +# Shell builtin commands for commands that are not in the PATH can no longer +# be invoked. This file is intended to circumvent this behaviour of yash. diff --git a/helper/support/bin/echo b/helper/support/bin/echo new file mode 100755 index 00000000..e38c8442 --- /dev/null +++ b/helper/support/bin/echo @@ -0,0 +1,4 @@ +#!/bin/false +# Workaround for yash 2.54. +# Shell builtin commands for commands that are not in the PATH can no longer +# be invoked. This file is intended to circumvent this behaviour of yash. diff --git a/helper/support/bin/test b/helper/support/bin/test new file mode 100755 index 00000000..e38c8442 --- /dev/null +++ b/helper/support/bin/test @@ -0,0 +1,4 @@ +#!/bin/false +# Workaround for yash 2.54. +# Shell builtin commands for commands that are not in the PATH can no longer +# be invoked. This file is intended to circumvent this behaviour of yash. diff --git a/lib/core/dsl.sh b/lib/core/dsl.sh index ce86c2eb..564747c8 100644 --- a/lib/core/dsl.sh +++ b/lib/core/dsl.sh @@ -611,5 +611,14 @@ shellspec_unmock() { } shellspec_usefd() { + # Workaround for ksh93t on AIX 7.2 + case ${KSH_VERSION:-} in (*93t*) + ( + case $1 in + [0-9]) eval "exec $1>/dev/null" ;; + *) eval "exec {$1}>/dev/null" ;; + esac + ) + esac SHELLSPEC_USE_FDS="${SHELLSPEC_USE_FDS}${SHELLSPEC_USE_FDS:+:}$1" } diff --git a/lib/core/matchers.sh b/lib/core/matchers.sh index 08dc13aa..2f1f2fd0 100644 --- a/lib/core/matchers.sh +++ b/lib/core/matchers.sh @@ -17,7 +17,10 @@ shellspec_matcher() { unset SHELLSPEC_EXPECT ||: - eval shellspec_syntax_dispatch matcher ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch matcher ;; + *) shellspec_syntax_dispatch matcher "$@" ;; + esac } shellspec_matcher_do_match_positive() { diff --git a/lib/core/modifiers/contents.sh b/lib/core/modifiers/contents.sh index 434f9af5..a8169df1 100644 --- a/lib/core/modifiers/contents.sh +++ b/lib/core/modifiers/contents.sh @@ -12,7 +12,10 @@ shellspec_modifier_contents() { unset SHELLSPEC_SUBJECT ||: fi - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } shellspec_modifier_entire_contents() { @@ -24,5 +27,8 @@ shellspec_modifier_entire_contents() { unset SHELLSPEC_SUBJECT ||: fi - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/modifiers/length.sh b/lib/core/modifiers/length.sh index 6b9608f5..ef0fad82 100644 --- a/lib/core/modifiers/length.sh +++ b/lib/core/modifiers/length.sh @@ -11,5 +11,8 @@ shellspec_modifier_length() { unset SHELLSPEC_SUBJECT ||: fi - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/modifiers/line.sh b/lib/core/modifiers/line.sh index 5cba66a5..4dc842b8 100644 --- a/lib/core/modifiers/line.sh +++ b/lib/core/modifiers/line.sh @@ -17,5 +17,8 @@ shellspec_modifier_line() { fi shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/modifiers/lines.sh b/lib/core/modifiers/lines.sh index 446d23ef..c73496cd 100644 --- a/lib/core/modifiers/lines.sh +++ b/lib/core/modifiers/lines.sh @@ -11,5 +11,8 @@ shellspec_modifier_lines() { unset SHELLSPEC_SUBJECT ||: fi - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/modifiers/result.sh b/lib/core/modifiers/result.sh index 9a03c332..b699cec2 100644 --- a/lib/core/modifiers/result.sh +++ b/lib/core/modifiers/result.sh @@ -24,7 +24,10 @@ shellspec_modifier_result() { unset SHELLSPEC_SUBJECT ||: fi - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } shellspec_modifier_result_invoke() { diff --git a/lib/core/modifiers/word.sh b/lib/core/modifiers/word.sh index 5d0e05aa..328a296f 100644 --- a/lib/core/modifiers/word.sh +++ b/lib/core/modifiers/word.sh @@ -17,5 +17,8 @@ shellspec_modifier_word() { fi shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/statement.sh b/lib/core/statement.sh index 0f8c0c25..30376609 100644 --- a/lib/core/statement.sh +++ b/lib/core/statement.sh @@ -12,7 +12,7 @@ shellspec_each shellspec_callback \ # C c1 c2 of B b1 b2 of A a1 a2 should equal abc # => A a1 a2 B b1 b2 C c1 c2 should equal abc shellspec_statement_preposition() { - shellspec_work='' shellspec_i=0 shellspec_v='' + shellspec_work='' shellspec_i=0 shellspec_j=0 shellspec_k=0 shellspec_v='' until [ "$shellspec_v" = should ]; do shellspec_i=$(($shellspec_i + 1)) && shellspec_j=$shellspec_i diff --git a/lib/core/subjects/fd.sh b/lib/core/subjects/fd.sh index 8375b1ba..96c77a3f 100644 --- a/lib/core/subjects/fd.sh +++ b/lib/core/subjects/fd.sh @@ -17,7 +17,10 @@ shellspec_subject_fd() { fi shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } shellspec_subject_entire_fd() { @@ -34,5 +37,8 @@ shellspec_subject_entire_fd() { fi shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/line.sh b/lib/core/subjects/line.sh index 02954a2e..ff4e3867 100644 --- a/lib/core/subjects/line.sh +++ b/lib/core/subjects/line.sh @@ -18,5 +18,8 @@ shellspec_subject_line() { fi shellspec_off UNHANDLED_STDOUT - eval shellspec_syntax_dispatch modifier line ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier line ;; + *) shellspec_syntax_dispatch modifier line "$@" ;; + esac } diff --git a/lib/core/subjects/path.sh b/lib/core/subjects/path.sh index b3815896..ddefa9e0 100644 --- a/lib/core/subjects/path.sh +++ b/lib/core/subjects/path.sh @@ -19,5 +19,8 @@ shellspec_subject_path() { shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/status.sh b/lib/core/subjects/status.sh index 7825d141..43f50cd1 100644 --- a/lib/core/subjects/status.sh +++ b/lib/core/subjects/status.sh @@ -14,5 +14,8 @@ shellspec_subject_status() { shellspec_off UNHANDLED_STATUS - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/stderr.sh b/lib/core/subjects/stderr.sh index a0cd83b4..2d65312e 100644 --- a/lib/core/subjects/stderr.sh +++ b/lib/core/subjects/stderr.sh @@ -19,7 +19,10 @@ shellspec_subject_stderr() { shellspec_off UNHANDLED_STDERR - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } shellspec_subject_entire_stderr() { @@ -35,5 +38,8 @@ shellspec_subject_entire_stderr() { shellspec_off UNHANDLED_STDERR - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/stdout.sh b/lib/core/subjects/stdout.sh index e0eb0f31..377cde2b 100644 --- a/lib/core/subjects/stdout.sh +++ b/lib/core/subjects/stdout.sh @@ -19,7 +19,10 @@ shellspec_subject_stdout() { shellspec_off UNHANDLED_STDOUT - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } shellspec_subject_entire_stdout() { @@ -35,5 +38,8 @@ shellspec_subject_entire_stdout() { shellspec_off UNHANDLED_STDOUT - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/value.sh b/lib/core/subjects/value.sh index 3f3153ee..773f0212 100644 --- a/lib/core/subjects/value.sh +++ b/lib/core/subjects/value.sh @@ -12,5 +12,8 @@ shellspec_subject_value() { SHELLSPEC_SUBJECT=$1 shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/variable.sh b/lib/core/subjects/variable.sh index c408eebb..559cc607 100644 --- a/lib/core/subjects/variable.sh +++ b/lib/core/subjects/variable.sh @@ -14,5 +14,8 @@ shellspec_subject_variable() { fi shift - eval shellspec_syntax_dispatch modifier ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier ;; + *) shellspec_syntax_dispatch modifier "$@" ;; + esac } diff --git a/lib/core/subjects/word.sh b/lib/core/subjects/word.sh index 851b3f87..a523c133 100644 --- a/lib/core/subjects/word.sh +++ b/lib/core/subjects/word.sh @@ -18,5 +18,8 @@ shellspec_subject_word() { fi shellspec_off UNHANDLED_STDOUT - eval shellspec_syntax_dispatch modifier word ${1+'"$@"'} + case $# in + 0) shellspec_syntax_dispatch modifier word ;; + *) shellspec_syntax_dispatch modifier word "$@" ;; + esac } diff --git a/lib/general.sh b/lib/general.sh index f6df5735..25238bb1 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -1,11 +1,11 @@ #shellcheck shell=sh disable=SC2004,SC2016 -# Workaround for ksh 2020 -if [ "${KSH_VERSION:-}" ]; then +# Workaround for ksh 2020: Heisenbug +case "${KSH_VERSION:-}" in (*2020*) ( exec 3>/dev/null 4>&3 5>&3 6>&3 7>&3 8>&3 9>&3 eval "dummy() { $(printf %8192s :); }" ) 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&- -fi +esac : "${SHELLSPEC_SHELL_TYPE:=}" "${SHELLSPEC_SHELL_VERSION:=}" SHELLSPEC_SH_VERSION=$(eval 'echo "${.sh.version}"' 2>/dev/null) ||: @@ -944,3 +944,5 @@ shellspec_mv() { "$SHELLSPEC_MV" "$@"; } shellspec_rm() { "$SHELLSPEC_RM" "$@"; } shellspec_chmod() { "$SHELLSPEC_CHMOD" "$@"; } shellspec_sleep() { "$SHELLSPEC_SLEEP" "$@"; } +shellspec_od() { "$SHELLSPEC_OD" "$@"; } +shellspec_hexdump() { "$SHELLSPEC_HEXDUMP" "$@"; } diff --git a/lib/libexec/binary.sh b/lib/libexec/binary.sh index d9dd8e07..99bbe887 100644 --- a/lib/libexec/binary.sh +++ b/lib/libexec/binary.sh @@ -3,9 +3,9 @@ # busybox 1.1.3: `-A n`, `-t o1` not supported # busybox 1.10.2: `od -b` not working properly od_command() { - od -t o1 -v 2>/dev/null && return 0 - [ $? -eq 127 ] && hexdump -b -v 2>/dev/null && return 0 - od -b -v + shellspec_od -t o1 -v 2>/dev/null && return 0 + [ $? -eq 127 ] && shellspec_hexdump -b -v 2>/dev/null && return 0 + shellspec_od -b -v } octal_dump() { diff --git a/lib/libexec/reporter.sh b/lib/libexec/reporter.sh index 7f1e1921..b93aea5a 100644 --- a/lib/libexec/reporter.sh +++ b/lib/libexec/reporter.sh @@ -17,16 +17,16 @@ count_examples() { # $1: prefix, $2: filename # shellcheck disable=SC2295 read_time_log() { - eval "$1_real='' $1_user='' $1_sys=''" - [ -r "$2" ] || return 1 - # shellcheck disable=SC2034 - while IFS= read -r line; do - case $line in (real[\ $TAB]*|user[\ $TAB]*|sys[\ $TAB]*) - case ${line##*[ $TAB]} in (*[!0-9.]*) continue; esac - eval "$1_${line%%[ $TAB]*}=\"\${line##*[ \$TAB]}\"" - esac - done < "$2" &&: - eval "[ \"\$$1_real\" ] && [ \"\$$1_user\" ] && [ \"\$$1_sys\" ]" + eval "$1_real='' $1_user='' $1_sys='' $1_type=''" + [ -s "$2" ] || return 1 + { + set -- "$1_real" "$1_user" "$1_sys" "$1_type" + IFS=" " read -r "$@" || return 1 + while [ $# -gt 0 ]; do + eval "$1=\${$1#${1#*_}:}" + shift + done + } < "$2" } field_description() { diff --git a/lib/libexec/reporter/finished_formatter.sh b/lib/libexec/reporter/finished_formatter.sh index 4e2e7b42..71b4832c 100644 --- a/lib/libexec/reporter/finished_formatter.sh +++ b/lib/libexec/reporter/finished_formatter.sh @@ -4,7 +4,9 @@ create_buffers finished finished_end() { finished '=' "Finished in ${time_real:-?} seconds" \ - "(user ${time_user:-?} seconds, sys ${time_sys:-?} seconds)${LF}" + "(user: ${time_user:-n/a}${time_user:+s}," \ + "sys: ${time_sys:-n/a}${time_sys:+s})" \ + "[time: ${time_type:-not-available}]${LF}" } finished_output() { diff --git a/lib/libexec/reporter/junit_formatter.sh b/lib/libexec/reporter/junit_formatter.sh index d07f6061..2402d1c5 100644 --- a/lib/libexec/reporter/junit_formatter.sh +++ b/lib/libexec/reporter/junit_formatter.sh @@ -107,13 +107,13 @@ junit_output() { while IFS= read -r _line; do case $_line in *\/dev/null || command -p sort -k 1 -n -r ) + ( export LC_ALL=C; sort -nr 2>/dev/null || command -p sort -nr ) } diff --git a/lib/libexec/shellspec.sh b/lib/libexec/shellspec.sh index 1a12f8d0..71c92270 100644 --- a/lib/libexec/shellspec.sh +++ b/lib/libexec/shellspec.sh @@ -116,16 +116,20 @@ current_shell() { [ "$cmdline" ] || cmdline=$(read_ps "$2") # shellcheck disable=SC2295 - echo "${cmdline%% $self*}" + cmdline=${cmdline%% $self*} + # workaround for OpenBSD >= 7.2 (ps -f) + case $cmdline in ([\`\|]--\ * | -\ *) cmdline=${cmdline##*\ }; esac + echo "$cmdline" } # shellcheck disable=SC2295 command_path() { - if [ $# -lt 2 ]; then - set -- "" "$1" "${PATH}${SHELLSPEC_PATHSEP}" - else - set -- "$1" "$2" "${PATH}${SHELLSPEC_PATHSEP}" - fi + case $# in + 0 | 1) set -- "" "$1" ;; + *) set -- "$1" "$2" ;; + esac + set -- "$1" "$2" "$PATH" "$SHELLSPEC_POSIX_PATH" "$SHELLSPEC_PATHSEP" + set -- "$1" "$2" "${3}${4:+"$5"}${4}${5}" case $2 in (*/*) [ -x "$2" ] || return 1 diff --git a/libexec/shellspec-executor.sh b/libexec/shellspec-executor.sh index d5fec300..2f146e02 100755 --- a/libexec/shellspec-executor.sh +++ b/libexec/shellspec-executor.sh @@ -3,9 +3,6 @@ set -eu -# Close the file descriptor for time command -exec 2>&3 - # shellcheck source=lib/libexec/executor.sh . "${SHELLSPEC_LIB:-./lib}/libexec/executor.sh" @@ -106,13 +103,22 @@ detect_range() { echo "${lineno_begin}-${lineno_end:-$lineno}" } +xs1=0 xs2=0 set +e -( ( ( ( ( - ( set -e; exec 3>&- 4>&- 5>&-; executor "$@" ) ) 2>&1 >&4; echo $? >&5 ) \ - | ( set -e; error_handler ) >&3; echo $? >&5 ) 5>&1) \ - | ( - read -r xs1 && [ "$xs1" -ne 0 ] && exit "$xs1" - read -r xs2 && [ "$xs2" -ne 0 ] && exit "$xs2" - exit 0 - ) -) 4>&1 +{ + xs=$( + ( + ( + ( set -e; executor "$@" ) 2>&1 >&3 3>&- 4>&- 5>&- + echo "xs1=$?" >&5 + ) | ( + ( set -e; error_handler ) >&4 3>&- 4>&- 5>&- + echo "xs2=$?" >&5 + ) + ) 5>&1 + ) +} 3>&1 4>&2 +eval "$xs" +[ "$xs1" -ne 0 ] && exit "$xs1" +[ "$xs2" -ne 0 ] && exit "$xs2" +exit 0 diff --git a/libexec/shellspec-inspection.sh b/libexec/shellspec-inspection.sh index c458d42a..12d02494 100755 --- a/libexec/shellspec-inspection.sh +++ b/libexec/shellspec-inspection.sh @@ -147,28 +147,41 @@ set_path() { PATH="$1" } -# shellcheck disable=SC2123 -set_path / -if [ "$SHELLSPEC_SANDBOX" ] && ! $SHELLSPEC_SHELL -c ":" 2>/dev/null; then - # busybox ash on cygwin - echo "SHELLSPEC_DEFECT_SANDBOX=1" +run_with_path() { + current_path=$PATH xs=0 + set_path "$1" + shift + "$@" || xs=$? + PATH=$current_path + return $xs +} + +run_builtin() { + run_with_path /dev/null "$@" +} + +if [ "$SHELLSPEC_SANDBOX" ]; then + # shellcheck disable=SC2086 + if ! run_with_path / $SHELLSPEC_SHELL -c ":" 2>/dev/null; then + # busybox ash on cygwin + echo "SHELLSPEC_DEFECT_SANDBOX=1" + fi fi -set_path "" -if printf '' 2>/dev/null; then +if run_builtin printf '' 2>/dev/null; then echo "SHELLSPEC_BUILTIN_PRINTF=1" fi -if print -nr -- '' 2>/dev/null; then +if run_builtin print -nr -- '' 2>/dev/null; then echo "SHELLSPEC_BUILTIN_PRINT=1" fi typesetf_check() { :; } # shellcheck disable=SC3044 -if typeset -f typesetf_check >/dev/null 2>&1; then +if run_builtin typeset -f typesetf_check >/dev/null 2>&1; then echo "SHELLSPEC_BUILTIN_TYPESETF=1" fi -if type shopt >/dev/null 2>&1; then +if run_builtin shopt >/dev/null 2>&1; then echo "SHELLSPEC_SHOPT_AVAILABLE=1" # shellcheck disable=SC3044 if shopt -s failglob 2>/dev/null; then @@ -176,7 +189,7 @@ if type shopt >/dev/null 2>&1; then fi fi -if setopt NO_NOMATCH >/dev/null 2>&1; then +if run_builtin setopt NO_NOMATCH >/dev/null 2>&1; then echo "SHELLSPEC_NOMATCH_AVAILABLE=1" fi @@ -186,7 +199,7 @@ if ( exec {fd}>/dev/null ) 2>/dev/null; then fi # shellcheck disable=SC3044 -if readarray /dev/null; then +if run_builtin readarray /dev/null; then echo "SHELLSPEC_BUILTIN_READARRAY=1" fi diff --git a/libexec/shellspec-runner.sh b/libexec/shellspec-runner.sh index a3e93fa3..ee59a343 100755 --- a/libexec/shellspec-runner.sh +++ b/libexec/shellspec-runner.sh @@ -66,7 +66,7 @@ executor() { start_profiler executor="$SHELLSPEC_LIBEXEC/shellspec-executor.sh" # shellcheck disable=SC2086 - $SHELLSPEC_TIME $SHELLSPEC_SHELL "$executor" "$@" 3>&2 2>"$SHELLSPEC_TIME_LOG" + $SHELLSPEC_SHELL "$SHELLSPEC_TIME" $SHELLSPEC_SHELL "$executor" "$@" eval "stop_profiler; return $?" } @@ -186,51 +186,63 @@ if [ "${SHELLSPEC_RANDOM:-}" ]; then set -- - fi +xs=0 { - env=$( ( ( ( ( _do() { set +e; (set -e; "$@" ); echo "exit_status=$?" >&9; } - _do precheck "$SHELLSPEC_REQUIRES" >&8 + # precheck outputs code such as environment variable settings via FD9 + env=$( ( ( ( ( set -- "$SHELLSPEC_REQUIRES" + set +e; (set -e; precheck "$@") >&8 8>&-; echo "xs=$?" >&9 ) 2>&1 | while IFS= read -r line; do error "$line"; done >&2 ) 3>&1 | while IFS= read -r line; do warn "$line"; done >&2 ) 4>&1 | while IFS= read -r line; do info "$line"; done >&8 ) 9>&1 ) eval "$env" } 8>&1 -if [ "$exit_status" -ne 0 ] || [ -s "$SHELLSPEC_PRECHECKER_STATUS" ]; then - exit "$exit_status" +if [ "$xs" -ne 0 ] || [ -s "$SHELLSPEC_PRECHECKER_STATUS" ]; then + exit "$xs" fi -# I want to process with non-blocking output -# and the stdout of runner streams to the reporter -# and capture stderr both of the runner and the reporter -# and the stderr streams to error hander -# and also handle both exit status. As a result of +xs1='' xs2='' xs3='' set +e -( ( ( ( ( set -e; exec 3>&- 4>&- 5>&-; executor "$@" ); echo $? >&5; ) \ - | ( set -e; reporter "$@" ) >&3; echo $? >&5 ) 2>&1 \ - | ( set -e; error_handler ) >&4; echo $? >&5 ) 5>&1 \ - | ( - read -r xs1; read -r xs2; read -r xs3 - xs='' error='' msg="Aborted with status code" - for i in "$xs1" "$xs2" "$xs3"; do - case $i in - 0) continue ;; - "$SHELLSPEC_FAILURE_EXIT_CODE") [ "$xs" ] || xs=$i ;; - "$SHELLSPEC_ERROR_EXIT_CODE") xs=$i error=1 && break ;; - *) [ "${xs#"$SHELLSPEC_FAILURE_EXIT_CODE"}" ] || xs=$i; error=1 - esac - done - if [ "$error" ]; then - error "$msg [executor: $xs1] [reporter: $xs2] [error handler: $xs3]" - fi - set_exit_status "${xs:-0}" - ) -) 3>&1 4>&2 -exit_status=$? - -case $exit_status in +{ + xs=$( + ( + ( + ( + ( set -e; executor "$@" ) 3>&- 4>&- 5>&- + echo "xs1=$?" >&5 + ) | ( + ( set -e; reporter "$@" ) >&3 3>&- 4>&- 5>&- + echo "xs2=$?" >&5 + ) + ) 2>&1 | ( + ( set -e; error_handler ) >&4 3>&- 4>&- 5>&- + echo "xs3=$?" >&5 + ) + ) 5>&1 + ) +} 3>&1 4>&2 + +eval "$xs" +xs='' error='' +for i in "$xs1" "$xs2" "$xs3"; do + case $i in + 0) continue ;; + "$SHELLSPEC_FAILURE_EXIT_CODE") [ "$xs" ] || xs=$i ;; + "$SHELLSPEC_ERROR_EXIT_CODE") xs=$i error=1 && break ;; + *) [ "${xs#"$SHELLSPEC_FAILURE_EXIT_CODE"}" ] || xs=$i; error=1 + esac +done +xs=${xs:-0} + +if [ "$error" ]; then + msg="Aborted with status code" + error "$msg [executor: $xs1] [reporter: $xs2] [error handler: $xs3]" +fi + +case $xs in 0) ;; # Running specs exit with successfully. "$SHELLSPEC_FAILURE_EXIT_CODE") ;; # Running specs exit with failure. - *) error "Fatal error occurred, terminated with exit status $exit_status." + *) error "Fatal error occurred, terminated with exit status $xs." esac -exit "$exit_status" +exit "$xs" diff --git a/libexec/shellspec-time.sh b/libexec/shellspec-time.sh index ca64af35..f5620bd5 100755 --- a/libexec/shellspec-time.sh +++ b/libexec/shellspec-time.sh @@ -1,46 +1,184 @@ #!/bin/sh -#shellcheck disable=SC2004 +# shellcheck disable=SC2004 + +if [ -z "$PPID" ]; then + echo 'Bourne Shell is not supported.' \ + 'Run in a specific POSIX shell as follows.' >&2 + echo '$ ksh shellspec-time sleep 1' >&2 + exit 1 +fi + +set -f + +: "${SHELLSPEC_TRAP:=trap}" +: "${SHELLSPEC_TIME_TYPE:=auto}" +LF=' +' "$SHELLSPEC_TRAP" : INT -if [ "$BASH_VERSION" ] || [ "$KSH_VERSION" ]; then - time -p "$@" - exit $? -fi +datetime2unixtime() { + set -- "$1" "${2%%-*}" "${2%%T*}" "${2##*T}" + set -- "$1" "${2#"${2%%[!0]*}"}" "${3#*-}" "${4%%:*}" "${4#*:}" + set -- "$1" "$2" "${3%%-*}" "${3#*-}" "$4" "${5%%:*}" "${5#*:}" + set -- "$1" "${2:-0}" "${3#0}" "${4#0}" "${5#0}" "${6#0}" "${7#0}" + [ "$3" -lt 3 ] && set -- "$1" $(($2-1)) $(($3+12)) "$4" "$5" "$6" "$7" + set -- "$1" $((365*$2+$2/4-$2/100+$2/400)) "$3" "$4" "$5" "$6" "$7" + set -- "$1" "$2" $(((306*($3+1)/10)-428)) "$4" "$5" "$6" "${7%.*}" "${7#*.}" + eval "$1=$((($2+$3+$4-719163)*86400+$5*3600+$6*60+$7))${8:+.}${8}" +} -set -eu +time_using_date() { + date +'start %Y-%m-%dT%H:%M:%S.%N' + "$@" + set -- $? + date +'end %Y-%m-%dT%H:%M:%S.%N' + return "$1" +} -read -r sec_start millisec_start </dev/null 2>&1; then + SHELLSPEC_TIME_TYPE=external-date && return 0 + fi -status=0 + if [ ! "${KSH_VERSION:-}" ]; then + KSH_VERSION=$(eval 'echo ${.sh.version}') + fi 2>/dev/null -if [ $# -gt 0 ]; then - "$@" &&: - status=$? -fi + if [ "${BASH_VERSION:-}" ]; then + SHELLSPEC_TIME_TYPE=bash-builtin && return 0 + fi -read -r sec_end millisec_end </dev/null 2>&1; then + SHELLSPEC_TIME_TYPE=external-time + else + SHELLSPEC_TIME_TYPE=legacy-time + fi +} + +detect_time_type + +{ + ( + "$SHELLSPEC_TRAP" : INT + + set -- -- "$@" + + case ${LC_ALL+x} in + ?) set -- -s LC_ALL "$LC_ALL" "$@" ;; + *) set -- -u LC_ALL "$@" ;; + esac + export LC_ALL=C + + # bash or ksh93 + case ${TIMEFORMAT+x} in + ?) set -- -s TIMEFORMAT "$TIMEFORMAT" "$@" ;; + *) set -- -u TIMEFORMAT "$@" ;; + esac + TIMEFORMAT="real %R${LF}user %U${LF}sys %S" + + # zsh + case ${TIMEFMT+x} in + ?) set -- -s TIMEFMT "$TIMEFMT" "$@" ;; + *) set -- -u TIMEFMT "$@" ;; + esac + TIMEFMT="real %*E${LF}user %*U${LF}sys %*S" + + # GNU time + case ${TIME+x} in + ?) set -- -s TIME "$TIME" "$@" ;; + *) set -- -u TIME "$@" ;; + esac + export TIME="real %e${LF}user %U${LF}sys %S" + + # shellcheck disable=SC2016 + set -- sh -c ' + # Use Bourne shell syntax as sh may be a Bourne shell + while [ $# -gt 0 ]; do + case $1 in + -s) eval "$2=\"\$3\""; export "$2"; shift 2 ;; + -u) unset "$2"; shift ;; + --) shift; break ;; + *) break ;; + esac + shift + done + exec "$@" 2>&3 >&4 3>&- 4>&- + ' "$0" "$@" + + case $SHELLSPEC_TIME_TYPE in + external-date) + time_using_date "$@" + ;; + external-bash) + bash -c 'TIMEFORMAT=$1; shift; time "$@"' "$0" "$TIMEFORMAT" "$@" + ;; + external-ksh) + ksh -c 'TIMEFORMAT=$1; shift; time "$@"' "$0" "$TIMEFORMAT" "$@" + ;; + external-zsh) + zsh -c 'TIMEFMT=$1; shift; time "$@"' "$0" "$TIMEFMT" "$@" + ;; + bash-builtin | ksh93-builtin | zsh-builtin | legacy-time) + time "$@" + ;; + mksh-builtin | lksh-builtin | pdksh-builtin | external-time | *) + time -p "$@" + ;; + esac + echo "ex $?" >&2 + ) 2>&1 | ( + "$SHELLSPEC_TRAP" '' INT + + real='' user='' sys='' type=$SHELLSPEC_TIME_TYPE ex='' + + while read -r name time; do + # ksh88: 1m2.34s + case $time in *m*s) + type=ksh88-builtin + min=${time%m*} && time=${time#*m} + sec=${time%.*} && time=${time#*.} && time=${time%s} + time="$(($min * 60 + $sec)).$time" + esac -echo "real $sec.$millisec" >&2 + case $name in (real | user | sys | start | end | ex) + eval "$name=\$time" + esac + done -exit $status + if [ ! "$real" ]; then + datetime2unixtime start "$start" + datetime2unixtime end "$end" + real=$((${end%.*} - ${start%.*})) + case $start in + *[!0-9.]*) ;; + *) + start="${start#*.}00" end="${end#*.}00" + start="1${start%"${start#??}"}" end="3${end%"${end#??}"}" + diff=$(($end - $start)) + real="$(( $real - ($diff < 200) )).${diff#[12]}" + esac + fi + if [ "${SHELLSPEC_TIME_LOG:+x}" ]; then + exec 2>"$SHELLSPEC_TIME_LOG" + fi + echo "real:${real:-0} user:$user sys:$sys type:$type" >&2 + exit "${ex:-1}" + ) +} 3>&2 4>&1 diff --git a/libexec/shellspec-translate.sh b/libexec/shellspec-translate.sh index 47f7b6cb..eb3d29f3 100755 --- a/libexec/shellspec-translate.sh +++ b/libexec/shellspec-translate.sh @@ -28,6 +28,10 @@ trans_block_example_group() { trans_block_example() { putsn "(" + # Workaround for ksh93t on AIX 7.2 + case ${KSH_VERSION:-} in (*93t*) + putsn 'ulimit -t $(ulimit -t)' + esac [ "$skipped" ] && trans_skip "" putsn "shellspec_example_id $block_id $example_no $block_no" putsn "SHELLSPEC_LINENO_BEGIN=$lineno_begin" diff --git a/shellspec b/shellspec index 8d80a7d6..2925c510 100755 --- a/shellspec +++ b/shellspec @@ -24,6 +24,7 @@ fi export SHELLSPEC_VERSION='0.29.0-dev' export SHELLSPEC_CWD="$PWD" export SHELLSPEC_PATH='' +export SHELLSPEC_POSIX_PATH='' export SHELLSPEC_GRAMMAR_DSLS='' export SHELLSPEC_GRAMMAR_DIRECTIVES='' export SHELLSPEC_GRAMMAR_BLOCKS='' @@ -37,7 +38,6 @@ export SHELLSPEC_BUILTIN_READARRAY='' export SHELLSPEC_SEEKABLE='' export SHELLSPEC_READ_DELIM='' export SHELLSPEC_STRING_CONCAT='' -export SHELLSPEC_TIME='' export SHELLSPEC_LIST='' export SHELLSPEC_COUNT_FILE='' export SHELLSPEC_DEBUG_TRAP='' @@ -87,6 +87,10 @@ export SHELLSPEC_RM="rm" export SHELLSPEC_LS="ls" export SHELLSPEC_SORT="sort" export SHELLSPEC_FIND="find" +export SHELLSPEC_OD="od" +export SHELLSPEC_HEXDUMP="hexdump" + +SHELLSPEC_POSIX_PATH=$(getconf PATH 2>/dev/null) ||: #shellcheck disable=SC2039,SC3028 export SHELLSPEC_HOSTNAME="${HOSTNAME:-localhost}" @@ -125,6 +129,8 @@ export SHELLSPEC_REPORTERLIB="$SHELLSPEC_LIB/libexec/reporter" export SHELLSPEC_LIBEXEC="$SHELLSPEC_ROOT/libexec" export SHELLSPEC_INSPECTION="$SHELLSPEC_LIBEXEC/shellspec-inspection.sh" export SHELLSPEC_UNREADONLY_PATH="$SHELLSPEC_LIBEXEC/shellspec-unreadonly-path.sh" +export SHELLSPEC_TIME_TYPE=auto +export SHELLSPEC_TIME="$SHELLSPEC_LIBEXEC/shellspec-time.sh" # shellcheck source=lib/libexec/shellspec.sh . "$SHELLSPEC_LIB/libexec/shellspec.sh" @@ -193,7 +199,7 @@ abspath SHELLSPEC_PROJECT_ROOT "$SHELLSPEC_PROJECT_ROOT" optparser parse_options error_message error_message() { - error "$1${options_file:+" [$options_file]"}" + error "$1${options_file:+ "[$options_file]"}" } options_file() { @@ -229,6 +235,7 @@ abspath SHELLSPEC_PROJECT_ROOT "$SHELLSPEC_PROJECT_ROOT" eval "set -- $params" } +# shellcheck disable=SC2153 case $SHELLSPEC_MODE in (init) SHELLSPEC_PROJECT_ROOT=${SHELLSPEC_PROJECT_ROOT:-$SHELLSPEC_CWD} helperdir=$SHELLSPEC_HELPERDIR @@ -359,6 +366,14 @@ if [ "$SHELLSPEC_DEFECT_SANDBOX" ]; then warn "Some features may fail due to incompatibilities with sandbox features." fi +# Convert to absolute paths as needed for command-based mocks +if [ "$SHELLSPEC_BUSYBOX_W32" ]; then + case $SHELLSPEC_SHELL in + */*) ;; + *) SHELLSPEC_SHELL="/bin/$SHELLSPEC_SHELL" + esac +fi + # shellcheck disable=SC2153 if [ "$SHELLSPEC_XTRACE" ]; then if [ "$SHELLSPEC_XTRACE_ONLY" ]; then @@ -394,17 +409,8 @@ fi command_path SHELLSPEC_LS "ls" ||: command_path SHELLSPEC_SORT "sort" ||: command_path SHELLSPEC_FIND "find" ||: - - if command_path "time" || [ "$SHELLSPEC_BUSYBOX_W32" ]; then - SHELLSPEC_TIME="time -p" - else - SHELLSPEC_TIME="$SHELLSPEC_LIBEXEC/shellspec-time.sh" - if command_path bash; then - SHELLSPEC_TIME="bash $SHELLSPEC_TIME" - elif command_path ksh; then - SHELLSPEC_TIME="ksh $SHELLSPEC_TIME" - fi - fi + command_path SHELLSPEC_OD "od" ||: + command_path SHELLSPEC_HEXDUMP "hexdump" ||: } if ! signal 0 $$ 2>/dev/null; then diff --git a/spec/core/dsl_spec.sh b/spec/core/dsl_spec.sh index 8a211539..038fb2bc 100644 --- a/spec/core/dsl_spec.sh +++ b/spec/core/dsl_spec.sh @@ -313,8 +313,8 @@ Describe "core/dsl.sh" SHELLSPEC_STDIO_FILE_BASE=1-2-3 } check() { - echo $SHELLSPEC_EXAMPLE_NO - echo $SHELLSPEC_STDIO_FILE_BASE + echo "$SHELLSPEC_EXAMPLE_NO" + echo "$SHELLSPEC_STDIO_FILE_BASE" } BeforeRun setup AfterRun check diff --git a/spec/core/modifiers/contents_spec.sh b/spec/core/modifiers/contents_spec.sh index fd8d223f..fcb825d6 100644 --- a/spec/core/modifiers/contents_spec.sh +++ b/spec/core/modifiers/contents_spec.sh @@ -43,9 +43,9 @@ Describe "core/modifiers/contents.sh" Describe "entire contents modifier" Example 'example' - The entire contents of file "$FILE" should equal "a${IFS%?}${IFS%?}" - The entire contents of the file "$FILE" should equal "a${IFS%?}${IFS%?}" - The file "$FILE" entire contents should equal "a${IFS%?}${IFS%?}" + The entire contents of file "$FILE" should equal "a${SHELLSPEC_LF}${SHELLSPEC_LF}" + The entire contents of the file "$FILE" should equal "a${SHELLSPEC_LF}${SHELLSPEC_LF}" + The file "$FILE" entire contents should equal "a${SHELLSPEC_LF}${SHELLSPEC_LF}" End It 'reads the entire contents of the file when file exists' @@ -54,7 +54,7 @@ Describe "core/modifiers/contents.sh" AfterRun preserve When run shellspec_modifier_entire_contents _modifier_ - The entire stdout should equal "a${IFS%?}${IFS%?}" + The entire stdout should equal "a${SHELLSPEC_LF}${SHELLSPEC_LF}" The variable META should eq 'text' End diff --git a/spec/core/modifiers/result_spec.sh b/spec/core/modifiers/result_spec.sh index b8f0c9d1..9840ce82 100644 --- a/spec/core/modifiers/result_spec.sh +++ b/spec/core/modifiers/result_spec.sh @@ -1,5 +1,7 @@ # shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 +% FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" + Describe "core/modifiers/result.sh" BeforeRun set_subject modifier_mock @@ -38,7 +40,7 @@ Describe "core/modifiers/result.sh" subject() { %- "success_with_output"; } success_with_output() { echo stdout; true; } preserve() { %preserve SHELLSPEC_META:META; } - BeforeRun "SHELLSPEC_STDOUT_FILE=/dev/no-such-a-file" + BeforeRun 'SHELLSPEC_STDOUT_FILE=$FIXTURE/no-such-a-file' AfterRun preserve When run shellspec_modifier_result _modifier_ diff --git a/spec/general_spec.sh b/spec/general_spec.sh index f66fcd89..27d50ee2 100644 --- a/spec/general_spec.sh +++ b/spec/general_spec.sh @@ -256,24 +256,26 @@ Describe "general.sh" End Describe 'shellspec_putsn()' + lf="$SHELLSPEC_LF" + It 'does not output anything without arguments' When call shellspec_putsn - The entire stdout should equal "${IFS%?}" + The entire stdout should equal "${lf}" End It 'outputs append with LF' When call shellspec_putsn "a" - The entire stdout should equal "a${IFS%?}" + The entire stdout should equal "a${lf}" End It 'joins arguments with space and outputs append with LF' When call shellspec_putsn "a" "b" - The entire stdout should equal "a b${IFS%?}" + The entire stdout should equal "a b${lf}" End It 'outputs with raw string append with LF' When call shellspec_putsn 'a\b' - The entire stdout should equal "a\\b${IFS%?}" + The entire stdout should equal "a\\b${lf}" The length of entire stdout should equal 4 End @@ -281,7 +283,7 @@ Describe "general.sh" It 'joins arguments with spaces' BeforeRun 'IFS=@' When run shellspec_putsn a b c - The entire stdout should equal "a b c${IFS%?}" + The entire stdout should equal "a b c${lf}" End End End @@ -886,7 +888,7 @@ Describe "general.sh" End Describe "shellspec_chomp()" - Before "var='string${IFS%?}${IFS%?}${IFS%?}'" + Before "var='string${SHELLSPEC_LF}${SHELLSPEC_LF}${SHELLSPEC_LF}'" It "removes trailing LF" When call shellspec_chomp var The variable var should eq "string" diff --git a/spec/libexec/binary_spec.sh b/spec/libexec/binary_spec.sh index 138ef95a..d387cdc4 100644 --- a/spec/libexec/binary_spec.sh +++ b/spec/libexec/binary_spec.sh @@ -4,8 +4,8 @@ Describe "libexec/binary.sh" Include "$SHELLSPEC_LIB/libexec/binary.sh" Describe 'od_command()' - od() { echo "od"; } - hexdump() { echo "hexdump"; } + shellspec_od() { echo "od"; } + shellspec_hexdump() { echo "hexdump"; } Context "when od command available" It 'calls od command' @@ -15,7 +15,7 @@ Describe "libexec/binary.sh" End Context "when od command not available" - od() { echo "od: command not found" >&2; return 127; } + shellspec_od() { echo "od: command not found" >&2; return 127; } It 'calls hexdump command' When call od_command The stdout should eq 'hexdump' @@ -23,7 +23,7 @@ Describe "libexec/binary.sh" End Context "when tod command does not support -t option" - od() { + shellspec_od() { [ "$1" = "-t" ] && return 1 echo "od" "$@" } @@ -35,9 +35,6 @@ Describe "libexec/binary.sh" End Describe 'octal_dump()' - od() { @od "$@"; } - hexdump() { @hexdump "$@"; } - It 'outputs as octal number' Data "abc" When call octal_dump diff --git a/spec/libexec/reporter_spec.sh b/spec/libexec/reporter_spec.sh index 36d00a25..f2c83f78 100644 --- a/spec/libexec/reporter_spec.sh +++ b/spec/libexec/reporter_spec.sh @@ -28,10 +28,11 @@ Describe "libexec/reporter.sh" Describe "read_time_log()" Before "prefix_real=0 prefix_user=0 prefix_sys=0" It "does not read anything if file missing" - When call read_time_log prefix "$FILE.not-exits" + When call read_time_log prefix "$FILE.not-exists" The variable prefix_real should eq '' The variable prefix_user should eq '' The variable prefix_sys should eq '' + The variable prefix_type should eq '' The status should be failure End @@ -40,6 +41,7 @@ Describe "libexec/reporter.sh" The variable prefix_real should equal 1.23 The variable prefix_user should equal 0.11 The variable prefix_sys should equal 12.45 + The variable prefix_type should equal external The status should be success End End diff --git a/spec/libexec/translator_spec.sh b/spec/libexec/translator_spec.sh index 9411f844..9a352c22 100644 --- a/spec/libexec/translator_spec.sh +++ b/spec/libexec/translator_spec.sh @@ -949,7 +949,7 @@ Describe "libexec/translator.sh" Describe "remove_from_ranges()" BeforeRun "ranges='1 2 3 1 2 3'" - AfterRun 'echo $ranges' + AfterRun 'echo "$ranges"' It "removes matched range" is_in_range() { [ "$1" = "2" ]; }