Skip to content

Fix pbsort#164

Merged
unixorn merged 1 commit intomainfrom
fix-pbsort
Nov 2, 2025
Merged

Fix pbsort#164
unixorn merged 1 commit intomainfrom
fix-pbsort

Conversation

@unixorn
Copy link
Copy Markdown
Owner

@unixorn unixorn commented Nov 2, 2025

Description

Add missing has() and debug() functions that didn't get checked in

Type of changes

  • Adds/updates a helper script
  • Adds/updates a link to an external resource like a blog post or video
  • Text change (fix typos, update formatting)
  • Test changes

Copyright Assignment

  • This repository is covered by the Apache License, and I agree to contribute this PR under the terms of that license.

Checklist

  • All new and existing tests pass.
  • I have signed off my commits. You can use git commit --amend --no-edit --signoff to amend an existing commit, and you can find more details about signing off commits on the DCO GitHub action page here
  • Any scripts added/updated use #!/usr/bin/env interpreter instead of direct paths. #!/bin/sh is an allowed exception.
  • Scripts added/updated are marked executable
  • I have added/updated a credit line to README.md for any scripts added or updated in this PR.
  • If there was no author credit in a script added in this PR, I have added one.
  • I have confirmed that the link(s) in this PR are valid.
  • I have read the CONTRIBUTING page.

Add missing `has()` and `debug()` functions that didn't get checked in

Signed-off-by: Joe Block <jpb@unixorn.net>
@unixorn unixorn added the bugfix Bug fix label Nov 2, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 2, 2025

MegaLinter analysis: Error

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ BASH bash-exec 2 0 0 0.01s
❌ BASH shellcheck 2 3 0 0.08s
⚠️ BASH shfmt 2 2 0 0.0s
✅ COPYPASTE jscpd yes no no 1.18s
✅ REPOSITORY dustilock yes no no 0.01s
✅ REPOSITORY gitleaks yes no no 0.59s
✅ REPOSITORY git_diff yes no no 0.02s
✅ REPOSITORY grype yes no no 35.49s
⚠️ REPOSITORY kics yes 3 no 2.29s
✅ REPOSITORY secretlint yes no no 1.47s
✅ REPOSITORY syft yes no no 2.8s
✅ REPOSITORY trivy yes no no 9.41s
✅ REPOSITORY trivy-sbom yes no no 0.21s
✅ REPOSITORY trufflehog yes no no 4.53s

Detailed Issues

❌ BASH / shellcheck - 3 errors
In bin/pbsed line 18:
function has() {
^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).


In bin/pbsed line 24:
function echo-stderr() {
^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).


In bin/pbsort line 18:
function echo-stderr() {
^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2329 -- This function is never invoked. C...
⚠️ REPOSITORY / kics - 3 errors
MLLLLLM             MLLLLLLLLL   LLLLLLL             KLLLLLLLLLLLLLLLL       LLLLLLLLLLLLLLLLLLLLLLL 
   MMMMMMM           MMMMMMMMMML    MMMMMMMK       LMMMMMMMMMMMMMMMMMMMML   KLMMMMMMMMMMMMMMMMMMMMMMMMM 
   MMMMMMM         MMMMMMMMML       MMMMMMMK     LMMMMMMMMMMMMMMMMMMMMMML  LMMMMMMMMMMMMMMMMMMMMMMMMMMM 
   MMMMMMM      MMMMMMMMMML         MMMMMMMK   LMMMMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMMMM 
   MMMMMMM    LMMMMMMMMML           MMMMMMMK  LMMMMMMMMMLLMLLLLLLLLLLLLLL LMMMMMMMLLLLLLLLLLLLLLLLLLLLM 
   MMMMMMM  MMMMMMMMMLM             MMMMMMMK LMMMMMMMM                    LMMMMMML                      
   MMMMMMMLMMMMMMMML                MMMMMMMK MMMMMMML                     LMMMMMMMMLLLLLLLLLLLLLMLL     
   MMMMMMMMMMMMMMMM                 MMMMMMMK MMMMMML                       LMMMMMMMMMMMMMMMMMMMMMMMMML  
   MMMMMMMMMMMMMMMMMM               MMMMMMMK MMMMMMM                         LMMMMMMMMMMMMMMMMMMMMMMMML 
   MMMMMMM KLMMMMMMMMML             MMMMMMMK LMMMMMMM                                          MMMMMMMML
   MMMMMMM    LMMMMMMMMMM           MMMMMMMK LMMMMMMMMLL                                        MMMMMMML
   MMMMMMM      LMMMMMMMMMLL        MMMMMMMK  LMMMMMMMMMMMMMMMMMMMMMMMMML LLLLLLLLLLLLLLLLLLLLMMMMMMMMMM
   MMMMMMM        MMMMMMMMMMML      MMMMMMMK   MMMMMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMMMM 
   MMMMMMM          LLMMMMMMMMML    MMMMMMMK     LLMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMML  
   MMMMMMM             MMMMMMMMMML  MMMMMMMK         KLMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMLK    
                                                                                                            
                                                                                                                                                                                                                                                                                                                        


Scanning with Keeping Infrastructure as Code Secure v2.1.14





Unpinned Actions Full Length Commit SHA, Severity: LOW, Results: 3
Description: Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
Platform: CICD
CWE: 829
Learn more about this vulnerability: https://docs.kics.io/latest/queries/cicd-queries/555ab8f9-2001-455e-a077-f2d0f41e2fb9

	[1]: .github/workflows/awesomebot.yml:18

		017:     - uses: actions/checkout@v5
		018:     - uses: docker://dkhamsing/awesome_bot:latest
		019:       with:


	[2]: .github/workflows/mega-linter.yml:52

		051:       - name: Lint Code Base
		052:         uses: megalinter/megalinter@v9
		053:         env:


	[3]: .github/workflows/pre-commit.yml:16

		015:       - uses: actions/setup-python@v6
		016:       - uses: pre-commit/action@v3.0.1
		017: 



Results Summary:
CRITICAL: 0
HIGH: 0
MEDIUM: 0
LOW: 3
INFO: 0
TOTAL: 3

A new version 'v2.1.15' of KICS is available, please consider updating
⚠️ BASH / shfmt - 2 errors
diff bin/pbsed.orig bin/pbsed
--- bin/pbsed.orig
+++ bin/pbsed
@@ -10,39 +10,39 @@
 set -o pipefail
 
 function debug() {
-  if [[ -n "$DEBUG" ]]; then
-    echo "$@"
-  fi
+	if [[ -n "$DEBUG" ]]; then
+		echo "$@"
+	fi
 }
 
 function has() {
-  # Check if a command is in $PATH
-  which "$@" > /dev/null 2>&1
+	# Check if a command is in $PATH
+	which "$@" >/dev/null 2>&1
 }
 
 # shellcheck disable=SC2317
 function echo-stderr() {
-  echo "$@" 1>&2  ## Send message to stderr.
+	echo "$@" 1>&2 ## Send message to stderr.
 }
 
 function fail() {
-  printf '%s\n' "$1" >&2  ## Send message to stderr. Exclude >&2 if you don't want it that way.
-  exit "${2-1}"  ## Return a code specified by $2 or 1 by default.
+	printf '%s\n' "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way.
+	exit "${2-1}"          ## Return a code specified by $2 or 1 by default.
 }
 
 function only-run-on() {
-  # shellcheck disable=SC2086
-  if [[ "$(uname -s | tr '[:upper:]' '[:lower:]')" != "$(echo $1 | tr '[:upper:]' '[:lower:]')" ]]; then
-    fail "This script only runs on $1, this machine is running $(uname -s)"
-  else
-    debug "OS ($(uname -s)) is valid..."
-  fi
+	# shellcheck disable=SC2086
+	if [[ "$(uname -s | tr '[:upper:]' '[:lower:]')" != "$(echo $1 | tr '[:upper:]' '[:lower:]')" ]]; then
+		fail "This script only runs on $1, this machine is running $(uname -s)"
+	else
+		debug "OS ($(uname -s)) is valid..."
+	fi
 }
 
 # print help/usage with no pattern/args
 test $# -eq 0 -o "$1" = "--help" && {
-  grep '^#/' < "$0" | cut -c4-
-  exit 0
+	grep '^#/' <"$0" | cut -c4-
+	exit 0
 }
 
 # pipe pboard through sed and then back again
diff bin/pbsort.orig bin/pbsort
--- bin/pbsort.orig
+++ bin/pbsort
@@ -5,47 +5,46 @@
 set -o pipefail
 
 function debug() {
-  if [[ -n "$DEBUG" ]]; then
-    echo "$@"
-  fi
+	if [[ -n "$DEBUG" ]]; then
+		echo "$@"
+	fi
 }
 
 function has() {
-  # Check if a command is in $PATH
-  which "$@" > /dev/null 2>&1
+	# Check if a command is in $PATH
+	which "$@" >/dev/null 2>&1
 }
 
 function echo-stderr() {
-  # shellcheck disable=SC2317
-  echo "$@" 1>&2  ## Send message to stderr.
+	# shellcheck disable=SC2317
+	echo "$@" 1>&2 ## Send message to stderr.
 }
 
 function fail() {
-  printf '%s\n' "$1" >&2  ## Send message to stderr. Exclude >&2 if you don't want it that way.
-  exit "${2-1}"  ## Return a code specified by $2 or 1 by default.
+	printf '%s\n' "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way.
+	exit "${2-1}"          ## Return a code specified by $2 or 1 by default.
 }
 
 function check-dependencies() {
-  debug "Checking dependencies..."
-  # shellcheck disable=SC2041
-  # Placeholders for whatever programs you really need
-  for dep in "$@"
-  do
-    if ! has "$dep"; then
-      fail "Can't find $dep in your $PATH"
-    else
-      debug "- Found $dep"
-    fi
-  done
+	debug "Checking dependencies..."
+	# shellcheck disable=SC2041
+	# Placeholders for whatever programs you really need
+	for dep in "$@"; do
+		if ! has "$dep"; then
+			fail "Can't find $dep in your $PATH"
+		else
+			debug "- Found $dep"
+		fi
+	done
 }
 
 function only-run-on() {
-  # shellcheck disable=SC2086
-  if [[ "$(uname -s | tr '[:upper:]' '[:lower:]')" != "$(echo $1 | tr '[:upper:]' '[:lower:]')" ]]; then
-    fail "This script only runs on $1, this machine is running $(uname -s)"
-  else
-    debug "OS ($(uname -s)) is valid..."
-  fi
+	# shellcheck disable=SC2086
+	if [[ "$(uname -s | tr '[:upper:]' '[:lower:]')" != "$(echo $1 | tr '[:upper:]' '[:lower:]')" ]]; then
+		fail "This script only runs on $1, this machine is running $(uname -s)"
+	else
+		debug "OS ($(uname -s)) is valid..."
+	fi
 }
 
 only-run-on darwin

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@unixorn unixorn merged commit dab572e into main Nov 2, 2025
5 of 7 checks passed
@unixorn unixorn deleted the fix-pbsort branch November 2, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant