Instead of passing the file descriptor to the child, and have the child close it, we set FD_CLOEXEC on the file descriptor in the parent process.
While it limits the window in which another thread can fork() and cause the file descriptor to be “leaked”, it doesn’t eliminate the problem.
This is read using the ‘environmentWhitelist’ key and the value should be a colon-separated list of variables that should be inherited from TextMate’s parent process. If the variable includes an asterisk then it is matched as a glob.
Example:
defaults write com.macromates.TextMate.preview environmentWhitelist '$default:MANPATH:*EDITOR'
Here ‘$default’ will expand to TextMate’s default whitelist.
Normally TextMate will setup HOME, PATH, TMPDIR, LOGNAME, and USER. If you whitelist any of these, then the variable (if set) will instead be inherited from the parent process.
Closes#718.
Previously when opening a file TextMate only looked at the (cached) inode of the open documents to learn if the requested file was already open. This could result in opening two versions of the same file e.g. after ‘git rebase’ as git will write new files with new inodes when updating the working copy.
Closes issue #666.
The function could fail if the directory was created after the function had tested that it didn’t exist, as the mkdir() would then fail (with “Already Exists”).
Initially the environment was clean but it was found that some variables should be inherited, e.g. SSH_AUTH_SOCK.
Therefor a blacklist was introduced, but it seems futile trying to keep it updated with all the variables that may affect the behavior of commands executed from within TextMate, therefor we now use a whitelist.
Probably the whitelist should be user configurable as launchd uses environment variables to communicate dynamically allocated sockets (like SSH_AUTH_SOCK, but there are also some Apple-prefixed variables pointing to named sockets).
Issue #238.
Since the std::map hosting the basic environment was using a (function local) static initializer, it would be destroyed during exit — though there might be threads using the basic environment, and joining these might happen after destroying the basic environment.
This should explain the crash in network::launch_tbz.
Only one readlink() failure reported (issue #389) which wouldn’t explain the crashes which the dialog (introduced in 68ed8293) was trying to track down.
I am seeing crash reports from resolve_links and I can’t think of any other reason for this crash, than readlink() returning a value which is neither -1 nor in the range [0..len].
We now leave a potential trailing slash in the result.
This fixes the issue of the missing slash in ⌘T — while I normally prefer the slash to be stripped, I think path::with_tilde should be an exception since effectively it is just replacing the path prefix, it shouldn’t do any real processing (although we do actually normalize the string).
Also fix a bug where we would use tilde for paths pointing to a user folder for a user with current user’s name as prefix.
This is actually not entirely trivial since we can have a path that starts with a slash but includes more ‘..’ components than there are actual directories in the path.
Incase we do a git commit that launches TextMate, it will inherit a bunch of variables from git, including GIT_DIR, which will cause issues for the Git bundle.
Previously this was under the OakSystem framework which depends on the io framework meaning that the io framework itself was unable to obtain a basic environment, which is necessary for next commit.