ast icon indicating copy to clipboard operation
ast copied to clipboard

`pathexists()` function does not invalidate cache

Open siteshwar opened this issue 5 years ago • 1 comments

Description of problem: pathexists() function caches file permissions in a tree structure, but does not invalidate the entries. This will return invalid results if file permissions on cached path changes.

Ksh version: 2017.0.0-devel-2552-g68ea9cb8

siteshwar avatar Mar 14 '19 10:03 siteshwar

As is typical in this project the tree structure incorrectly defines the variable length element at the end of the structure to have a non-zero length:

char name[1];

This might be related to the static Tree_t tree; definition since using that object requires the variable length name structure refer to an empty string. But that is an awful way to ensure that since it masks off by one problems with dynamically allocating that structure.

P.S., Google (not to mention searching the code in this project) suggests that config var PATH_ATTRIBUTES is wholly undocumented. Which is another reason to remove the AST getconf code.

krader1961 avatar Mar 18 '19 05:03 krader1961