Revert "dir: remove PATH_MAX limitation"

This reverts commit d3ccb7dd53f24cf9131490cf4e223d76b4e68723, which
was merged too prematurely.