-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix/macos path handling #169
fix/macos path handling #169
Conversation
solarispika
commented
Nov 10, 2023
- Allocate sufficient buffer for long file paths on macOS
- Fix building tests on macOS using CMake
- Fix compiler warnings
79ea8e5
to
8055c64
Compare
8055c64
to
a456c08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I left a couple of comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, there is also a warning when compile with debug config on macOS.
/Users/user/Programming/efsw/src/efsw/WatcherKqueue.cpp:439:14: warning: variable 's_fc' set but not used [-Wunused-but-set-variable]
static long s_fc = 0;
^
1 warning generated.
I am not sure how to fix it in a neat cross platform way without using C++17 [[maybe_unused]]
attribute.
Feel free to remove s_fc all-together, simply change the debug message from: efDEBUG( "Started using WatcherGeneric, reached file descriptors limit: %ld. Folders "
"added: %ld\n",
mWatcher->mFileDescriptorCount, s_fc ); to efDEBUG( "Started using WatcherGeneric, reached file descriptors limit: %ld.",
mWatcher->mFileDescriptorCount ); |
a456c08
to
e91a777
Compare
The previous implementation of FileSystem::precomposeFileName on macOS truncated file paths longer than 255 bytes due to a fixed buffer size of 255 bytes. This could lead to unexpected behavior with long file paths. This change uses CFStringGetMaximumSizeForEncoding to determine the needed buffer size to fully contain the string. This allows handling file paths up to the maximum possible length of LONG_MAX bytes, rather than imposing an arbitrary fixed limit. On the unlikely failure case, it returns empty string rather than truncating the path. This prevents incorrect handling of impractically long paths in the caller.
e91a777
to
91b74bd
Compare
91b74bd
to
5ffeeef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your collaboration!