Skip to content

MDEV-39118: test_if_hard_path crashes on recursively resolving $HOME#4943

Open
raghunandanbhat wants to merge 1 commit into10.11from
10.11-mdev-39118
Open

MDEV-39118: test_if_hard_path crashes on recursively resolving $HOME#4943
raghunandanbhat wants to merge 1 commit into10.11from
10.11-mdev-39118

Conversation

@raghunandanbhat
Copy link
Copy Markdown
Contributor

@raghunandanbhat raghunandanbhat commented Apr 15, 2026

fixes MDEV-39118

Problem:

When $HOME is set to ~/ (or any string starting with ~/), the home_dir is initialized to that value. When test_if_hard_path is called on a path starting with ~/, it replaces the ~/ prefix by recursively calling test_if_hard_path(home_dir) leading to infinite recursion and a crash.

Fix:

Add a check in test_if_hard_path to see if home_dir itself begins with ~/. If it does, skip the recursive call to prevent the infinite loop.

Problem:
  When `$HOME` is set to `~/` (or any string starting with `~/`), the
  `home_dir` is initialized to that value. When `test_if_hard_path` is
  called on a path starting with `~/`, it replaces the `~/` prefix by
  recursively calling `test_if_hard_path(home_dir)` leading to infinite
  recursion and a crash.

Fix:
  Add a check in `test_if_hard_path` to see if `home_dir` itself begins
  with `~/`. If it does, skip the recursive call to prevent the
  infinite loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant