google / google/googletest

Infinite recursion leading to crash when death tests are disabled

Open
#3,869 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
39.6k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

**Describe the bug**

https://github.com/google/googletest/commit/e5686bb18b52dc29312a7b79c3d6ca2c826c31ed from https://github.com/google/googletest/pull/3090 introduced a change where `original_working_dir_` is only set when `GTEST_HAS_DEATH_TEST` are enabled. This makes the assumption that death tests being disabled is synonymous to being on a diskless system.

On a non-diskless system where `GTEST_HAS_DEATH_TEST` are disabled, this results in the variable being empty, and then `CreateDirectoriesRecursively` being called without a parent and recursing infinitely.

**Steps to reproduce the bug**

1. Define `GTEST_HAS_DEATH_TEST` to 0
2. run with `-gtest_output=xml:out.xml`

I will provide a PR for this, but I was curious to know if there was a reason to make the assumption that "diskless" and death tests are correlated?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing original_working_dir_ and CreateDirectoriesRecursively in the XML output path handling. Reproduce with GTEST_HAS_DEATH_TEST set to 0 and -gtest_output=xml:out.xml; done means the command no longer recurses infinitely and produces the expected XML output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.