Skip to content

Commit

Permalink
Merge pull request #184 from microsoft/master
Browse files Browse the repository at this point in the history
Cut new release to fix deadlock with large Git configs
  • Loading branch information
mjcheetham committed Sep 28, 2020
2 parents 85e4125 + 815e267 commit fe025c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build-Installers

on:
push:
branches: [ master ]
branches: [ master, release ]
pull_request:
branches: [ master ]

Expand Down
10 changes: 5 additions & 5 deletions src/linux/Packaging.Linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ Section: vcs
Priority: optional
Architecture: $ARCH
Depends:
Maintainer: GCM-Core <gcmcore@microsoft.com>
Description: Cross Platform Git-Credential-Manager-Core command line utility.
Linux build of the GCM-Core project to support auth with a number of
git hosting providers including GitHub, BitBucket, and Azure DevOps.
Hosted at https://github.com/microsoft/Git-Credential-Manager-Core
Maintainer: GCM-Core <gcmsupport@microsoft.com>
Description: Cross Platform Git Credential Manager Core command line utility.
GCM Core supports authentication with a number of Git hosting providers
including GitHub, BitBucket, and Azure DevOps.
For more information see https://aka.ms/gcmcore
EOF

# Copy single binary to target installation location
Expand Down
12 changes: 6 additions & 6 deletions src/shared/Microsoft.Git.CredentialManager/GitConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public void Enumerate(GitConfigurationEnumerationCallback cb)
using (Process git = _git.CreateProcess($"config --null {level} --list"))
{
git.Start();
// To avoid deadlocks, always read the output stream first and then wait
// TODO: don't read in all the data at once; stream it
string data = git.StandardOutput.ReadToEnd();
git.WaitForExit();

switch (git.ExitCode)
Expand All @@ -112,9 +115,6 @@ public void Enumerate(GitConfigurationEnumerationCallback cb)
$"Failed to enumerate all Git configuration entries. Exit code '{git.ExitCode}' (level={_filterLevel})");
}

// TODO: don't read in all the data at once; stream it
string data = git.StandardOutput.ReadToEnd();

IEnumerable<string> entries = data.Split('\0').Where(x => !string.IsNullOrWhiteSpace(x));
foreach (string entry in entries)
{
Expand Down Expand Up @@ -217,6 +217,9 @@ public IEnumerable<string> GetRegex(string nameRegex, string valueRegex)
using (Process git = _git.CreateProcess($"config --null {level} --get-regex {nameRegex} {valueRegex}"))
{
git.Start();
// To avoid deadlocks, always read the output stream first and then wait
// TODO: don't read in all the data at once; stream it
string data = git.StandardOutput.ReadToEnd();
git.WaitForExit();

switch (git.ExitCode)
Expand All @@ -229,9 +232,6 @@ public IEnumerable<string> GetRegex(string nameRegex, string valueRegex)
$"Failed to get Git configuration multi-valued entry '{nameRegex}' with value regex '{valueRegex}'. Exit code '{git.ExitCode}' (level={_filterLevel})");
}

// TODO: don't read in all the data at once; stream it
string data = git.StandardOutput.ReadToEnd();

string[] entries = data.Split('\0');
foreach (string entry in entries)
{
Expand Down

0 comments on commit fe025c1

Please sign in to comment.