Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
75e4ab3
configure: change package name to scallop and define full version
radhermit Dec 3, 2025
a49c840
Makefile.in: add static and shared library targets
radhermit Dec 30, 2021
e9ab6b4
Makefile.in: avoid running autoconf when building library
radhermit Nov 29, 2025
ec776c4
Makefile.in: use $(shell ...) instead of backticks to determine Patch…
radhermit Nov 29, 2025
c87b848
Makefile.in: install additional headers needed by scallop bindings
radhermit Dec 3, 2025
a7a071b
configure.ac: force -fPIC for external shared library creation
radhermit Dec 30, 2021
d70c55a
add configure flag for library build support
radhermit Jan 3, 2022
062010b
regenerate configure script and remove backup
radhermit Jan 4, 2022
e1a23d3
configure: don't configure doc, examples, po, and support dirs
radhermit Sep 16, 2022
4737fb8
Makefile.in: install scallop pkgconfig file
radhermit Dec 4, 2025
22496e6
builtins: disable complete plugin if support is disabled
radhermit Dec 30, 2021
e6ec7f6
config-top.h: prefer mkstemp over mktemp to avoid linking warning
radhermit Dec 30, 2021
0955d71
add initial register_builtins() support
radhermit Jan 8, 2022
4c0b7e9
add support for a `command_not_found_handle` builtin as well
radhermit Jan 9, 2022
1b18c46
export lib_init() and lib_reset() to initialize/reset the global state
radhermit Jan 10, 2022
428a887
allow BASH_CMDS and BASH_ALIASES data to be freed on reset
radhermit Jan 13, 2022
1e62684
add longjmp wrappers for sourcing and execution functionality
radhermit Jan 15, 2022
c1b4ac4
save and restore the previous top level longjmp on entry/exit
radhermit Nov 20, 2023
2c35df8
add initial support for proxying errors and warnings back to rust
radhermit Jan 22, 2022
757c7b2
add error support that reads the message from shared memory
radhermit Feb 14, 2022
c3b2329
jobs: don't set SIGCHLD handler by default when job control is disabled
radhermit Jun 29, 2022
500c752
use custom values for restricted shell name and static PATH
radhermit Dec 24, 2022
0aa8a13
shell: add support for toggling restricted mode
radhermit Dec 24, 2022
3896da9
shell: add support to set shell name via lib_init()
radhermit Jan 28, 2023
1cc6639
redir: allow write redirections to /dev/null under restricted mode
radhermit Dec 24, 2022
2fe4eba
variables: add set_var_read_write() support
radhermit May 10, 2023
bb57a3c
shell: fix environment propagation for library usage
radhermit May 15, 2023
34f4aa6
builtins: use a warning for `declare -p` with undefined variables
radhermit Jun 18, 2023
f76aa12
execute_cmd: always search for special builtins during simple command…
radhermit Sep 21, 2023
ca667c5
shell: support setting the environment via passed in values
radhermit Apr 28, 2025
ee52a4f
add required scallop configure options and related wrapper script
radhermit Dec 6, 2025
a73e911
ci: add release workflow
radhermit Dec 4, 2025
d8d83a5
ci: add test workflow
radhermit Dec 6, 2025
be21ac0
readme: add initial pkgcraft-related info
radhermit Dec 7, 2025
bd8b0c6
shopt: don't copy option names for get_shopt_options()
radhermit Dec 7, 2025
471ca73
make `enable` builtin use register_builtins()
radhermit Dec 7, 2025
0f9007d
execute_cmd.h: externally export `the_printed_command` global variable
radhermit Dec 7, 2025
fe37c8b
Bump actions/upload-artifact from 5 to 6
dependabot[bot] Dec 15, 2025
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-*]
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 [[ ${ref} != main && ${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: Copy release files
run: |
# remove unused files
rm -r bash/{doc,examples,tests,po}

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


- name: Build and install
run: |
# copy release files
cp -a ${RELEASE} ${RELEASE}-test
cd ${RELEASE}-test

# 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: Create tarball
run: tar -c -I "xz -9 -T0" -f ${RELEASE}.tar.xz ${RELEASE}

- name: Upload artifact
uses: actions/upload-artifact@v6
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@v6
with:
path: artifacts
merge-multiple: true

- name: Create GitHub release
uses: softprops/action-gh-release@v2
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