Skip to content

fix(rc.d): list ~/.rc.d with command ls in the login bridge - #588

Open
basiliskus wants to merge 1 commit into
mainfrom
fix/rc-bridge-command-ls
Open

basiliskus wants to merge 1 commit into
mainfrom
fix/rc-bridge-command-ls

Conversation

@basiliskus

Copy link
Copy Markdown
Contributor

Summary

The ~/.rc.d login bridge (acq_login_profile_rc_block) lists snippets with $(LC_ALL=C ls "$HOME"/.rc.d). The login ~/.profile sources ~/.bashrc before that block, so in an interactive login shell a user's ls alias or function is already in effect when the block runs. Depending on the alias, snippets run in the wrong order (ls -r), are skipped (ls -F on an executable snippet, ls -Q), or are found only because their names appear among the words of a long listing (ls -l).

This switches the listing to LC_ALL=C command ls, which bypasses aliases and functions. The C collation, guards, and line count of the block (and so the heal's max_lines bound) are unchanged.

Related Issues

Fixes #587

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Checklist

  • I have read CONTRIBUTING.md
  • My commits follow the Conventional Commits format (e.g., feat:, fix:, docs:)
  • I have tested my changes locally
  • I have updated documentation as needed
  • I have not included any secrets, API keys, or sensitive information

Test Results

  • New test rc.d: login-profile block ignores an ls alias or function from .bashrc (#587) (72-msb-agent-user.bats) runs the generated block with alias ls="ls -r" and, separately, an ls function that names one snippet twice and omits the other. Without the fix it fails (20-b then 10-a); with it, both cases source 10-a then 20-b.
  • The two tests that pin the bridge text (72-msb-agent-user.bats, 90-sbx-startup-kit.bats) now assert LC_ALL=C command ls.
  • bats --filter 'rc.d|#426' over both files: 14/14 pass. shellcheck -S warning acq.backends/common.sh: clean.
  • Full ./scripts/test-acq-bats: 730 pass, 12 fail. The same 10 fail on unmodified main in this environment (clone, msys, migration-gate, dispatch, github-scope, and msb provision tests), and the other 2 are the sbx grammar acceptance tests, which need sbx login.

The login ~/.profile sources ~/.bashrc before the rc.d block, so in an
interactive login shell a user's `ls` alias or function is already
defined when the block lists ~/.rc.d. Depending on the alias, snippets
then run in the wrong order (`ls -r`), are skipped (`ls -F` on an
executable snippet, `ls -Q`), or are found only because their names
appear among the words of a long listing (`ls -l`). `command ls` skips
aliases and functions; the C collation and the block's line count are
unchanged.

Fixes #587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ~/.rc.d login bridge lists snippets through the user's ls alias or function

1 participant