Fixes #42232. And fixes memory leak with use of DirAccess, and harmonize the use of the sanitized pkg name. (cherry picked from commits 707a62783b and 02d228554b)
707a62783b
02d228554b
debug_symbols=full
debug_symbols=yes