Fixes #40324. (cherry picked from commit 47cc202972) Also removes empty `p_path` as done in 4857648a16.
47cc202972
4857648a16