You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] ~/.rc.d login bridge lists snippets through the user's ls alias or function #587
The ~/.rc.d login bridge that acq writes into ~/.profile (acq_login_profile_rc_block in acq.backends/common.sh) picks its snippets with $(LC_ALL=C ls "$HOME"/.rc.d). ~/.profile sources ~/.bashrc first, so in an interactive login shell any ls alias or function the user has defined (in .bashrc or in an earlier drop-in) is already active when the block runs, and the bridge lists ~/.rc.d through it.
Depending on the alias, snippets run in the wrong order or are silently skipped. With two snippets, 10-a.sh and 20-b.sh:
alias ls='ls -r': both run, in reverse order.
alias ls='ls -F': an executable snippet is listed as 10-a.sh*, fails the *.sh check, and is skipped.
alias ls='ls -Q': names come back quoted, fail the character guard, and nothing is sourced.
alias ls='ls -l' or a replacement such as eza -la: the loop iterates every word of the long listing (permissions, owners, sizes) and the snippets still run only because their names happen to appear among those words.
What did you expect?
The bridge sources exactly the readable *.sh files in ~/.rc.d, in C-collation order, whatever ls is aliased or wrapped to in the user's shell.
Steps to reproduce
. acq.backends/common.sh
home=$(mktemp -d); mkdir "$home/.rc.d"echo'echo 10-a'>"$home/.rc.d/10-a.sh";echo'echo 20-b'>"$home/.rc.d/20-b.sh"
acq_login_profile_rc_block >"$home/profile"
HOME="$home" bash -c 'shopt -s expand_aliases; alias ls="ls -r". "$HOME/profile"'# prints 20-b then 10-a; with alias ls="ls -Q" it prints nothing
In a sandbox: add alias ls='ls -r' to ~/.bashrc and run bash -lic true; the drop-ins run in reverse order.
Docker version
N/A: msb backend (msb 0.7.8). The bridge text is shared, so sbx is affected the same way.
Suggested fix: LC_ALL=C command ls "$HOME"/.rc.d. command bypasses aliases and functions and keeps the C collation and the block's line count. I have a branch with the change and a regression test and will open a PR referencing this issue.
Activity