Follow-up from "Create generic directory traversal method, introduce `buildboxcommon_direntwrapper`, and add support for `chmod`'ing directories."

The following discussion from !160 (merged) should be addressed:

  • @juergbi started a discussion: (+1 comment)

    Why do we ignore fstat errors? An fstat error seems very unlikely unless fd is not a valid file descriptor. In that case an exception is definitely warranted, in my opinion.

TODO

  • Update FileUtils is_directory to check for fstat errors.
  • Use lstat instead of stat so symlinks aren't followed.