Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0b1533f
configure: change package name to scallop and define full version
radhermit Dec 3, 2025
d3bbdf2
configure: force -fPIC for external shared library creation
radhermit Dec 30, 2021
d7dd417
configure: add flag for library build support
radhermit Jan 3, 2022
c8931b1
configure: don't configure doc, examples, po, and support dirs
radhermit Sep 16, 2022
f46618e
Makefile.in: add static and shared library targets
radhermit Dec 30, 2021
413f66f
Makefile.in: avoid running autoconf when building library
radhermit Nov 29, 2025
30cf480
Makefile.in: use $(shell ...) instead of backticks to determine Patch…
radhermit Nov 29, 2025
09c6a91
Makefile.in: install additional headers needed by scallop bindings
radhermit Dec 3, 2025
9501b24
Makefile.in: install scallop pkgconfig file
radhermit Dec 4, 2025
b4dab24
builtins: disable complete plugin if support is disabled
radhermit Dec 30, 2021
4012cc1
config-top.h: prefer mkstemp over mktemp to avoid linking warning
radhermit Dec 30, 2021
e26a88b
add initial register_builtins() support
radhermit Jan 8, 2022
86a7eb5
add support for a `command_not_found_handle` builtin as well
radhermit Jan 9, 2022
a7289a8
export lib_init() and lib_reset() to initialize/reset the global state
radhermit Jan 10, 2022
373bffb
allow BASH_CMDS and BASH_ALIASES data to be freed on reset
radhermit Jan 13, 2022
ff79e3b
add longjmp wrappers for sourcing and execution functionality
radhermit Jan 15, 2022
d9cce26
save and restore the previous top level longjmp on entry/exit
radhermit Nov 20, 2023
cfcf1da
add initial support for proxying errors and warnings back to rust
radhermit Jan 22, 2022
43a8f50
add error support that reads the message from shared memory
radhermit Feb 14, 2022
20525ad
jobs: don't set SIGCHLD handler by default when job control is disabled
radhermit Jun 29, 2022
9d066fc
use custom values for restricted shell name and static PATH
radhermit Dec 24, 2022
2b7a096
shell: add support for toggling restricted mode
radhermit Dec 24, 2022
33d255e
shell: add support to set shell name via lib_init()
radhermit Jan 28, 2023
fd59a27
redir: allow write redirections to /dev/null under restricted mode
radhermit Dec 24, 2022
a20234e
variables: add set_var_read_write() support
radhermit May 10, 2023
947f442
shell: fix environment propagation for library usage
radhermit May 15, 2023
0eefb25
builtins: use a warning for `declare -p` with undefined variables
radhermit Jun 18, 2023
d371d0a
execute_cmd: always search for special builtins during simple command…
radhermit Sep 21, 2023
b633814
shell: support setting the environment via passed in values
radhermit Apr 28, 2025
212b890
add required scallop configure options and related wrapper script
radhermit Dec 6, 2025
87dd4fc
ci: add release workflow
radhermit Dec 4, 2025
26d72ac
ci: add test workflow
radhermit Dec 6, 2025
1d35bec
readme: add initial pkgcraft-related info
radhermit Dec 7, 2025
cb98247
shopt: don't copy option names for get_shopt_options()
radhermit Dec 7, 2025
b091e47
make `enable` builtin use register_builtins()
radhermit Dec 7, 2025
745a583
execute_cmd.h: externally export `the_printed_command` global variable
radhermit Dec 7, 2025
3cefe39
Bump softprops/action-gh-release from 2 to 3
dependabot[bot] Jun 8, 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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
108 changes: 108 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: release

on:
push:
tags: [scallop-*]
branches: ['**']
paths:
- ".github/workflows/release.yml"
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.release.outputs.release }}
version: ${{ steps.release.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Get the release name
id: release
run: |
name=$(sed -rn "/^PACKAGE_NAME=/ s/^.*='(.*)'/\1/p" configure)
version=$(sed -rn "/^PACKAGE_VERSION=/ s/^.*='(.*)'/\1/p" configure)
release=${name}-${version}
ref=${{ github.ref_name }}

# verify tag name matches configure script
if [[ ${{ github.ref_type }} == tag && ${ref} != ${release} ]]; then
echo "tag name ${ref} doesn't match package: ${release}"
exit 1
fi

echo "release=${release}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT

source:
needs: release
runs-on: ubuntu-latest
env:
RELEASE: ${{ needs.release.outputs.release }}
VERSION: ${{ needs.release.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
path: bash

- name: Create release tarball
run: |
# remove unused files
rm -r bash/{doc,examples,tests,po}

# copy non-hidden files
mkdir ${RELEASE}
cp -a bash/* ${RELEASE}

# create tarball
tar -c -I "xz -9 -T0" -f ${RELEASE}.tar.xz ${RELEASE}

- name: Build and install
run: |
cd ${RELEASE}

# configure using required scallop options
./configure-scallop

# build static and shared libraries
make -j libscallop.a libscallop.so

# install shared library and headers
sudo make install-library install-headers

- name: Test
run: |
# verify shared library is installed and pkg-config works as expected
pkg-config --modversion scallop
pkg-config --exact-version ${VERSION} scallop

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: source
path: ./*.tar.xz
if-no-files-found: error
retention-days: 3

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: source
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true

- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
files: artifacts/*.tar.xz
fail_on_unmatched_files: true
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: test

on:
push:
branches: '**'
workflow_dispatch:

jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Get the package version
id: version
run: |
version=$(sed -rn "/^PACKAGE_VERSION=/ s/^.*='(.*)'/\1/p" configure)
date=${version##*.}
expected_date=$(date -u +"%Y%m%d")

# verify patch date
if [[ ${date} != ${expected_date} ]]; then
echo outdated scallop patch date: ${date}
exit 1
fi

echo "version=${version}" >> $GITHUB_OUTPUT

test:
needs: version
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.version.outputs.version }}

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

- name: Build and install
run: |
# configure using required scallop options
./configure-scallop

# build static and shared libraries
make -j libscallop.a libscallop.so

# install shared library and headers
sudo make install-library install-headers

- name: Test
run: |
# verify shared library is installed and pkg-config works as expected
pkg-config --modversion scallop
pkg-config --exact-version ${VERSION} scallop
41 changes: 33 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,13 @@ VERSOBJ = bashversion.$(OBJEXT)

Program = bash$(EXEEXT)
Version = @BASHVERS@
PatchLevel = `$(BUILD_DIR)/$(VERSPROG) -p`
PatchLevel = $(shell $(BUILD_DIR)/$(VERSPROG) -p)
RELSTATUS = @RELSTATUS@

# scallop targets
StaticLibrary = libscallop.a
SharedLibrary = libscallop.so

Machine = @host_cpu@
OS = @host_os@
VENDOR = @host_vendor@
Expand Down Expand Up @@ -504,11 +508,11 @@ INSTALLED_HEADERS = shell.h bashjmp.h command.h syntax.h general.h error.h \
bashtypes.h xmalloc.h config-top.h config-bot.h \
bashintl.h bashansi.h bashjmp.h alias.h hashlib.h \
conftypes.h unwind_prot.h jobs.h siglist.h \
execute_cmd.h
execute_cmd.h input.h pathexp.h flags.h
# these can appear in either the source directory or the build directory and
# are installed by install-headers
HYBRID_HEADERS = y.tab.h
INSTALLED_BUILTINS_HEADERS = bashgetopt.h common.h getopt.h
INSTALLED_BUILTINS_HEADERS = builtext.h bashgetopt.h common.h getopt.h
INSTALLED_INCLUDE_HEADERS = posixstat.h ansi_stdlib.h filecntl.h posixdir.h \
memalloc.h stdc.h posixjmp.h posixwait.h posixtime.h systimes.h \
unionwait.h maxpath.h shtty.h typemax.h ocache.h chartypes.h gettext.h \
Expand Down Expand Up @@ -636,6 +640,22 @@ $(Program): $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) .build
ls -l $(Program)
-$(SIZE) $(Program)

$(StaticLibrary): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
$(RM) $@
$(AR) $(ARFLAGS) $@ $(OBJECTS)
-for lib in $(BUILTINS_DEP) $(LIBDEP); do \
for obj in $$($(AR) t $$lib); do \
$(AR) q $@ $$(dirname $$lib)/$$obj ;\
done ;\
done
$(RANLIB) $@

$(SharedLibrary): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
$(RM) $@
$(eval SCALLOP_LIBRARY = $(SharedLibrary).$(PACKAGE_VERSION))
$(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) \
-Wl,-soname,${SCALLOP_LIBRARY} -shared -o ${SCALLOP_LIBRARY} $(OBJECTS) $(LIBS)

.build: $(SOURCES) config.h Makefile $(DEFDIR)/builtext.h version.h $(VERSPROG)
@echo
@echo " ***********************************************************"
Expand Down Expand Up @@ -862,8 +882,8 @@ $(SUPPORT_DIR)/bashbug.sh: $(SUPPORT_DIR)/bashbug.sh.in
CONFIG_FILES=$(SUPPORT_DIR)/bashbug.sh CONFIG_HEADERS= $(SHELL) ./config.status

# comment out for distribution
$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
cd $(srcdir) && autoconf
#$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
# cd $(srcdir) && autoconf

# for chet
reconfig: force
Expand Down Expand Up @@ -925,6 +945,11 @@ install: .made installdirs
-( cd $(PO_DIR) ; $(MAKE) $(BASH_MAKEFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(BASH_MAKEFLAGS) DESTDIR=$(DESTDIR) $@ )

install-library:
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(libdir)
$(INSTALL) $(INSTALLMODE) $(SharedLibrary).* $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir) && ln -sf $(SharedLibrary).* $(SharedLibrary)

install-strip:
$(MAKE) $(BASH_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_STRIP_PROGRAM)' \
prefix=${prefix} exec_prefix=${exec_prefix} \
Expand Down Expand Up @@ -966,7 +991,7 @@ install-headers: maybe-install-headers
${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
fi ; \
done
-$(INSTALL_DATA) $(SUPPORT_DIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc
-$(INSTALL_DATA) $(SUPPORT_DIR)/$(PACKAGE).pc $(DESTDIR)$(pkgconfigdir)/$(PACKAGE).pc

uninstall-headers-dirs:
-$(RMDIR) $(DESTDIR)$(headersdir)/builtins $(DESTDIR)$(headersdir)/include
Expand All @@ -981,7 +1006,7 @@ uninstall-headers:
for hf in $${SDH} ; do \
( cd $(DESTDIR)$(headersdir) && $(RM) $$(basename "$$hf") ) \
done
-( $(RM) $(DESTDIR)$(pkgconfigdir)/bash.pc )
-( $(RM) $(DESTDIR)$(pkgconfigdir)/$(PACKAGE).pc )
# uninstall-headers-dirs
-$(RMDIR) $(DESTDIR)$(headersdir)/builtins $(DESTDIR)$(headersdir)/include
-$(RMDIR) $(DESTDIR)$(headersdir)
Expand All @@ -1003,7 +1028,7 @@ LIB_SUBDIRS = ${RL_LIBDIR} ${HIST_LIBDIR} ${TERM_LIBDIR} ${GLOB_LIBDIR} \
${INTL_LIBDIR} ${TILDE_LIBDIR} ${ALLOC_LIBDIR} ${SH_LIBDIR}

basic-clean:
$(RM) $(OBJECTS) $(Program) bashbug
$(RM) $(OBJECTS) $(Program) $(StaticLibrary) $(SharedLibrary)* bashbug
$(RM) .build .made version.h

clean: basic-clean
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[![ci](https://github.com/pkgcraft/bash/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/pkgcraft/bash/actions/workflows/test.yml)

# bash

Forked version of bash supporting shell interactions (e.g. writing builtins or
modifying variables, arrays, and functions) natively in rust via the scallop crate.

## Development

Note that the development workflow involves rebasing against upstream and force
pushing to keep the patch stack in order.
Loading
Loading