Repository navigation
Warning
dpshell is under active development with unstable features. It is NOT recommended to use it as the default login shell in production environments.
Caution
Security restrictions such as fork bomb prevention cannot provide full protection. Do not execute untrusted scripts or unknown commands in risky environments.
Important
Certain configuration options like bash_compat will load user profile scripts (~/.bashrc) automatically. Please ensure all sourced scripts come from trusted sources.
Note
dpshell does not source /etc/profile or ~/.bash_profile during login. If your workflow depends on login profile scripts, use bash or brush instead.
🧩 Parser
- Recursive‑descent AST – added support for
if/elif/else,for,while/until,case/esac, and function definitions as first‑class nodes - I/O redirection –
>,>>,<,>&,<>,>|,<<,<<-with file descriptor tracking and adjacency detection - Command substitution prescan – preserves nested parentheses and quotes inside
$(...) - Tokenizer split respecting
$(–split_respecting_dollar_parenkeeps$()content intact during shlex splitting - Deferred command resolution – unresolved commands at parse time are accepted, allowing runtime function dispatch
- Compound commands –
{ ... }can be used as pipeline stages - Loop trailing redirections –
while ... done <fileis now correctly parsed \$escape handling – passed through expansion pipeline via U+FFFD sentinel
🔧 Variable Expansion
- New
expand_varsmodule – supports positional parameters$1…$9,$#,$@,$* - Parameter modifiers –
${var:-default},${var-word},${var:+word},${var+word},${var:=word} - Pattern stripping –
${var%pattern},${var%%pattern},${var#pattern},${var##pattern} - Arithmetic expansion –
$((expr))with+,-,*,/,%, comparisons and variable lookup - Command substitution preservation –
$(cmd)content is not prematurely substituted - Glob matching –
simple_glob_matchprovidesfnmatch‑style patterns forcasearms and${var%pat}
⚙️ Executor
- Command substitution –
capture_subshell_outputusingfork/pipe/waitpid - In‑process pipelines – builtins and brace groups run inside the shell without forking
- Runtime binary resolution – deferred command lookup now works for functions and external programs
- Function call threading –
ExecContextpasses positional parameters correctly - Exit code propagation –
$?(last_exit) is maintained across compound commands and lists - Bare variable assignments –
VAR=value cmdhandles command substitution in values - Loop redirection –
while/untilloops applystdinredirection viadup2/restore - Pipeline output flush –
stdoutis flushed beforeprocess::exitto avoid data loss - Self‑binary detection – dynamic via
current_exe()instead of hardcoded name
📦 Builtins
- Modular registry – monolithic
builtins.rssplit into per‑command files with registry‑based dispatch - New recognized builtins –
echo,read,printf,true,false - POSIX
read– multi‑variable word splitting (splitnonIFS) - Builtin dispatch in executor – works correctly inside pipelines and functions
DpShellstate – moved toshell/mod.rswithRefCell‑wrapped function table
📜 Script Mode
- Non‑interactive execution –
dpshell script.shanddpshell -c 'cmd' - Multi‑line joining – detects unclosed blocks (
if/for/while/case/function bodies) - Heredoc preprocessing –
<<DELIMcollects body and substitutes a temp file - Unified command routing – all script commands go through
execute_nodefor proper expansion - Login shell profiles – sources
/etc/profile,~/.bash_profile,~/.profile - Bash compatibility mode – additionally sources
~/.bashrcand uses~/.bash_history
💻 REPL
- Multi‑line input – heredoc collection and continuation detection
- Dynamic config reload –
/etc/deeprotection/config.tomlis re‑read at each prompt try_exitstandalone – used for enforcing‑mode exit authentication
🏗️ Build & Code Health
- New dependencies –
clap,thiserror,itertools - Warning suppression – crossterm patch warnings via Cargo.toml lints and
#[allow(dead_code)] - Cleanup – removed all unused imports and variables
- Cargo config – renamed
~/.cargo/config→config.tomlto silence deprecation warning - POSIX test suite –
posix_test.shvalidates 14 POSIX compatibility tests
🧬 Architecture Restructure
-
Flat
src/*.rs→ modulesbuiltins/(27 files)parser/(3 files) – movedsyntax.rs,expand_vars.rsexecutor/(2 files) – movedexpand.rsinteractive/(5 files) – movedbash_completer.rs,cycle_menu.rssecurity/(4 files) – movedrules.rs,plugins.rs,protection.rsconfig/,jobs/,logging/,shell/
-
Renames and moves
ShellState→DpShell(now inshell::mod)ExecContextgainedshell_vars,last_exit,positional_params
💥 Breaking Changes
- Module paths changed – all imports referencing top‑level modules (
syntax,executor,rules,plugins,protection,builtins,logger) must update to their new nested paths- e.g.
use syntax::...→use parser::syntax::... use builtins::...→use builtins::registry::...(or specific builtin module)
- e.g.
ShellStaterenamed toDpShelland moved toshell::modExecContextnow requires additional fields (shell_vars,last_exit,positional_params) – any external code constructing it must adapt- Standalone binary detection no longer hardcodes the program name – may affect scripts that relied on
argv[0]being unchanged