Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
9196b79
add -P option, to pass the script via pipe instead of command line
fabio-brugnara Jun 2, 2023
a0cbfd9
modified untraceable() to avoid occasional freeze with zombie
fabio-brugnara Jun 2, 2023
9c77773
add support for python*
fabio-brugnara Jun 2, 2023
6242bf5
initialize pipe flag to 0
fabio-brugnara Jun 5, 2023
6dc86a0
Fix script file names containing spaces and other special characters.
ergoucao Sep 7, 2023
defa47b
Fix files with linting & formatting tools + spelling correction
mdeweerd Jan 5, 2024
d23e9a9
minor: Fix spelling require->requires
mdeweerd Jan 5, 2024
c5736c3
Improve format hinting
mdeweerd Jan 5, 2024
37b7189
Make script executable
mdeweerd Jan 5, 2024
727c60e
add install procedure for Debian and Ubuntu systems in the README
Jan 25, 2024
a280a4d
reword the 'Ubuntu-specific' heading to make it more specific
Jan 25, 2024
8dec142
add code block hinting for the Ubuntu PPA install procedure
Jan 25, 2024
5a3eb51
Fix memory leaks in write_c and eval_shell
ashamedbit Jan 28, 2024
4bd412e
Remove ash dependency
dviererbe Jul 16, 2024
c2c263a
ci: pre-commit & generate actions
mdeweerd Jan 5, 2024
6098fee
Spelling updates, regenerate man
mdeweerd Aug 11, 2024
72b3f92
Merge branch 'ci/precommit_generate' into memory-leak-fixes
mdeweerd Aug 11, 2024
26b90c7
Merge branch 'fix/linting' into integration/merge
mdeweerd Aug 11, 2024
dd622ea
Merge branch 'fix/spelling/man' into integration/merge
mdeweerd Aug 11, 2024
7a64c63
Merge branch 'pr157' into integration/merge
mdeweerd Aug 11, 2024
dc1a51c
Merge branch 'pr167' into integration/merge
mdeweerd Aug 11, 2024
80a813e
Merge branch 'pr164' into integration/merge
mdeweerd Aug 11, 2024
b37b159
Merge branch 'doc/format-hints' into integration/merge
mdeweerd Aug 11, 2024
3385b79
Add exceptions for test, and possibility to exclude cppchecks
mdeweerd Aug 11, 2024
6e5fe35
Exclude readability/casting because this is c-code
mdeweerd Aug 11, 2024
819b7ae
Ignore several external files for checks
mdeweerd Aug 11, 2024
dbbe389
Cleanup INSTALL
mdeweerd Aug 11, 2024
7791306
Cleanup .travis.yml
mdeweerd Aug 11, 2024
d62dd17
Add ci (replace travis)
mdeweerd Aug 11, 2024
53aad7e
ci: Github Action Generate Files
invalid-email-address Aug 11, 2024
684fa07
Fix cpplint/cppcheck
mdeweerd Aug 11, 2024
ab1b51d
Do test with sanitize on
mdeweerd Aug 11, 2024
a984bad
Do test with sanitize on
mdeweerd Aug 11, 2024
f9da88e
Also ignore Makefile.am for file formatting
mdeweerd Aug 11, 2024
52b7f6b
Sanitizer: stop the program when a leak is detected
mdeweerd Aug 11, 2024
9837b8d
Merge commit '52b7f6b' into integration/merge
mdeweerd Aug 11, 2024
be20a38
Avoid warning about not using the return value of setuid
mdeweerd Aug 11, 2024
7be5e33
Upgrade pandoc workflow
mdeweerd Aug 11, 2024
c61eb85
ci: Github Action Generate Files
invalid-email-address Aug 11, 2024
489e8dd
Add uncrustify configuration, apply it
mdeweerd Aug 12, 2024
ad89854
Merge branch 'integration/merge' of github.com:mdeweerd/shc into inte…
mdeweerd Aug 12, 2024
c067aff
Update executable bit for INSTALL
mdeweerd Aug 12, 2024
a1a4d20
Remove space after sizeof
mdeweerd Aug 12, 2024
7b6b7f5
Format code before merging
mdeweerd Aug 12, 2024
21e214e
Merge branch 'pr153' into integration/merge
mdeweerd Aug 12, 2024
7eee637
add test in ttest.sh for -P flag and python
fabio-brugnara Aug 12, 2024
b563090
Ignore developer name
mdeweerd Aug 12, 2024
d2cac42
Test pip & python
fabio-brugnara Aug 12, 2024
792260b
Allow skipping of tests
mdeweerd Aug 12, 2024
d233552
Fix memory leaks in generated program
mdeweerd Aug 12, 2024
60c86e0
Fix issue with flagging overflow
mdeweerd Aug 12, 2024
1e635da
Use unsigned to avoid runtime signed overflow notice & sprintf->snprintf
mdeweerd Aug 12, 2024
3871627
use unsigned in random generation to avoid sanitizer warning
fabio-brugnara Aug 12, 2024
ee754b8
add braces around break
fabio-brugnara Aug 12, 2024
9f3565a
Merge branch 'pr153' into integration/merge
mdeweerd Aug 13, 2024
714e922
add SHC_ARGV0 to environment
fabio-brugnara Aug 15, 2024
b3f9c99
added SHC_PID for safer handling of SHC_ARGV0
fabio-brugnara Aug 16, 2024
f4ff8e1
first partial draft of argv0 fix, only for *sh
fabio-brugnara Aug 16, 2024
6d4ebd0
Test $0 value
mdeweerd Aug 17, 2024
87f9485
second draft of argv0 fix, includes python, and put argv fix under op…
fabio-brugnara Aug 17, 2024
163b5f9
Add several test script to pre-commit checks
mdeweerd Aug 17, 2024
bd058ff
Duplicate strings before encryption to print unmangled args
mdeweerd Aug 17, 2024
219fbc3
Add flow (actions & test runs)
mdeweerd Aug 17, 2024
7ebbc2d
Merge branch 'argv0' of github.com:fabio-brugnara/shc into argv0
mdeweerd Aug 17, 2024
a834aa4
Disable sanitize run for fork evaluation
mdeweerd Aug 17, 2024
3d64ca3
Uncrustify before merge
mdeweerd Aug 17, 2024
1335cec
Uncrustify before merge
mdeweerd Aug 17, 2024
427259b
Merge branch 'argv0_with_pre' into argv0_test
mdeweerd Aug 17, 2024
b70a297
Set -0 option in tests
mdeweerd Aug 17, 2024
2dbcec6
Enable -0 option in tests
mdeweerd Aug 17, 2024
a2bc6ea
Enable -0 option in tests
mdeweerd Aug 17, 2024
997c3d0
fix typo in python3 DB
fabio-brugnara Aug 17, 2024
3f44476
add perl support (with -P forced)
fabio-brugnara Aug 17, 2024
729b1bd
Add shell name and option to test temporary path
mdeweerd Aug 17, 2024
52a17fc
Add shell name and option to test temporary path
mdeweerd Aug 17, 2024
accb0b8
Add timeout value to ci run
mdeweerd Aug 17, 2024
376a712
Add timeout value to ci run
mdeweerd Aug 17, 2024
e94567b
Fix timeout syntax & rename job
mdeweerd Aug 17, 2024
2d7abab
Extend tests with arguments with spaces and quotes, and fix tcsh and …
mdeweerd Aug 17, 2024
64c7824
fix sourcing of binary for *csh
fabio-brugnara Aug 18, 2024
de0a223
Solve $0 for zsh when using pipe
mdeweerd Aug 18, 2024
c649a87
Adjust test to not require forged $0 for rc and the pipe option
mdeweerd Aug 18, 2024
91ec8f9
fix minor oversight in shell list
fabio-brugnara Aug 18, 2024
3ed7c04
Merge branch 'argv0' into argv0_with_pre
mdeweerd Aug 18, 2024
aa84e8b
Merge branch 'argv0_with_pre' into argv0_test
mdeweerd Aug 18, 2024
e9ddf90
Remove temporary output for debug from ttest.sh
mdeweerd Aug 18, 2024
d713001
ci: Github Action Generate Files
invalid-email-address Aug 18, 2024
17b89be
Add dependabot configuration
mdeweerd Aug 18, 2024
521f8d4
Bump dorny/paths-filter from 2 to 3
dependabot[bot] Aug 18, 2024
be6edbe
Fix executable flag on generated files
mdeweerd Aug 18, 2024
ac0ca7a
Merge pull request #1 from mdeweerd/dependabot/github_actions/dorny/p…
mdeweerd Aug 18, 2024
cf91f8f
make forging of argv0 opt-out with -p, force -P for *csh
fabio-brugnara Aug 18, 2024
db31ddd
Change meaning of options -P -p. Added set of __file__ to python prea…
fabio-brugnara Aug 19, 2024
95bcb63
Update Changelog
mdeweerd Aug 19, 2024
ac7eccc
Merge branch 'argv0' into argv0_with_pre
mdeweerd Aug 19, 2024
9a9da5a
Merge branch 'argv0_with_pre' into integration/merge
mdeweerd Aug 19, 2024
aedbebe
Cleanup format of generated script
mdeweerd Aug 19, 2024
9ead41a
Extend tests to more options
mdeweerd Aug 19, 2024
85d658e
Update documentation
mdeweerd Aug 19, 2024
7b0337f
ci: Github Action Generate Files
invalid-email-address Aug 19, 2024
298b848
Avoid warning about unused return value of system() + doc
mdeweerd Aug 19, 2024
0db92fe
Ignore some file to avoid notices in ci.
mdeweerd Aug 19, 2024
9bae4bb
Make changes to move the repository
mdeweerd Aug 19, 2024
9530738
Update man for move
mdeweerd Aug 19, 2024
e6b77b5
ci: Github Action Generate Files
invalid-email-address Aug 19, 2024
501bfbe
Fix for Cygwin
mdeweerd Aug 19, 2024
fba9291
Ignore _SC_ARG_MAX check on cygwin
mdeweerd Aug 19, 2024
03c0db5
WIP release action
mdeweerd Aug 19, 2024
056776b
Checkout head for modification
mdeweerd Aug 19, 2024
7770795
Test tagging differently
mdeweerd Aug 19, 2024
e1da584
log github vars
mdeweerd Aug 19, 2024
f5074c0
Test ref_name
mdeweerd Aug 19, 2024
fb4b607
Correct method to get branch
mdeweerd Aug 19, 2024
352eb7b
Correct line join
mdeweerd Aug 19, 2024
eed9e37
:wrench: Update dependabot configuration
mdeweerd Jul 14, 2026
9c5374a
:wrench: Update pre-commit hooks versions
mdeweerd Jul 14, 2026
a72389e
remove dependabot nix = flake.nix, not used
mdeweerd Jul 14, 2026
42d421a
Bump cpplint from 1.6.1 to 2.0.2 in the infrastructure group
dependabot[bot] Jul 14, 2026
4ef4c94
Merge pull request #3 from mdeweerd/dependabot/infrastructure-a016b7dcfa
mdeweerd Jul 14, 2026
9e23f3f
:wrench: Update codespell ignore-words-list
mdeweerd Jul 14, 2026
382b0c8
Fix cache issue on cppcheck
mdeweerd Jul 14, 2026
a7c8fb3
:recycle: Refactor shc.c to improve code quality
mdeweerd Jul 14, 2026
6f47aff
:art: Fix typo in uncrustify.cfg
mdeweerd Jul 14, 2026
1b8f941
Update to new pre-commit-hooks
mdeweerd Jul 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2

multi-ecosystem-groups:
infrastructure:
schedule:
interval: "weekly"

# 'package-ecosystem' values: npm, bundler, composer, devcontainers, dotnet-sdk, maven, mix, cargo, gradle, nuget, gomod, docker, docker-compose, elm, gitsubmodule, github-actions, pip, terraform, pub, rust-toolchain, sbt, swift, bun, uv, vcpkg, helm, conda, julia, bazel, opentofu, pre-commit, nix, denoo
updates:
- package-ecosystem: "pre-commit"
directory: "/"
patterns: ["*"]
#patterns: ["nginx", "redis", "postgres"]
multi-ecosystem-group: "infrastructure"

- package-ecosystem: "github-actions"
directory: "/"
patterns: ["*"]
#patterns: ["aws", "terraform-*"]
multi-ecosystem-group: "infrastructure"
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on: [push, pull_request]

jobs:
build-and-test:
# Normally runs in less than 50 seconds, but could stall because of test
timeout-minutes: 3
runs-on: ubuntu-24.04

steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Install dependencies
run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc

- name: Build and Test (with sanitize)
env:
SKIP: python2
run: |
SANITIZE="${SANITIZE} -fsanitize=address"
#SANITIZE="${SANITIZE} -fsanitize=thread"
SANITIZE="${SANITIZE} -fsanitize=leak"
SANITIZE="${SANITIZE} -fsanitize=undefined"
SANITIZE="${SANITIZE} -fsanitize=integer-divide-by-zero"
# SANITIZE="${SANITIZE} -fsanitize=vla-bound"
SANITIZE="${SANITIZE} -fsanitize=null"
SANITIZE="${SANITIZE} -fsanitize=signed-integer-overflow"
SANITIZE="${SANITIZE} -fsanitize=bounds"
#SANITIZE="${SANITIZE} -fsanitize=bounds-strict"
SANITIZE="${SANITIZE} -fsanitize=bool"
SANITIZE="${SANITIZE} -fsanitize=enum"
#SANITIZE="${SANITIZE} -fsanitize-recover" # will try to continue running the program
#SANITIZE_LINK="-static-libasan -static -lasan -static -lubsan -ldl -lm"
SANITIZE_LINK="-l:libasan.a -l:libubsan.a -ldl -lm"
SANITIZE="${SANITIZE} -fno-sanitize=alignment"
./autogen.sh
./configure
make clean
make CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}"
make CC=gcc CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" test

- name: Build and Test (Normal)
env:
SKIP: python2
run: |
./autogen.sh
./configure
make clean
make
make test

- name: Provide log as artifact
uses: actions/upload-artifact@v7
if: ${{ ! cancelled() }}
with:
name: shc.failingtests
path: |
/tmp/shc.*.tst/*
retention-days: 2
72 changes: 72 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Generate files (documentation, autotools)
on:
push:
paths: [man.md, aclocal.m4, configure.ac]
workflow_dispatch:
workflow_call:
release:
types: [published]

env:
GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action

jobs:
convert_via_pandoc:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.head_ref }}

- name: Find branch that the tag was created from
if: ${{ startsWith(github.ref_name, 'v') || startsWith(github.ref_name, '4') }}
id: get_branch
run: |
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
BRANCH=$(git for-each-ref --format='%(refname:short)' refs/heads/ | while read branch; do git merge-base --is-ancestor $TAG_COMMIT $branch && echo $branch && break ; done)
echo "Branch found: $BRANCH"
echo "branch=$BRANCH" >> $GITHUB_ENV
git checkout $BRANCH

- name: Set version number (when publishing)
if: ${{ startsWith(github.ref_name, 'v') || startsWith(github.ref_name, '4') }}
run: |
python3 ${{ github.workspace }}/.github/update_version.py --version ${{ github.ref_name }}

- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
man:
- 'man.md'
autotools:
- 'aclocal.m4'
- 'configure.ac'
- uses: docker://pandoc/core:3.3
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }}
with:
args: -s man.md -t man -o shc.1
- uses: docker://pandoc/core:3.3
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }}
with:
args: -s man.md -t html -o man.html
- run: |-
./autogen.sh
# Correct executable flag on generated files
chmod -x INSTALL
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.autotools == 'true' }}
- name: Commit changes
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools || startsWith(github.ref, 'ref/tags/v') }}
run: |-
for r in $(git remote) ; do git remote get-url --all $r ; done
git config user.name github-actions
git config user.email github-actions@github.com
git commit -a -m "ci: Github Action Generate Files"
git push

- name: Move tag on release
if: ${{ startsWith(github.ref, 'ref/tags/v') && ( github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools ) }}
run: |-
git tag -fa "${{ github.ref_name }}" -m "Update ${{ github.ref_name }} tag"
git push origin --force tag "${{ github.ref_name }}"
51 changes: 51 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
RAW_LOG: pre-commit.log
CS_XML: pre-commit.xml
steps:
- run: sudo apt-get update && sudo apt-get install cppcheck
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
cache: pip
python-version: "3.12.1"
- run: python -m pip install pre-commit
- uses: actions/cache/restore@v6
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml')
}}
- name: Run pre-commit hooks
env:
SKIP: uncrustify
run: |
set -o pipefail
pre-commit gc
pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG}
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2026.7.1
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}
- uses: actions/cache/save@v6
if: ${{ ! cancelled() }}
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml')
}}
- name: Provide log as artifact
uses: actions/upload-artifact@v7
if: ${{ ! cancelled() }}
with:
name: precommit-logs
path: |
${{ env.RAW_LOG }}
${{ env.CS_XML }}
retention-days: 2
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ config.status
a.out
*.x
*.x.c

config/config.guess
config/config.sub
*~
103 changes: 103 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
exclude:
(?x)^(
configure|
configure\..*|
.cache/.*|
.*Makefile.in|
.*Makefile.am|
autogen.sh|
config/install-sh|
config/depcomp|
config/compile|
config/missing|
aclocal.m4|
__NONE__)$
repos:
- repo: https://github.com/executablebooks/mdformat
# Do this before other tools "fixing" the line endings
rev: 2d496dbc18e31b83a1596685347ffe0b6041daf0 # 1.0.0
hooks:
- id: mdformat
name: Format Markdown
stages: [manual]
entry: mdformat # Executable to run, with fixed options
language: python
types: [markdown]
args: [--wrap, '75', --number]
additional_dependencies:
- mdformat-toc
- mdformat-gfm
- mdformat-beautysh
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
hooks:
# - id: no-commit-to-branch
# args: [--branch, main]
- id: debug-statements
- id: end-of-file-fixer
exclude: ^(test/.*)$
- id: trailing-whitespace
exclude: .*\.md$
- id: check-json
- id: mixed-line-ending
- id: check-builtin-literals
args: [--ignore=dict]
- id: check-ast
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
exclude: ^(test/.*)$
- id: check-docstring-first
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-toml
- repo: https://github.com/lovesegfault/beautysh.git
rev: 885128fe2600889194c69fa19326cf55a3462777 # v6.4.3
hooks:
- id: beautysh
exclude: (?x)^(test/test\..*|config/missing|configure|autogen.sh)$
additional_dependencies:
- setuptools
- repo: https://github.com/codespell-project/codespell
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # v2.4.2
hooks:
- id: codespell
args:
- --toml
- pyproject.toml
additional_dependencies:
- tomli
#- repo: https://github.com/pocc/pre-commit-hooks
# rev: 8387cd298d01468479e7e52429ca8c95ed9546ef # v1.3.5
- repo: https://github.com/mdeweerd/pre-commit-hooks
rev: 1b4abb7690690e68642195c7cfec5efc8d647af9 # v1.3.5 - corrected for cppcheck cache
# Install dependencies on windows:
# choco install llvm uncrustify cppcheck
hooks:
- id: uncrustify
args: [--replace, --no-backup, -c, uncrustify.cfg]
- id: cppcheck
args:
- --force
#- --std=c99
- --language=c
#- -IInc
- '--template={file}({line}): {severity} ({id}): {message}'
- --inline-suppr
- id: cpplint
args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readability/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"]
additional_dependencies:
- cpplint>=2.0.2
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: 745eface02aef23e168a8afb6b5737818efbea95 # v0.11.0.1
hooks:
- id: shellcheck
exclude: (?x)^(test/test.*)$
# args: [-x,-e1007,-e1009,-e1072,-e1073]
- repo: https://github.com/pocc/pre-commit-hooks
rev: 8387cd298d01468479e7e52429ca8c95ed9546ef # v1.3.5
hooks:
- id: clang-format
stages: [manual]
args: [-i]
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ sudo: required
language: c
before_install:
- sudo apt-get update -q
- sudo apt install dash bash ash ksh zsh tcsh csh rc
script:
- sudo apt install dash bash ksh zsh tcsh csh rc
script:
- ./autogen.sh
- ./configure
- make
- make test


Loading