Opened 7 years ago

#11947 new Patches

filesystem: getting file_type from a directory_entry without causing a system call on linux

Reported by: Taru Karttunen <taruti@…> Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.61.0 Severity: Optimization
Keywords: Cc:

Description

When iterating over a directory with directory_iterator the directory_entries are created with the file_type component of the m_symlink_status defined if the filesystem supports it on Linux due to BOOST_FILESYSTEM_STATUS_CACHE.

However the directory iteration does not produce the permission component of the file status. Thus if using somedirectoryentry.symlink_status().type() the library performs a superfluous lstat system call because status_known does not succeed due to permissions_present not succeeding.

This is possible to fix e.g. by adding a symlink_type method to the directory_entry class, a patch implementing it is linked below:

https://github.com/taruti/filesystem/commit/835bcd3c13697cbd7fc3d8574fd07475eeada398

ps. Is the documentation manually or automatically created and does it need a separate patch?

Change History (0)

Note: See TracTickets for help on using tickets.