Permalink
Switch branches/tags
Nothing to show
Commits on Feb 17, 2010
Commits on Sep 10, 2009
  1. Override the $NOCANCEL variants as well.

    Starting with Snow Leaopard, ruby at least uses the $NOCANCEL variants where before on Leopard it used the $NOCANCEL$UNIX2003 variants.
    ldaley committed Sep 10, 2009
  2. Explicitly build with gcc-4.0.

    Building with gcc-4.2 is not working at the moment.
    ldaley committed Sep 10, 2009
  3. Protect against recursive invocations of our system function overrides.

    Mac OS 10.6 introduced a change that caused our read variant to be invoked recursively resulting in a crash. This appears to be because malloc() now invokes read() for some reason.
    
    To solve this problem we mark a (thread local) flag whenever we invoke our custom override logic. If this flag is set when one of the system functions we override is called we defer straight to the system implementation, thereby avoid recursion. The same flag is used for all overridden system functions, so invocation of one of our overrides prevents any other overrides being used in that thread for the duration of the invocation.
    
    We use a library constructor to initialise our thread local storage. Interestingly, our system override functions can be called before our library constructor which causes problems. To work around this, we use a global flag to indicate whether our library constructor has been called. If it has not, we do not invoke any of our overridden system functions and instead defer straight to the system implementation.
    ldaley committed Sep 10, 2009
  4. Updated svn test to point to new macromates svn repo.

    This doesn't change the test semantics at all.
    ldaley committed Sep 10, 2009
Commits on Oct 26, 2008
  1. • If the timeval struct we create is not 0 initialised, log a message…

    … to ‘~/Library/Logs/tm_interactive_read.log’
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10745 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Oct 26, 2008
  2. • switch to safe (and legal) include guards

    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10744 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Oct 26, 2008
Commits on Sep 7, 2008
  1. • Don't modify the timeout param passed to select, make a new timeval…

    … struct if we need to change it.
    
    (also fixes a bug where a stack variable was used out of it's declared scope)
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10537 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  2. Test the file descriptor for being out of range (of the bit set) rath…

    …er than the index variable used to lookup the file descriptor.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10536 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  3. • Prevent a compile time warning about conflicting symbols when build…

    …ing for Leopard.
    
    The warning was ‘system_function_overrides.h:22: warning: asm declaration ignored due to conflict with previous rename’.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10535 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  4. • Use the system implementation of the actual variant of the system f…

    …unction that was requested.
    
    e.g. If the client app is actually linking against ‘_write$NOCANCEL$UNIX2003’, we now call that implementation after our custom stuff. Previously we just called ‘_write’ regardless.
    
    Also provided system_* functions for functions that we overwrite so we contain the logic of getting to the system implementation in one place.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10533 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  5. Rewrite remove_from_intset.

    The old remove_from_intset would decrease size and create a copy of the integer set with the element removed, but would not update the type to point to this new copy, so in practice remove_from_intset() would always remove the last element, regardless of argument passed in.
    
    New version uses memmove() to handle removal in-place.
    
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10532 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  6. • Improved select() logic.

    If the select() is on any fd that we would open up a dialog for, we call through to the system select() with a timeout of 0. We then augment the result to make sure it includes our dialog bound fds.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10530 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  7. Fix memory leak.

    Buffer used to take input from user was never destroyed.
    
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10529 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  8. • Rename ‘stdin_fd_tracker_inspect_select_readfds()’ to ‘stdin_fd_tra…

    …cker_augment_select_result()’.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10528 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  9. Use mblen_l() to find number of code points in UTF-8 string instead o…

    …f going via CFString.
    
    The length returned from CFString was number of UTF-16 characters, so it would previously return a length of 2 for a surrogate pair, where mblen() will correctly result in 1. Diacritics though will still result in a star per combining character.
    
    Though while testing this, the password dialog itself doesn’t handle neither surrogates nor diacritics correctly (when displaying these as stars).
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10527 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  10. Correctly type the buffer we work with as ‘const’.

    This avoids the typecast (going from ‘void const*’ → ‘char const*’ is legal in C) and it gives adds the ability for extra compiler checks (not mutating constant storage).
    
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10526 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  11. Simplify capture_for_prompt() (at least that was the goal :) ).

    The goal was to avoid the temporary index variables and auxiliary buffer.
    
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10525 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  12. Use memmove() instead of allocating a new buffer.

    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10524 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    sorbits committed Sep 7, 2008
  13. • Collapse needlessly nested ifs into one

    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10523 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  14. • Instead of using syscall(), use dlsym() to get at the real implemen…

    …tation of the system function we are augmenting, or trying to reach without going through our version.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10521 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
  15. • Rename 'real_select' function pointer to 'system_select' so it's cl…

    …earer what we are actually doing.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10520 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 7, 2008
Commits on Sep 3, 2008
  1. • Instead of using syscall() to get at the real implementation of sel…

    …ect(), use dlsym() to get the address of the real select() and call via that.
    
    This fixes the problem we had on 64bit architectures of select() (via syscall()) returning an error due to 'Bad file descriptor'.
    
    For an explanation of dlsym(), see http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/UsingDynamicLibraries.html
    
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10514 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 3, 2008
Commits on Sep 2, 2008
  1. • Fixed off by one bug in scanning backwards through buffer passed to…

    … write() looking for the first non space char
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10513 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Sep 2, 2008
Commits on Aug 14, 2008
  1. • Allow configuration of the fd that input echo is written to.

    We now look for the 'TM_INTERACTIVE_INPUT_ECHO_FD' env var. If it is present, it's integer value is used as the file descriptor to write the echo to. If it is absent, we use STDERR.
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10438 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Aug 14, 2008
Commits on Jun 22, 2008
  1. • Actually setup the interactive input env for the test.

    (was accidentally commented in the original commit)
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10022 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Jun 22, 2008
  2. • Added some extra debug output to select()

    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@10017 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed Jun 22, 2008
Commits on May 26, 2008
Commits on May 18, 2008
  1. • Make select() implementation more sophisticated.

    The naive implementation was causing problems. What we do now is…
    
    1. Make a copy of the fd set passed in reading.
    2. Call the system select() implementation.
    3. Compare the read fd set after the system call with the set of fds we are tracking for interactive input
        - If we are tracking an fd that is NOT in what the system select() returned, we add it and essentially increment the return value.
    
    This seems to be exactly the kind of logic at least that we should be using. Tests show that this fixes the problems with the naive implementation at least.
    
    
    
    git-svn-id: http://svn.textmate.org/trunk/Tools/tm_interactive_input@9605 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
    ldaley committed May 18, 2008