From 93e98dcb4b44a0c42d40a17fc3050c68abe41014 Mon Sep 17 00:00:00 2001 From: Luca Salvarani Date: Sun, 13 Nov 2022 00:57:39 +0100 Subject: [PATCH 01/50] fix: Added support for comma (`,`) as decimal separator in some locales - Fixes #274 The `--profiler` option now works as expected on locales which had the decimal separator set as comma (`,`) and not period (`.`), such as Italian, Spanish, French and many others. --- lib/libexec/reporter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libexec/reporter.sh b/lib/libexec/reporter.sh index 7f1e1921..7c9845c0 100644 --- a/lib/libexec/reporter.sh +++ b/lib/libexec/reporter.sh @@ -22,7 +22,7 @@ read_time_log() { # 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 + case ${line##*[ $TAB]} in (*[!0-9.,]*) continue; esac eval "$1_${line%%[ $TAB]*}=\"\${line##*[ \$TAB]}\"" esac done < "$2" &&: From 65c924bb35f74fc64e7e19482323f279c494dba8 Mon Sep 17 00:00:00 2001 From: hoijui Date: Fri, 31 Mar 2023 09:14:37 +0200 Subject: [PATCH 02/50] README: Adds link explaining what BDD means For those of us in the unknown, like me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 539eaaf7..9f8d2058 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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 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. [![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) From 321e6f2f7282434f07c7685b4ea3a9992d9f084f Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Wed, 8 May 2024 21:50:12 +0900 Subject: [PATCH 03/50] specfiles mulst not depend on IFS values --- spec/core/modifiers/contents_spec.sh | 8 ++++---- spec/general_spec.sh | 14 ++++++++------ spec/libexec/translator_spec.sh | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) 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/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/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" ]; } From 699ebb52a569311a55b45f1bc4038d37b9a1de8e Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Thu, 9 May 2024 22:20:43 +0900 Subject: [PATCH 04/50] Workaround for bash 5.2 See https://github.com/shellspec/shellspec/issues/312 --- lib/core/matchers.sh | 5 ++++- lib/core/modifiers/contents.sh | 10 ++++++++-- lib/core/modifiers/length.sh | 5 ++++- lib/core/modifiers/line.sh | 5 ++++- lib/core/modifiers/lines.sh | 5 ++++- lib/core/modifiers/result.sh | 5 ++++- lib/core/modifiers/word.sh | 5 ++++- lib/core/subjects/fd.sh | 10 ++++++++-- lib/core/subjects/line.sh | 5 ++++- lib/core/subjects/path.sh | 5 ++++- lib/core/subjects/status.sh | 5 ++++- lib/core/subjects/stderr.sh | 10 ++++++++-- lib/core/subjects/stdout.sh | 10 ++++++++-- lib/core/subjects/value.sh | 5 ++++- lib/core/subjects/variable.sh | 5 ++++- lib/core/subjects/word.sh | 5 ++++- 16 files changed, 80 insertions(+), 20 deletions(-) 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/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 } From eeaafa9e12052e73acdbccd44353685efd8f5802 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Fri, 10 May 2024 22:27:20 +0900 Subject: [PATCH 05/50] Workaround for OpenBSD >= 7.4 --- lib/libexec/shellspec.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libexec/shellspec.sh b/lib/libexec/shellspec.sh index 1a12f8d0..b44621a1 100644 --- a/lib/libexec/shellspec.sh +++ b/lib/libexec/shellspec.sh @@ -116,7 +116,10 @@ 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 From 7c1f0d406b28d70ff8264b5ceb97e926cb4e4d61 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Fri, 10 May 2024 22:28:18 +0900 Subject: [PATCH 06/50] Update dockerfiles for testing --- ...sh-4.4.20 => almalinux-8.9-20240410-sh-4.4.20} | 2 +- dockerfiles/almalinux-9.4-20240506-sh-5.1.8 | 3 +++ dockerfiles/alpine-3.15.4-bash-5.1.16 | 3 --- ...e-3.15.4-loksh-7.0 => alpine-3.19.1-loksh-7.4} | 2 +- dockerfiles/alpine-3.19.1-oksh-7.4 | 3 +++ ...e-3.15.4-sh-1.34.1 => alpine-3.19.1-sh-1.36.1} | 2 +- ...lpine-edge-loksh-7.1 => alpine-edge-loksh-7.5} | 0 dockerfiles/alpine-edge-oksh-7.0 | 4 ---- dockerfiles/alpine-edge-oksh-7.5 | 3 +++ dockerfiles/bash-5.2.26 | 3 +++ dockerfiles/bash-5.3-alpha | 3 +++ dockerfiles/bash-devel | 3 +++ dockerfiles/busybox-1.34.1-sh-1.34.1 | 2 +- dockerfiles/busybox-1.35.0-sh-1.35.0 | 2 +- dockerfiles/busybox-1.36.1-sh-1.36.1 | 3 +++ dockerfiles/centos-stream8-sh-4.4.20 | 3 +++ dockerfiles/centos-stream9-sh-6.1.8 | 3 +++ dockerfiles/chimera-latest-sh | 4 ++++ ...n-10.12-bash-5.0.3 => debian-10.13-bash-5.0.3} | 2 +- ...busybox-1.30.1 => debian-10.13-busybox-1.30.1} | 2 +- ...2-dash-0.5.10.2 => debian-10.13-dash-0.5.10.2} | 2 +- ...{debian-10.12-ksh-93u => debian-10.13-ksh-93u} | 2 +- ...{debian-10.12-lksh-57 => debian-10.13-lksh-57} | 2 +- ...{debian-10.12-mksh-57 => debian-10.13-mksh-57} | 2 +- ...10.12-posh-0.13.2 => debian-10.13-posh-0.13.2} | 2 +- ...ian-10.12-yash-2.48 => debian-10.13-yash-2.48} | 2 +- ...ian-10.12-zsh-5.7.1 => debian-10.13-zsh-5.7.1} | 2 +- ...ian-11.3-bash-5.1.4 => debian-11.9-bash-5.1.4} | 2 +- ...-busybox-1.30.1 => debian-11.9-busybox-1.30.1} | 2 +- ...n-11.3-dash-0.5.11 => debian-11.9-dash-0.5.11} | 2 +- .../{debian-11.3-ksh-93u => debian-11.9-ksh-93u} | 2 +- .../{debian-11.3-lksh-59 => debian-11.9-lksh-59} | 2 +- .../{debian-11.3-mksh-59 => debian-11.9-mksh-59} | 2 +- ...n-11.3-posh-0.14.1 => debian-11.9-posh-0.14.1} | 2 +- ...ebian-11.3-yash-2.50 => debian-11.9-yash-2.50} | 2 +- .../{debian-11.3-zsh-5.8 => debian-11.9-zsh-5.8} | 2 +- ...okworm-bash-5.1.16 => debian-12.5-bash-5.2.15} | 2 +- dockerfiles/debian-12.5-busybox-1.35.0 | 6 ++++++ dockerfiles/debian-12.5-dash-0.5.12 | 4 ++++ ...bookworm-ksh93um => debian-12.5-ksh93um-1.0.4} | 2 +- dockerfiles/debian-12.5-lksh-59 | 5 +++++ dockerfiles/debian-12.5-mksh-59 | 5 +++++ dockerfiles/debian-12.5-posh-0.14.1 | 5 +++++ ...n-bookworm-yash-2.52 => debian-12.5-yash-2.52} | 2 +- ...ian-bookworm-zsh-5.8.1 => debian-12.5-zsh-5.9} | 2 +- dockerfiles/debian-8.11-bash-4.3.30 | 2 +- dockerfiles/debian-8.11-busybox-1.22.0 | 4 +++- dockerfiles/debian-8.11-dash-0.5.7 | 2 +- dockerfiles/debian-8.11-ksh-93u | 4 +++- dockerfiles/debian-8.11-lksh-50d | 4 +++- dockerfiles/debian-8.11-mksh-50d | 4 +++- dockerfiles/debian-8.11-posh-0.12.3 | 4 +++- dockerfiles/debian-8.11-yash-2.36 | 4 +++- dockerfiles/debian-8.11-zsh-5.0.7 | 4 +++- dockerfiles/debian-9.13-bash-4.4.12 | 2 +- dockerfiles/debian-9.13-busybox-1.22.0 | 4 +++- dockerfiles/debian-9.13-dash-0.5.8 | 2 +- dockerfiles/debian-9.13-ksh-93u | 4 +++- dockerfiles/debian-9.13-lksh-54 | 4 +++- dockerfiles/debian-9.13-mksh-54 | 4 +++- dockerfiles/debian-9.13-posh-0.12.6 | 4 +++- dockerfiles/debian-9.13-yash-2.43 | 4 +++- dockerfiles/debian-9.13-zsh-5.3.1 | 4 +++- .../{fedora-34-sh-5.1.0 => fedora-39-sh-5.2.26} | 2 +- .../{fedora-35-sh-5.1.8 => fedora-40-sh-5.2.26} | 2 +- dockerfiles/openwrt-10.03.1-sh-1.15.3-! | 6 +++--- dockerfiles/openwrt-12.09-sh-1.19.4-! | 6 +++--- dockerfiles/openwrt-14.07-sh-1.22.1 | 6 +++--- dockerfiles/openwrt-15.05.1-sh-1.23.2 | 6 +++--- ...1.02.3-sh-1.33.2 => openwrt-21.02.7-sh-1.33.2} | 4 ++-- ....0-rc1-sh-1.35.0 => openwrt-22.03.6-sh-1.35.0} | 4 ++-- dockerfiles/openwrt-23.05.3-sh-1.36.1 | 15 +++++++++++++++ 72 files changed, 162 insertions(+), 70 deletions(-) rename dockerfiles/{almalinux-8.5-20220306-sh-4.4.20 => almalinux-8.9-20240410-sh-4.4.20} (55%) create mode 100644 dockerfiles/almalinux-9.4-20240506-sh-5.1.8 delete mode 100644 dockerfiles/alpine-3.15.4-bash-5.1.16 rename dockerfiles/{alpine-3.15.4-loksh-7.0 => alpine-3.19.1-loksh-7.4} (77%) create mode 100644 dockerfiles/alpine-3.19.1-oksh-7.4 rename dockerfiles/{alpine-3.15.4-sh-1.34.1 => alpine-3.19.1-sh-1.36.1} (65%) rename dockerfiles/{alpine-edge-loksh-7.1 => alpine-edge-loksh-7.5} (100%) delete mode 100644 dockerfiles/alpine-edge-oksh-7.0 create mode 100644 dockerfiles/alpine-edge-oksh-7.5 create mode 100644 dockerfiles/bash-5.2.26 create mode 100644 dockerfiles/bash-5.3-alpha create mode 100644 dockerfiles/bash-devel create mode 100644 dockerfiles/busybox-1.36.1-sh-1.36.1 create mode 100644 dockerfiles/centos-stream8-sh-4.4.20 create mode 100644 dockerfiles/centos-stream9-sh-6.1.8 create mode 100644 dockerfiles/chimera-latest-sh rename dockerfiles/{debian-10.12-bash-5.0.3 => debian-10.13-bash-5.0.3} (80%) rename dockerfiles/{debian-10.12-busybox-1.30.1 => debian-10.13-busybox-1.30.1} (88%) rename dockerfiles/{debian-10.12-dash-0.5.10.2 => debian-10.13-dash-0.5.10.2} (80%) rename dockerfiles/{debian-10.12-ksh-93u => debian-10.13-ksh-93u} (85%) rename dockerfiles/{debian-10.12-lksh-57 => debian-10.13-lksh-57} (86%) rename dockerfiles/{debian-10.12-mksh-57 => debian-10.13-mksh-57} (86%) rename dockerfiles/{debian-10.12-posh-0.13.2 => debian-10.13-posh-0.13.2} (87%) rename dockerfiles/{debian-10.12-yash-2.48 => debian-10.13-yash-2.48} (86%) rename dockerfiles/{debian-10.12-zsh-5.7.1 => debian-10.13-zsh-5.7.1} (86%) rename dockerfiles/{debian-11.3-bash-5.1.4 => debian-11.9-bash-5.1.4} (81%) rename dockerfiles/{debian-11.3-busybox-1.30.1 => debian-11.9-busybox-1.30.1} (88%) rename dockerfiles/{debian-11.3-dash-0.5.11 => debian-11.9-dash-0.5.11} (81%) rename dockerfiles/{debian-11.3-ksh-93u => debian-11.9-ksh-93u} (86%) rename dockerfiles/{debian-11.3-lksh-59 => debian-11.9-lksh-59} (86%) rename dockerfiles/{debian-11.3-mksh-59 => debian-11.9-mksh-59} (86%) rename dockerfiles/{debian-11.3-posh-0.14.1 => debian-11.9-posh-0.14.1} (87%) rename dockerfiles/{debian-11.3-yash-2.50 => debian-11.9-yash-2.50} (86%) rename dockerfiles/{debian-11.3-zsh-5.8 => debian-11.9-zsh-5.8} (86%) rename dockerfiles/{debian-bookworm-bash-5.1.16 => debian-12.5-bash-5.2.15} (78%) create mode 100644 dockerfiles/debian-12.5-busybox-1.35.0 create mode 100644 dockerfiles/debian-12.5-dash-0.5.12 rename dockerfiles/{debian-bookworm-ksh93um => debian-12.5-ksh93um-1.0.4} (84%) create mode 100644 dockerfiles/debian-12.5-lksh-59 create mode 100644 dockerfiles/debian-12.5-mksh-59 create mode 100644 dockerfiles/debian-12.5-posh-0.14.1 rename dockerfiles/{debian-bookworm-yash-2.52 => debian-12.5-yash-2.52} (84%) rename dockerfiles/{debian-bookworm-zsh-5.8.1 => debian-12.5-zsh-5.9} (84%) rename dockerfiles/{fedora-34-sh-5.1.0 => fedora-39-sh-5.2.26} (70%) rename dockerfiles/{fedora-35-sh-5.1.8 => fedora-40-sh-5.2.26} (70%) rename dockerfiles/{openwrt-21.02.3-sh-1.33.2 => openwrt-21.02.7-sh-1.33.2} (73%) rename dockerfiles/{openwrt-22.03.0-rc1-sh-1.35.0 => openwrt-22.03.6-sh-1.35.0} (69%) create mode 100644 dockerfiles/openwrt-23.05.3-sh-1.36.1 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/almalinux-9.4-20240506-sh-5.1.8 b/dockerfiles/almalinux-9.4-20240506-sh-5.1.8 new file mode 100644 index 00000000..466fa9ec --- /dev/null +++ b/dockerfiles/almalinux-9.4-20240506-sh-5.1.8 @@ -0,0 +1,3 @@ +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-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/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/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 From 096274ad14fb04db5211c1d3b3613158a77a9c74 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 00:55:17 +0900 Subject: [PATCH 07/50] Workaround for yash >= 2.54 --- dockerfiles/debian-trixie-yash-2.55 | 5 +++++ helper/support/bin/[ | 4 ++++ helper/support/bin/echo | 4 ++++ helper/support/bin/test | 4 ++++ libexec/shellspec-inspection.sh | 35 ++++++++++++++++++++--------- 5 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 dockerfiles/debian-trixie-yash-2.55 create mode 100755 helper/support/bin/[ create mode 100755 helper/support/bin/echo create mode 100755 helper/support/bin/test 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/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/libexec/shellspec-inspection.sh b/libexec/shellspec-inspection.sh index c458d42a..b1bb3146 100755 --- a/libexec/shellspec-inspection.sh +++ b/libexec/shellspec-inspection.sh @@ -147,36 +147,49 @@ set_path() { PATH="$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 "$@" +} + # shellcheck disable=SC2123 -set_path / -if [ "$SHELLSPEC_SANDBOX" ] && ! $SHELLSPEC_SHELL -c ":" 2>/dev/null; then - # busybox ash on cygwin - echo "SHELLSPEC_DEFECT_SANDBOX=1" +if [ "$SHELLSPEC_SANDBOX" ]; then + 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 echo "SHELLSPEC_SHOPT_AVAILABLE=1" # shellcheck disable=SC3044 - if shopt -s failglob 2>/dev/null; then + if run_builtin shopt -s failglob 2>/dev/null; then echo "SHELLSPEC_FAILGLOB_AVAILABLE=1" 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 From ca77d7a9779c8384672e41e3c0ecedfb5b3dd8ed Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 07:28:00 +0900 Subject: [PATCH 08/50] actions: Update test environments --- ...{macos-catalina.yml => macos-monterey.yml} | 4 +-- .github/workflows/macos-sonoma.yml | 24 ++++++++++++++++ .github/workflows/macos-ventura.yml | 24 ++++++++++++++++ .github/workflows/ubuntu-jammy.yml | 28 +++++++++++++++++++ .../{ubuntu-bionic.yml => ubuntu-noble.yml} | 6 ++-- .github/workflows/windows-busybox.yml | 2 +- 6 files changed, 82 insertions(+), 6 deletions(-) rename .github/workflows/{macos-catalina.yml => macos-monterey.yml} (92%) create mode 100644 .github/workflows/macos-sonoma.yml create mode 100644 .github/workflows/macos-ventura.yml create mode 100644 .github/workflows/ubuntu-jammy.yml rename .github/workflows/{ubuntu-bionic.yml => ubuntu-noble.yml} (92%) 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/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 From 872aad2cc1452d5cc87d65d665379f6a18285a29 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 08:18:06 +0900 Subject: [PATCH 09/50] Update dockerfiles for testing --- dockerfiles/.gwsh-main-b577fdc | 15 +++++++++++++++ dockerfiles/.gwsh-snapshot-20190627 | 15 --------------- ...sh-20210723 => .schily-20240321-bosh-20230112} | 11 +++++------ ...h-20210723 => .schily-20240321-pbosh-20230112} | 11 +++++------ dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 | 3 --- 5 files changed, 25 insertions(+), 30 deletions(-) create mode 100644 dockerfiles/.gwsh-main-b577fdc delete mode 100644 dockerfiles/.gwsh-snapshot-20190627 rename dockerfiles/{.schily-20210918-bosh-20210723 => .schily-20240321-bosh-20230112} (52%) rename dockerfiles/{.schily-20210918-pbosh-20210723 => .schily-20240321-pbosh-20230112} (52%) delete mode 100644 dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 diff --git a/dockerfiles/.gwsh-main-b577fdc b/dockerfiles/.gwsh-main-b577fdc new file mode 100644 index 00000000..bfbffa8c --- /dev/null +++ b/dockerfiles/.gwsh-main-b577fdc @@ -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/b577fdc.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/.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/.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/dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 b/dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 deleted file mode 100644 index ada36233..00000000 --- a/dockerfiles/rockylinux-8.5.20220308-sh-4.4.20 +++ /dev/null @@ -1,3 +0,0 @@ -FROM rockylinux:8.5.20220308 -RUN useradd -m user -ENV SH=/bin/sh From e4bc4adc980afea13baf7bd2f69135dd61798254 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 08:21:13 +0900 Subject: [PATCH 10/50] actions: remove ubuntu-noble as it is not yet supported --- .github/workflows/ubuntu-noble.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 .github/workflows/ubuntu-noble.yml diff --git a/.github/workflows/ubuntu-noble.yml b/.github/workflows/ubuntu-noble.yml deleted file mode 100644 index f39e11a6..00000000 --- a/.github/workflows/ubuntu-noble.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Ubuntu Noble Numbat - -on: [push, pull_request] - -env: - FORCE_COLOR: 1 - -jobs: - ubuntu-noble: - runs-on: ubuntu-24.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 From b0829ae486bcb8a9a0b78a2d0198252bd0d6d5f6 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 08:35:14 +0900 Subject: [PATCH 11/50] circleci: update versions --- .circleci/config.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 69f492a2..cec8e9b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,19 +1,20 @@ 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: @@ -88,4 +89,4 @@ workflows: - test: matrix: parameters: - os: [xcode10, xcode11, xcode12, xcode13] + os: [macos11, macos12, macos13, macos14] From 295e0bbe185bc529c6149b83f4571b189e224a2a Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 08:39:18 +0900 Subject: [PATCH 12/50] cirrusci: Update Versions --- .cirrus.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c572efde..957914a3 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-2 + - image_family: freebsd-14-0 + - image_family: freebsd-15-0-snap install_script: pkg install -y dash bash zsh ksh93 mksh oksh prepare_script: - ./shellspec --task fixture:stat:prepare From b478a0bf0a38801b5a23c2c19c4074153ddc8281 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 09:01:41 +0900 Subject: [PATCH 13/50] Remove testing by Travis CI --- .travis.yml | 27 --------------------------- README.md | 4 +--- docs/shells.md | 3 +-- 3 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 .travis.yml 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..32ae3a88 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ 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. [![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)
@@ -215,13 +214,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 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) From d0bd7ebaec717eb57dcc92afe8310ef25f376b41 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 09:44:01 +0900 Subject: [PATCH 14/50] Fix for posh on cygwin shopt is built into cygwin's posh? why? ``` $ posh -c 'type shopt; shopt' shopt is a shell builtin posh: shopt: not found ``` --- libexec/shellspec-inspection.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/shellspec-inspection.sh b/libexec/shellspec-inspection.sh index b1bb3146..6da3c74c 100755 --- a/libexec/shellspec-inspection.sh +++ b/libexec/shellspec-inspection.sh @@ -181,10 +181,10 @@ 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 run_builtin shopt -s failglob 2>/dev/null; then + if shopt -s failglob 2>/dev/null; then echo "SHELLSPEC_FAILGLOB_AVAILABLE=1" fi fi From b0be62d5019122da68b6751ecaf8e905738ec675 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 11:06:12 +0900 Subject: [PATCH 15/50] Fix for busybox-w32 --- shellspec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shellspec b/shellspec index 8d80a7d6..fd2de5c1 100755 --- a/shellspec +++ b/shellspec @@ -359,6 +359,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 From 304c130a097421833e9aa8fce4cfb527d6f6fcd7 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 16:24:23 +0900 Subject: [PATCH 16/50] Update shellcheck --- .circleci/config.yml | 2 +- .dockerignore | 1 + .shellcheck-version | 2 +- lib/core/statement.sh | 2 +- libexec/shellspec-inspection.sh | 2 +- spec/core/dsl_spec.sh | 4 ++-- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cec8e9b1..aa002367 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,7 +19,7 @@ executors: 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') 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/.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/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/libexec/shellspec-inspection.sh b/libexec/shellspec-inspection.sh index 6da3c74c..12d02494 100755 --- a/libexec/shellspec-inspection.sh +++ b/libexec/shellspec-inspection.sh @@ -160,8 +160,8 @@ run_builtin() { run_with_path /dev/null "$@" } -# shellcheck disable=SC2123 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" 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 From b27d3c622c4f266133bcc7b66e58717043af8fd0 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 16:31:23 +0900 Subject: [PATCH 17/50] Add .shellcheckrc --- .shellcheckrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000..0b9bd325 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +disable=SC2317 From 2f8ceba426e226a89507d6986b6575945acf8a4a Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 18:10:41 +0900 Subject: [PATCH 18/50] actions: Add breebsd-14.yml --- .github/workflows/freebsd-14.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/freebsd-14.yml diff --git a/.github/workflows/freebsd-14.yml b/.github/workflows/freebsd-14.yml new file mode 100644 index 00000000..453f0dc3 --- /dev/null +++ b/.github/workflows/freebsd-14.yml @@ -0,0 +1,19 @@ +name: FreeBSD 14 + +on: [push, pull_request] + +jobs: + freebsd-14: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + matrix: + shells: + - {shell: sh} + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: vmactions/freebsd-vm@v1 + with: + usesh: true + run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh + From a01dc0e08702ae52774e77a46ac3f66cf25f111e Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 18:15:55 +0900 Subject: [PATCH 19/50] actions: Fix freebsd-14.yml --- .github/workflows/freebsd-14.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/freebsd-14.yml b/.github/workflows/freebsd-14.yml index 453f0dc3..b822f3ab 100644 --- a/.github/workflows/freebsd-14.yml +++ b/.github/workflows/freebsd-14.yml @@ -6,6 +6,7 @@ jobs: freebsd-14: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" + strategy: matrix: shells: - {shell: sh} From cfd0ca93c9bd37761339ce37ec6f5f4cb4768f65 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 18:25:43 +0900 Subject: [PATCH 20/50] Add yaml files for FreeBSD --- .github/workflows/freebsd-12.yml | 23 +++++++++++++++++++++++ .github/workflows/freebsd-13.yml | 23 +++++++++++++++++++++++ .github/workflows/freebsd-14.yml | 5 ++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/freebsd-12.yml create mode 100644 .github/workflows/freebsd-13.yml 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 index b822f3ab..30a01ef8 100644 --- a/.github/workflows/freebsd-14.yml +++ b/.github/workflows/freebsd-14.yml @@ -2,6 +2,9 @@ name: FreeBSD 14 on: [push, pull_request] +env: + FORCE_COLOR: 1 + jobs: freebsd-14: runs-on: ubuntu-latest @@ -16,5 +19,5 @@ jobs: - uses: vmactions/freebsd-vm@v1 with: usesh: true + release: "14.0" run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh - From a0e5678a40bd22b46256d5a111aa2ea4adea7c19 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 19:04:46 +0900 Subject: [PATCH 21/50] actions: Add BSD & Solaris VMs --- .github/workflows/dragonflybsd-6.4.yml | 23 ++++++++++++++++++++++ .github/workflows/netbsd-10.yml | 23 ++++++++++++++++++++++ .github/workflows/netbsd-9.yml | 23 ++++++++++++++++++++++ .github/workflows/openbsd7.3.yml | 24 +++++++++++++++++++++++ .github/workflows/openbsd7.4.yml | 24 +++++++++++++++++++++++ .github/workflows/openbsd7.5.yml | 24 +++++++++++++++++++++++ .github/workflows/solaris-11.4.yml | 27 ++++++++++++++++++++++++++ 7 files changed, 168 insertions(+) create mode 100644 .github/workflows/dragonflybsd-6.4.yml create mode 100644 .github/workflows/netbsd-10.yml create mode 100644 .github/workflows/netbsd-9.yml create mode 100644 .github/workflows/openbsd7.3.yml create mode 100644 .github/workflows/openbsd7.4.yml create mode 100644 .github/workflows/openbsd7.5.yml create mode 100644 .github/workflows/solaris-11.4.yml diff --git a/.github/workflows/dragonflybsd-6.4.yml b/.github/workflows/dragonflybsd-6.4.yml new file mode 100644 index 00000000..8057f97a --- /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/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..6e2daeec --- /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..635c6900 --- /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..308d2faf --- /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..ab5a1ffd --- /dev/null +++ b/.github/workflows/solaris-11.4.yml @@ -0,0 +1,27 @@ +name: Solaris 11.4 + +on: [push, pull_request] + +env: + 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 From 05e05ca2a7ee7b6187b207d99b8f742ae6e2bb5d Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 19:10:55 +0900 Subject: [PATCH 22/50] actions: Fix yaml files --- .github/workflows/dragonflybsd-6.4.yml | 2 +- .github/workflows/openbsd7.3.yml | 2 +- .github/workflows/openbsd7.4.yml | 2 +- .github/workflows/openbsd7.5.yml | 2 +- .github/workflows/solaris-11.4.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dragonflybsd-6.4.yml b/.github/workflows/dragonflybsd-6.4.yml index 8057f97a..62950f67 100644 --- a/.github/workflows/dragonflybsd-6.4.yml +++ b/.github/workflows/dragonflybsd-6.4.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 jobs: - dragonflybsd-6.4: + dragonflybsd-6_4: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: diff --git a/.github/workflows/openbsd7.3.yml b/.github/workflows/openbsd7.3.yml index 6e2daeec..0471a4f0 100644 --- a/.github/workflows/openbsd7.3.yml +++ b/.github/workflows/openbsd7.3.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 jobs: - openbsd-7.3: + openbsd-7_3: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: diff --git a/.github/workflows/openbsd7.4.yml b/.github/workflows/openbsd7.4.yml index 635c6900..2cdeaa80 100644 --- a/.github/workflows/openbsd7.4.yml +++ b/.github/workflows/openbsd7.4.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 jobs: - openbsd-7.4: + openbsd-7_4: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: diff --git a/.github/workflows/openbsd7.5.yml b/.github/workflows/openbsd7.5.yml index 308d2faf..38f3e78c 100644 --- a/.github/workflows/openbsd7.5.yml +++ b/.github/workflows/openbsd7.5.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 jobs: - openbsd-7.5: + openbsd-7_5: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: diff --git a/.github/workflows/solaris-11.4.yml b/.github/workflows/solaris-11.4.yml index ab5a1ffd..4db61739 100644 --- a/.github/workflows/solaris-11.4.yml +++ b/.github/workflows/solaris-11.4.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 jobs: - solaris-11.4: + solaris-11_4: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: From 0b4077fb60e36039fd09065bd2bfecfec4b4cc86 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 19:55:22 +0900 Subject: [PATCH 23/50] Fix for /usr/xpg4/bin/sh on Solaris 11.4.42 --- lib/libexec/reporter/junit_formatter.sh | 6 +++--- shellspec | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 *\ Date: Sat, 11 May 2024 22:16:23 +0900 Subject: [PATCH 24/50] LANG=C for /usr/xpg4/bin/sh on Solaris 11.4 Solaris 11.4 does not include C.UTF-8 By default, the following errors are output couldn't set locale correctly --- .github/workflows/solaris-11.4.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/solaris-11.4.yml b/.github/workflows/solaris-11.4.yml index 4db61739..deb6973e 100644 --- a/.github/workflows/solaris-11.4.yml +++ b/.github/workflows/solaris-11.4.yml @@ -3,6 +3,7 @@ name: Solaris 11.4 on: [push, pull_request] env: + LANG: C FORCE_COLOR: 1 jobs: From 4c0d195d2d3c6ceee0d813eca8479481a26657e6 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 23:51:51 +0900 Subject: [PATCH 25/50] [ci skip] Update README.md --- README.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 32ae3a88..f37d7687 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,22 @@ 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. -[![GitHub Actions Status](https://img.shields.io/github/workflow/status/shellspec/shellspec/Release?label=GithubActions&style=flat-square)](https://github.com/shellspec/shellspec/actions) +[![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=OpenBSD&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) + [![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) @@ -116,6 +127,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) @@ -152,7 +164,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) @@ -1313,13 +1325,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 From e920018627ba2cb956ab8ca568aa1a3220a2ba25 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sat, 11 May 2024 23:57:53 +0900 Subject: [PATCH 26/50] [ci skip] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f37d7687..1f0834f7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ShellSpec is a **full-featured BDD unit testing framework** for dash, bash, ksh, [![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=OpenBSD&style=flat-square)](https://github.com/shellspec/shellspec/actions/workflows/dragonflybsd-6.4.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) From a834ed32dc54cafaf6a03a3c1081aef1e688b44a Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sun, 12 May 2024 07:04:42 +0900 Subject: [PATCH 27/50] [ci skip] Update README.md --- README.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1f0834f7..f708c18d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ShellSpec +# ShellSpec: full-featured BDD unit testing framework 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. @@ -12,7 +12,16 @@ ShellSpec is a **full-featured BDD unit testing framework** for dash, bash, ksh, [![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) +[![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-≥93s-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/) [![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) @@ -26,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. @@ -2215,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)) From 61ea29e1893b814a864619ae71a3431eac7e83ab Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 13 May 2024 21:03:21 +0900 Subject: [PATCH 28/50] Prefer to use POSIX commands internally Use POSIX commands if possible for better portability. It is also a workaround for the problem that Solaris 10's minimum configuration does not include the od command. --- helper/ksh_workaround.sh | 2 ++ lib/general.sh | 2 ++ lib/libexec/binary.sh | 6 +++--- lib/libexec/shellspec.sh | 10 +++++----- shellspec | 7 +++++++ spec/libexec/binary_spec.sh | 11 ++++------- 6 files changed, 23 insertions(+), 15 deletions(-) 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/lib/general.sh b/lib/general.sh index f6df5735..23c6033d 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -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/shellspec.sh b/lib/libexec/shellspec.sh index b44621a1..57f5cd98 100644 --- a/lib/libexec/shellspec.sh +++ b/lib/libexec/shellspec.sh @@ -124,11 +124,11 @@ current_shell() { # 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 -- "$@" "${SHELLSPEC_POSIX_PATH:-"$PATH"}${SHELLSPEC_PATHSEP}" case $2 in (*/*) [ -x "$2" ] || return 1 diff --git a/shellspec b/shellspec index 70f9e5a9..ae3ac2b8 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='' @@ -87,6 +88,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}" @@ -402,6 +407,8 @@ fi command_path SHELLSPEC_LS "ls" ||: command_path SHELLSPEC_SORT "sort" ||: command_path SHELLSPEC_FIND "find" ||: + command_path SHELLSPEC_OD "od" ||: + command_path SHELLSPEC_HEXDUMP "hexdump" ||: if command_path "time" || [ "$SHELLSPEC_BUSYBOX_W32" ]; then SHELLSPEC_TIME="time -p" 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 From 5d326a7ce8605fdbb337d1ec4945fa049c37d5ae Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 13 May 2024 21:12:53 +0900 Subject: [PATCH 29/50] Fix for shellcheck --- shellspec | 1 + 1 file changed, 1 insertion(+) diff --git a/shellspec b/shellspec index ae3ac2b8..58667f24 100755 --- a/shellspec +++ b/shellspec @@ -234,6 +234,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 From 8200e7c465a582682f7e8e1bbd47e25e30b57983 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 13 May 2024 21:52:24 +0900 Subject: [PATCH 30/50] Revert "Prefer to use POSIX commands internally" This reverts commit 61ea29e1893b814a864619ae71a3431eac7e83ab. --- helper/ksh_workaround.sh | 2 -- lib/general.sh | 2 -- lib/libexec/binary.sh | 6 +++--- lib/libexec/shellspec.sh | 10 +++++----- shellspec | 7 ------- spec/libexec/binary_spec.sh | 11 +++++++---- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/helper/ksh_workaround.sh b/helper/ksh_workaround.sh index 69698361..a9addf90 100644 --- a/helper/ksh_workaround.sh +++ b/helper/ksh_workaround.sh @@ -45,8 +45,6 @@ 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/lib/general.sh b/lib/general.sh index 23c6033d..f6df5735 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -944,5 +944,3 @@ 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 99bbe887..d9dd8e07 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() { - 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 + od -t o1 -v 2>/dev/null && return 0 + [ $? -eq 127 ] && hexdump -b -v 2>/dev/null && return 0 + od -b -v } octal_dump() { diff --git a/lib/libexec/shellspec.sh b/lib/libexec/shellspec.sh index 57f5cd98..b44621a1 100644 --- a/lib/libexec/shellspec.sh +++ b/lib/libexec/shellspec.sh @@ -124,11 +124,11 @@ current_shell() { # shellcheck disable=SC2295 command_path() { - case $# in - 0 | 1) set -- "" "$1" ;; - *) set -- "$1" "$2" ;; - esac - set -- "$@" "${SHELLSPEC_POSIX_PATH:-"$PATH"}${SHELLSPEC_PATHSEP}" + if [ $# -lt 2 ]; then + set -- "" "$1" "${PATH}${SHELLSPEC_PATHSEP}" + else + set -- "$1" "$2" "${PATH}${SHELLSPEC_PATHSEP}" + fi case $2 in (*/*) [ -x "$2" ] || return 1 diff --git a/shellspec b/shellspec index 58667f24..a879f631 100755 --- a/shellspec +++ b/shellspec @@ -24,7 +24,6 @@ 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='' @@ -88,10 +87,6 @@ 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}" @@ -408,8 +403,6 @@ fi command_path SHELLSPEC_LS "ls" ||: command_path SHELLSPEC_SORT "sort" ||: command_path SHELLSPEC_FIND "find" ||: - command_path SHELLSPEC_OD "od" ||: - command_path SHELLSPEC_HEXDUMP "hexdump" ||: if command_path "time" || [ "$SHELLSPEC_BUSYBOX_W32" ]; then SHELLSPEC_TIME="time -p" diff --git a/spec/libexec/binary_spec.sh b/spec/libexec/binary_spec.sh index d387cdc4..138ef95a 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()' - shellspec_od() { echo "od"; } - shellspec_hexdump() { echo "hexdump"; } + od() { echo "od"; } + 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" - shellspec_od() { echo "od: command not found" >&2; return 127; } + 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" - shellspec_od() { + od() { [ "$1" = "-t" ] && return 1 echo "od" "$@" } @@ -35,6 +35,9 @@ Describe "libexec/binary.sh" End Describe 'octal_dump()' + od() { @od "$@"; } + hexdump() { @hexdump "$@"; } + It 'outputs as octal number' Data "abc" When call octal_dump From 088c98a498f40766bda028c78e57813e69e3f376 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 13 May 2024 21:53:10 +0900 Subject: [PATCH 31/50] Revert "Fix for shellcheck" This reverts commit 5d326a7ce8605fdbb337d1ec4945fa049c37d5ae. --- shellspec | 1 - 1 file changed, 1 deletion(-) diff --git a/shellspec b/shellspec index a879f631..70f9e5a9 100755 --- a/shellspec +++ b/shellspec @@ -229,7 +229,6 @@ 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 From 166e4f0523c958033b6baea5c1151c432419f5e6 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 14 May 2024 00:02:09 +0900 Subject: [PATCH 32/50] Internal use commands fall back to POSIX version Workaround for Solaris 10 minimum configuration not including od command --- helper/ksh_workaround.sh | 2 ++ lib/general.sh | 2 ++ lib/libexec/binary.sh | 6 +++--- lib/libexec/shellspec.sh | 11 ++++++----- shellspec | 8 ++++++++ spec/libexec/binary_spec.sh | 11 ++++------- 6 files changed, 25 insertions(+), 15 deletions(-) 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/lib/general.sh b/lib/general.sh index f6df5735..23c6033d 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -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/shellspec.sh b/lib/libexec/shellspec.sh index b44621a1..71c92270 100644 --- a/lib/libexec/shellspec.sh +++ b/lib/libexec/shellspec.sh @@ -124,11 +124,12 @@ current_shell() { # 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/shellspec b/shellspec index 70f9e5a9..58667f24 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='' @@ -87,6 +88,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}" @@ -229,6 +234,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 @@ -402,6 +408,8 @@ fi command_path SHELLSPEC_LS "ls" ||: command_path SHELLSPEC_SORT "sort" ||: command_path SHELLSPEC_FIND "find" ||: + command_path SHELLSPEC_OD "od" ||: + command_path SHELLSPEC_HEXDUMP "hexdump" ||: if command_path "time" || [ "$SHELLSPEC_BUSYBOX_W32" ]; then SHELLSPEC_TIME="time -p" 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 From 4156d29679f81d87295a7235f811802dd6924078 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sun, 19 May 2024 12:36:40 +0900 Subject: [PATCH 33/50] Readd test for ubuntu-noble --- .github/workflows/ubuntu-noble.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/ubuntu-noble.yml diff --git a/.github/workflows/ubuntu-noble.yml b/.github/workflows/ubuntu-noble.yml new file mode 100644 index 00000000..f39e11a6 --- /dev/null +++ b/.github/workflows/ubuntu-noble.yml @@ -0,0 +1,28 @@ +name: Ubuntu Noble Numbat + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + ubuntu-noble: + runs-on: ubuntu-24.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 From c1313db1efa1dc8da423c259650c8d563b11248a Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sun, 19 May 2024 12:37:30 +0900 Subject: [PATCH 34/50] Add tests for i18n --- .github/workflows/i18n-testing.yml | 29 +++++++++++++++++++++++++++++ dockerfiles/debian-i18n-testing | 6 ++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/i18n-testing.yml create mode 100644 dockerfiles/debian-i18n-testing diff --git a/.github/workflows/i18n-testing.yml b/.github/workflows/i18n-testing.yml new file mode 100644 index 00000000..0a63bc72 --- /dev/null +++ b/.github/workflows/i18n-testing.yml @@ -0,0 +1,29 @@ +name: i18n test + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + LC_ALL: de_DE.utf8 + +jobs: + ubuntu-focal: + runs-on: ubuntu-24.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 locales-all ${{ 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/dockerfiles/debian-i18n-testing b/dockerfiles/debian-i18n-testing new file mode 100644 index 00000000..ec24aa06 --- /dev/null +++ b/dockerfiles/debian-i18n-testing @@ -0,0 +1,6 @@ +FROM debian:12-slim +ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes +RUN apt-get update && apt-get install -y locales-all +RUN useradd -m user +ENV LC_ALL=de_DE.utf8 +ENV SH=/bin/bash From 5543bdc901727a0a3c7a666ef1062160ad5d23bd Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sun, 19 May 2024 13:05:06 +0900 Subject: [PATCH 35/50] Fix tests for i18n --- .github/workflows/i18n-testing.yml | 5 +++-- contrib/various_test.sh | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/i18n-testing.yml b/.github/workflows/i18n-testing.yml index 0a63bc72..5ad527db 100644 --- a/.github/workflows/i18n-testing.yml +++ b/.github/workflows/i18n-testing.yml @@ -1,4 +1,4 @@ -name: i18n test +name: i18n on: [push, pull_request] @@ -7,7 +7,7 @@ env: LC_ALL: de_DE.utf8 jobs: - ubuntu-focal: + i18n: runs-on: ubuntu-24.04 if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: @@ -25,5 +25,6 @@ jobs: steps: - uses: actions/checkout@v2 - run: sudo apt-get install -y locales-all ${{ matrix.shells.package }} + - run: sudo rm -f /bin/time /usr/bin/time - run: sudo ${{ matrix.shells.shell }} ./shellspec --task fixture:stat:prepare - run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh 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) From 2c454718f28883c960b821dcb0042d8192cfbc3c Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 20 May 2024 21:20:44 +0900 Subject: [PATCH 36/50] Make debian-i18n-testing capable of testing various shells --- dockerfiles/debian-i18n-testing | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfiles/debian-i18n-testing b/dockerfiles/debian-i18n-testing index ec24aa06..699e6be1 100644 --- a/dockerfiles/debian-i18n-testing +++ b/dockerfiles/debian-i18n-testing @@ -1,6 +1,7 @@ FROM debian:12-slim ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes -RUN apt-get update && apt-get install -y locales-all +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 From 9b2d596036c40035dc0a3575c7ebd2cd3a1f5925 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 20 May 2024 21:21:51 +0900 Subject: [PATCH 37/50] Improved locale support for some shells --- lib/libexec/reporter.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libexec/reporter.sh b/lib/libexec/reporter.sh index 7c9845c0..3623ccf7 100644 --- a/lib/libexec/reporter.sh +++ b/lib/libexec/reporter.sh @@ -112,12 +112,18 @@ inc() { read_profiler() { time_real_nano=0 - shellspec_shift10 time_real_nano "$3" 4 + case $3 in + *,*) separator=',' ;; + *) separator='.' ;; + esac + shellspec_replace_all time_real_nano "$3" "$separator" '.' + shellspec_shift10 time_real_nano "$time_real_nano" 4 profiler_count=0 while IFS=" " read -r tick; do duration=$(($time_real_nano * $tick / $2)) shellspec_shift10 duration "$duration" -4 + shellspec_replace_all duration "$duration" '.' "$separator" set -- "$1" "$2" "$3" "$profiler_count" "$tick" "$duration" eval "profiler_tick$4=\$5 profiler_time$4=\$6" "$@" From 6f930df1d7a892870089731f9d996bf4d8fda220 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 21 May 2024 22:16:47 +0900 Subject: [PATCH 38/50] Improve stability in older ksh93 --- lib/general.sh | 6 +++--- libexec/shellspec-translate.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/general.sh b/lib/general.sh index 23c6033d..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) ||: diff --git a/libexec/shellspec-translate.sh b/libexec/shellspec-translate.sh index 47f7b6cb..82b1a886 100755 --- a/libexec/shellspec-translate.sh +++ b/libexec/shellspec-translate.sh @@ -9,6 +9,11 @@ use escape_quote delimiter="DELIMITER-$SHELLSPEC_UNIXTIME-$$" +disable_virtual_subshell() { + [ "$SHELLSPEC_SHELL_TYPE" = ksh ] || return 0 + putsn 'ulimit -t $(ulimit -t)' +} + trans() { # shellcheck disable=SC2145 "trans_$@" @@ -16,6 +21,7 @@ trans() { trans_block_example_group() { putsn "(" + disable_virtual_subshell [ "$skipped" ] && trans_skip "" putsn "shellspec_group_id $block_id $block_no" putsn "SHELLSPEC_LINENO_BEGIN=$lineno_begin" @@ -28,6 +34,7 @@ trans_block_example_group() { trans_block_example() { putsn "(" + disable_virtual_subshell [ "$skipped" ] && trans_skip "" putsn "shellspec_example_id $block_id $example_no $block_no" putsn "SHELLSPEC_LINENO_BEGIN=$lineno_begin" From 45b02e05e3ac789459a3d649295370d2dce5180f Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Sun, 26 May 2024 00:17:29 +0900 Subject: [PATCH 39/50] Fix for ksh93u+ on AIX 7.3 Curiously [ -e /dev/xxx ] is always true --- spec/core/modifiers/result_spec.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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_ From 4266675ccf8efdd7b82ce91f67ec835e35edd592 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 4 Jun 2024 21:22:06 +0900 Subject: [PATCH 40/50] cirrusci: Update FreeBSD version --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 957914a3..d5dee446 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,8 +5,8 @@ env: freebsd_task: freebsd_instance: matrix: - - image_family: freebsd-13-2 - - image_family: freebsd-14-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: From 38eee75cc2192160e0c7e858616aebd5043fbb5f Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 4 Jun 2024 21:42:52 +0900 Subject: [PATCH 41/50] actions: Remove i18n testing in CI No longer needed due to changes in implementation methods --- .github/workflows/i18n-testing.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/i18n-testing.yml diff --git a/.github/workflows/i18n-testing.yml b/.github/workflows/i18n-testing.yml deleted file mode 100644 index 5ad527db..00000000 --- a/.github/workflows/i18n-testing.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: i18n - -on: [push, pull_request] - -env: - FORCE_COLOR: 1 - LC_ALL: de_DE.utf8 - -jobs: - i18n: - runs-on: ubuntu-24.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 locales-all ${{ matrix.shells.package }} - - run: sudo rm -f /bin/time /usr/bin/time - - run: sudo ${{ matrix.shells.shell }} ./shellspec --task fixture:stat:prepare - - run: SH="${{ matrix.shells.shell }}" contrib/various_test.sh From 83c58d678c8549dc994d1d991488bc25ae22a1f0 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Wed, 5 Jun 2024 20:29:35 +0900 Subject: [PATCH 42/50] Fixed file descriptor handling --- libexec/shellspec-executor.sh | 25 ++++++++++++------ libexec/shellspec-runner.sh | 50 ++++++++++++++++++++++------------- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/libexec/shellspec-executor.sh b/libexec/shellspec-executor.sh index d5fec300..867fdc12 100755 --- a/libexec/shellspec-executor.sh +++ b/libexec/shellspec-executor.sh @@ -107,12 +107,21 @@ detect_range() { } 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 +( + ( + ( + ( set -e; executor "$@" ) 2>&1 >&4 3>&- 4>&- 5>&- + echo $? >&5 + ) | ( + ( set -e; error_handler ) >&3 3>&- 4>&- 5>&- + echo $? >&5 ) -) 4>&1 + ) 5>&1 | ( + read -r xs1 && [ "$xs1" -ne 0 ] && exit "$xs1" + read -r xs2 && [ "$xs2" -ne 0 ] && exit "$xs2" + exit 0 + ) 3>&- 4>&- +) 4>&1 3>&2 +exit_status=$? +wait +exit "$exit_status" diff --git a/libexec/shellspec-runner.sh b/libexec/shellspec-runner.sh index a3e93fa3..39653232 100755 --- a/libexec/shellspec-runner.sh +++ b/libexec/shellspec-runner.sh @@ -187,7 +187,7 @@ if [ "${SHELLSPEC_RANDOM:-}" ]; then fi { - env=$( ( ( ( ( _do() { set +e; (set -e; "$@" ); echo "exit_status=$?" >&9; } + env=$( ( ( ( ( _do() { set +e; (set -e; "$@" ) 8>&- 9>&-; echo "exit_status=$?" >&9; } _do precheck "$SHELLSPEC_REQUIRES" >&8 ) 2>&1 | while IFS= read -r line; do error "$line"; done >&2 ) 3>&1 | while IFS= read -r line; do warn "$line"; done >&2 @@ -205,27 +205,39 @@ fi # and the stderr streams to error hander # and also handle both exit status. As a result of 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}" +( + ( + ( + ( + ( set -e; executor "$@" ) 3>&- 4>&- 5>&- + echo $? >&5 + ) | ( + ( set -e; reporter "$@" ) >&3 3>&- 4>&- 5>&- + echo $? >&5 + ) + ) 2>&1 | ( + ( set -e; error_handler) >&4 3>&- 4>&- 5>&- + 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>&- 4>&- 5>&- ) 3>&1 4>&2 exit_status=$? +wait case $exit_status in 0) ;; # Running specs exit with successfully. From 8a7e8d27fce56dd9d132dee24e74a3424cae98ec Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Wed, 5 Jun 2024 20:36:48 +0900 Subject: [PATCH 43/50] Rewrite the code to execute the executor This is the following workaround https://github.com/shellspec/shellspec/issues/274#issuecomment-2139845019 But the bug where user time and sys time were not being measured correctly has also been fixed. --- libexec/shellspec-executor.sh | 34 +++++++-------- libexec/shellspec-runner.sh | 81 +++++++++++++++++------------------ 2 files changed, 57 insertions(+), 58 deletions(-) diff --git a/libexec/shellspec-executor.sh b/libexec/shellspec-executor.sh index 867fdc12..79a0d72d 100755 --- a/libexec/shellspec-executor.sh +++ b/libexec/shellspec-executor.sh @@ -106,22 +106,22 @@ detect_range() { echo "${lineno_begin}-${lineno_end:-$lineno}" } +xs1=0 xs2=0 set +e -( - ( +{ + xs=$( ( - ( set -e; executor "$@" ) 2>&1 >&4 3>&- 4>&- 5>&- - echo $? >&5 - ) | ( - ( set -e; error_handler ) >&3 3>&- 4>&- 5>&- - echo $? >&5 - ) - ) 5>&1 | ( - read -r xs1 && [ "$xs1" -ne 0 ] && exit "$xs1" - read -r xs2 && [ "$xs2" -ne 0 ] && exit "$xs2" - exit 0 - ) 3>&- 4>&- -) 4>&1 3>&2 -exit_status=$? -wait -exit "$exit_status" + ( + ( 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-runner.sh b/libexec/shellspec-runner.sh index 39653232..7be8733f 100755 --- a/libexec/shellspec-runner.sh +++ b/libexec/shellspec-runner.sh @@ -186,8 +186,9 @@ if [ "${SHELLSPEC_RANDOM:-}" ]; then set -- - fi +xs=0 { - env=$( ( ( ( ( _do() { set +e; (set -e; "$@" ) 8>&- 9>&-; echo "exit_status=$?" >&9; } + env=$( ( ( ( ( _do() { set +e; (set -e; "$@") 8>&- 9>&-; echo "xs=$?" >&9; } _do precheck "$SHELLSPEC_REQUIRES" >&8 ) 2>&1 | while IFS= read -r line; do error "$line"; done >&2 ) 3>&1 | while IFS= read -r line; do warn "$line"; done >&2 @@ -195,54 +196,52 @@ fi ) 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 -( - ( +{ + xs=$( ( ( - ( set -e; executor "$@" ) 3>&- 4>&- 5>&- - echo $? >&5 - ) | ( - ( set -e; reporter "$@" ) >&3 3>&- 4>&- 5>&- - echo $? >&5 + ( + ( 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 ) - ) 2>&1 | ( - ( set -e; error_handler) >&4 3>&- 4>&- 5>&- - 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>&- 4>&- 5>&- -) 3>&1 4>&2 -exit_status=$? -wait + ) 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 $exit_status in +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" From ed5230a0b1a99eac0d3193da45308d1c50830178 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Wed, 5 Jun 2024 21:03:53 +0900 Subject: [PATCH 44/50] dockerfiles: Re-add Dockerfile for ksh93r --- README.md | 2 +- dockerfiles/{.debian-4.0r9-ksh-93r-! => debian-4.0r9-ksh-93r} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename dockerfiles/{.debian-4.0r9-ksh-93r-! => debian-4.0r9-ksh-93r} (100%) diff --git a/README.md b/README.md index 9ac8ac57..724d0b7a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ ShellSpec is a **full-featured [BDD](https://en.wikipedia.org/wiki/Behavior-driv [![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-≥93s-lightgrey.svg?style=flat)](https://github.com/ksh93/ksh) +[![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/) 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 From 8dee4ce8e39a008c7393a449d6aa4fa9efcc8de6 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Mon, 3 Jun 2024 23:00:29 +0900 Subject: [PATCH 45/50] Re-implement shellspec-time for locale support --- helper/fixture/time_log.txt | 5 +- lib/libexec/reporter.sh | 28 ++- lib/libexec/reporter/finished_formatter.sh | 4 +- lib/libexec/reporter/profiler_formatter.sh | 2 +- libexec/shellspec-executor.sh | 3 - libexec/shellspec-runner.sh | 2 +- libexec/shellspec-time.sh | 198 +++++++++++++++++---- shellspec | 14 +- spec/libexec/reporter_spec.sh | 4 +- 9 files changed, 188 insertions(+), 72 deletions(-) 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/lib/libexec/reporter.sh b/lib/libexec/reporter.sh index 3623ccf7..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() { @@ -112,18 +112,12 @@ inc() { read_profiler() { time_real_nano=0 - case $3 in - *,*) separator=',' ;; - *) separator='.' ;; - esac - shellspec_replace_all time_real_nano "$3" "$separator" '.' - shellspec_shift10 time_real_nano "$time_real_nano" 4 + shellspec_shift10 time_real_nano "$3" 4 profiler_count=0 while IFS=" " read -r tick; do duration=$(($time_real_nano * $tick / $2)) shellspec_shift10 duration "$duration" -4 - shellspec_replace_all duration "$duration" '.' "$separator" set -- "$1" "$2" "$3" "$profiler_count" "$tick" "$duration" eval "profiler_tick$4=\$5 profiler_time$4=\$6" "$@" 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/profiler_formatter.sh b/lib/libexec/reporter/profiler_formatter.sh index 0b62ce0c..d00d2e56 100644 --- a/lib/libexec/reporter/profiler_formatter.sh +++ b/lib/libexec/reporter/profiler_formatter.sh @@ -52,5 +52,5 @@ profiler_output() { profiler_reverse_sort() { # Retry if sort is Windows version - ( export LC_ALL=C; sort -k 1 -n -r 2>/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/libexec/shellspec-executor.sh b/libexec/shellspec-executor.sh index 79a0d72d..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" diff --git a/libexec/shellspec-runner.sh b/libexec/shellspec-runner.sh index 7be8733f..6599cc21 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 $?" } diff --git a/libexec/shellspec-time.sh b/libexec/shellspec-time.sh index ca64af35..aa7972ba 100755 --- a/libexec/shellspec-time.sh +++ b/libexec/shellspec-time.sh @@ -1,46 +1,180 @@ #!/bin/sh -#shellcheck disable=SC2004 +# shellcheck disable=SC2004 +# Write it to work in a Bourne shell if possible. + +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}" +} + +time_using_date() { + date +'start %Y-%m-%dT%H:%M:%S.%N' + "$@" + set -- $? + date +'end %Y-%m-%dT%H:%M:%S.%N' + return "$1" +} + +detect_time_type() { + [ "$SHELLSPEC_TIME_TYPE" = auto ] || return 0 + + if ! { time true; } >/dev/null 2>&1; then + SHELLSPEC_TIME_TYPE=external-date && return 0 + fi + + if [ ! "${KSH_VERSION:-}" ]; then + # shellcheck disable=SC2006 + KSH_VERSION=`eval 'echo ${.sh.version}'` + fi 2>/dev/null + + if [ "${BASH_VERSION:-}" ]; then + SHELLSPEC_TIME_TYPE=bash-builtin && return 0 + fi + + if [ "${KSH_VERSION:-}" ]; then + case $KSH_VERSION in + *PD\ KSH*) SHELLSPEC_TIME_TYPE=pdksh-builtin ;; + *MIRBSD\ KSH*) SHELLSPEC_TIME_TYPE=mksh-builtin ;; + *LEGACY\ KSH*) SHELLSPEC_TIME_TYPE=lksh-builtin ;; + *) SHELLSPEC_TIME_TYPE=ksh93-builtin ;; + esac + return 0 + fi + + if [ "${ZSH_VERSION:-}" ]; then + SHELLSPEC_TIME_TYPE=zsh-builtin && return 0 + fi + + if { time -p true; } >/dev/null 2>&1; then + SHELLSPEC_TIME_TYPE=external-time + else + SHELLSPEC_TIME_TYPE=legacy-time + fi +} + +detect_time_type + +{ + ( + "$SHELLSPEC_TRAP" : INT + + set -- -- "$@" -set -eu + case ${LC_ALL+x} in + ?) set -- -s LC_ALL "$LC_ALL" "$@" ;; + *) set -- -u LC_ALL "$@" ;; + esac + LC_ALL=C && export LC_ALL -read -r sec_start millisec_start <&3 >&4 3>&- 4>&- + ' "$0" "$@" -read -r sec_end millisec_end <&2 + ) 2>&1 | ( + "$SHELLSPEC_TRAP" '' INT -case $millisec_end in (*[!0-9]*) - millisec_end=0 -esac + real='' user='' sys='' type=$SHELLSPEC_TIME_TYPE ex='' + # shellcheck disable=SC2162 -sec=$(($sec_end - $sec_start)) -millisec=$((1$millisec_end - 1$millisec_start)) -if [ $millisec -lt 0 ]; then - millisec=$(($millisec + 100)) - sec=$(($sec - 1)) -fi -[ $millisec -lt 10 ] && millisec="0$millisec" + while read 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/shellspec b/shellspec index 58667f24..2925c510 100755 --- a/shellspec +++ b/shellspec @@ -38,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='' @@ -130,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" @@ -410,17 +411,6 @@ fi command_path SHELLSPEC_FIND "find" ||: command_path SHELLSPEC_OD "od" ||: command_path SHELLSPEC_HEXDUMP "hexdump" ||: - - 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 } if ! signal 0 $$ 2>/dev/null; then 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 From 2b7216ba40b7604833b60704a5fddc8967468cf7 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Thu, 6 Jun 2024 20:51:10 +0900 Subject: [PATCH 46/50] Improve stability on ksh93t Workaround for file descriptor malfunction when specifying locale See below https://github.com/shellspec/shellspec/issues/274 --- lib/core/dsl.sh | 9 +++++++++ libexec/shellspec-translate.sh | 11 ++++------- 2 files changed, 13 insertions(+), 7 deletions(-) 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/libexec/shellspec-translate.sh b/libexec/shellspec-translate.sh index 82b1a886..eb3d29f3 100755 --- a/libexec/shellspec-translate.sh +++ b/libexec/shellspec-translate.sh @@ -9,11 +9,6 @@ use escape_quote delimiter="DELIMITER-$SHELLSPEC_UNIXTIME-$$" -disable_virtual_subshell() { - [ "$SHELLSPEC_SHELL_TYPE" = ksh ] || return 0 - putsn 'ulimit -t $(ulimit -t)' -} - trans() { # shellcheck disable=SC2145 "trans_$@" @@ -21,7 +16,6 @@ trans() { trans_block_example_group() { putsn "(" - disable_virtual_subshell [ "$skipped" ] && trans_skip "" putsn "shellspec_group_id $block_id $block_no" putsn "SHELLSPEC_LINENO_BEGIN=$lineno_begin" @@ -34,7 +28,10 @@ trans_block_example_group() { trans_block_example() { putsn "(" - disable_virtual_subshell + # 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" From cfb272b0789297ec3c204d4c77a0249615c85d9d Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Fri, 7 Jun 2024 20:40:53 +0900 Subject: [PATCH 47/50] Update dockerfiles --- dockerfiles/{.gwsh-main-b577fdc => gwsh-main} | 2 +- ...ily-20240321-bosh-20230112 => schily-20240321-bosh-20230112} | 0 ...y-20240321-pbosh-20230112 => schily-20240321-pbosh-20230112} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename dockerfiles/{.gwsh-main-b577fdc => gwsh-main} (87%) rename dockerfiles/{.schily-20240321-bosh-20230112 => schily-20240321-bosh-20230112} (100%) rename dockerfiles/{.schily-20240321-pbosh-20230112 => schily-20240321-pbosh-20230112} (100%) diff --git a/dockerfiles/.gwsh-main-b577fdc b/dockerfiles/gwsh-main similarity index 87% rename from dockerfiles/.gwsh-main-b577fdc rename to dockerfiles/gwsh-main index bfbffa8c..38f35b34 100644 --- a/dockerfiles/.gwsh-main-b577fdc +++ b/dockerfiles/gwsh-main @@ -1,7 +1,7 @@ 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/b577fdc.tar.gz +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 \ diff --git a/dockerfiles/.schily-20240321-bosh-20230112 b/dockerfiles/schily-20240321-bosh-20230112 similarity index 100% rename from dockerfiles/.schily-20240321-bosh-20230112 rename to dockerfiles/schily-20240321-bosh-20230112 diff --git a/dockerfiles/.schily-20240321-pbosh-20230112 b/dockerfiles/schily-20240321-pbosh-20230112 similarity index 100% rename from dockerfiles/.schily-20240321-pbosh-20230112 rename to dockerfiles/schily-20240321-pbosh-20230112 From 225e0f0e0224729e3be15ea32a2a789c35088731 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Fri, 7 Jun 2024 20:42:57 +0900 Subject: [PATCH 48/50] shellspec-time.sh: Drop bourne shell support --- libexec/shellspec-time.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libexec/shellspec-time.sh b/libexec/shellspec-time.sh index aa7972ba..f5620bd5 100755 --- a/libexec/shellspec-time.sh +++ b/libexec/shellspec-time.sh @@ -1,6 +1,12 @@ #!/bin/sh # shellcheck disable=SC2004 -# Write it to work in a Bourne shell if possible. + +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 @@ -38,8 +44,7 @@ detect_time_type() { fi if [ ! "${KSH_VERSION:-}" ]; then - # shellcheck disable=SC2006 - KSH_VERSION=`eval 'echo ${.sh.version}'` + KSH_VERSION=$(eval 'echo ${.sh.version}') fi 2>/dev/null if [ "${BASH_VERSION:-}" ]; then @@ -79,7 +84,7 @@ detect_time_type ?) set -- -s LC_ALL "$LC_ALL" "$@" ;; *) set -- -u LC_ALL "$@" ;; esac - LC_ALL=C && export LC_ALL + export LC_ALL=C # bash or ksh93 case ${TIMEFORMAT+x} in @@ -100,7 +105,7 @@ detect_time_type ?) set -- -s TIME "$TIME" "$@" ;; *) set -- -u TIME "$@" ;; esac - TIME="real %e${LF}user %U${LF}sys %S" && export TIME + export TIME="real %e${LF}user %U${LF}sys %S" # shellcheck disable=SC2016 set -- sh -c ' @@ -142,9 +147,8 @@ detect_time_type "$SHELLSPEC_TRAP" '' INT real='' user='' sys='' type=$SHELLSPEC_TIME_TYPE ex='' - # shellcheck disable=SC2162 - while read name time; do + while read -r name time; do # ksh88: 1m2.34s case $time in *m*s) type=ksh88-builtin From c209cb49a60b2a7727632373caf37e98649104f7 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 18 Jun 2024 20:45:36 +0900 Subject: [PATCH 49/50] Do not close FD9 for prechecker Close #317 --- helper/spec_helper.sh | 4 ++++ libexec/shellspec-runner.sh | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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/libexec/shellspec-runner.sh b/libexec/shellspec-runner.sh index 6599cc21..ee59a343 100755 --- a/libexec/shellspec-runner.sh +++ b/libexec/shellspec-runner.sh @@ -188,8 +188,9 @@ fi xs=0 { - env=$( ( ( ( ( _do() { set +e; (set -e; "$@") 8>&- 9>&-; echo "xs=$?" >&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 From 36705768b0560dd86c3c96f1cab9267a6380d98d Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 18 Jun 2024 21:30:32 +0900 Subject: [PATCH 50/50] circleci: Disable workflows that take long --- .circleci/config.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aa002367..ab3b84fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,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: [macos11, macos12, macos13, macos14] +# 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]