• Sylvain Defresne's avatar
    Avoid creating an empty netrc file in $TEMP · 2b138f74
    Sylvain Defresne authored
    The code to load .netrc file copies it to a temporary file
    named $TEMP/XXXXXXXXXgerrit_util/netrc before loading it
    to workaround crbug.com/664664.
    
    However, using a netrc file is deprecated (in favor of a
    gitcookies file instead) so most of the time, the file is
    empty. Instead of creating an empty file, load data from
    /dev/null (named os.devnull).
    
    This avoid leaving an empty file lying around (since the
    temporary file is not deleted), and avoid race-conditions
    on Windows when multiple processes/threads try to create
    the same file.
    
    Bug: none
    Change-Id: I873b72402038ca3f0d32387353dc89b731aaa927
    Reviewed-on: https://chromium-review.googlesource.com/1132998
    Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
    Reviewed-by: 's avatarRyan Tseng <hinoka@chromium.org>
    2b138f74
gerrit_util.py 30.4 KB