-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement NSTemporaryDirectory #242
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
Conversation
Temporary directory path may be unique for the user and may differ between operating systems. I'm not sure if it should be hardcoded as "/tmp". |
How about $TMPDIR? |
What does it mean to say that it "may" be per-user? I know that the Darwin Foundation documentation allows for this to be the case. However FHS 3.17 and IEEE P1003.2 do not; they specify only one temporary directory (well also Darwin's documentation is not sufficiently detailed that we could match the implementation (without someone digging out sourcecode and throwing us a specification). I'm not sure that is what is desired either, since on a standards-conforming Linux/Unix system, |
@drewcrawford documentation for
Swift is not targeted to Darwin solely, as such, in my opinion this value should take environment into consideration when calculate the value. In particular, |
I'm not opposed to taking the environment variable into account (it is also a standard) but then we are back to what to do when the environment variable is not set. It is not set in the situation that motivated this patch, and I can confirm that Darwin Foundation still returns a value in that case. Sent from my iPhone
|
Darwin should probably check against That would approximate the behavior of the Darwin version |
* Darwin should check against `confstr` using `_CS_DARWIN_USER_TEMP_DIR` * All platforms check against TMPDIR environment variable * Fall back to /tmp/
You might also want to take a look at the GNUStep implementation: https://github.com/timburks/gnustep-base/blob/master/Source/NSPathUtilities.m#L1908 |
so the docs say:
can't check ObjC foundation code... just wonder when it should return @phausler Difference to GNUStep implementation is that it return |
The case of nil is a massive failure internally so my guess is that other things would start to fail if that was a nil return anyhow. Usually in these cases we claim the minuscule edge case failure as making this a non nil return value. Darwin does not create the directory if it does not exist; we should maintain that behavior. The processes running with Foundation would rarely ever have the privs to actually create /tmp in the first place and we should not be requiring root to call that API. |
hmm swift-ci didn't run any tests for this... manual testing shows this works fine |
Implement NSTemporaryDirectory
@phausler understand. In that case documentation for NSTemporaryDirectory() need update in a way that it not suggest that returned value is usable. From now on developer should check if returned paths is usable for the application. It's tricky because (I think) for Objective-C it still may return nil value for unusable directory. There is related radar for this: lionheart/openradar-mirror#7356 |
Improve handling/testing of `filesDependenciesUpdated` for clangd
[pull] swiftwasm from main
No description provided.