Skip to content

Commit

Permalink
REVERT ME: Debugging the hard way :(
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMcPMS committed Nov 13, 2021
1 parent ac8f703 commit dc818af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/AppInstallerCommonCore/SHA256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "Public/AppInstallerSHA256.h"
#include "Public/AppInstallerRuntime.h"
#include "Public/AppInstallerErrors.h"
#include "Public/AppInstallerLogging.h"

using namespace AppInstaller::Runtime;

Expand Down Expand Up @@ -142,6 +143,8 @@ namespace AppInstaller::Utility {

SHA256::HashBuffer SHA256::ComputeHash(std::istream& in)
{
// TODO: DELETE ALL LOGGING FROM HERE
AICLI_LOG(Core, Info, << "Starting ComputeHash: stream is " << in.rdstate());
// Throw exceptions on badbit
auto excState = in.exceptions();
auto revertExcState = wil::scope_exit([excState, &in]() { in.exceptions(excState); });
Expand All @@ -154,15 +157,20 @@ namespace AppInstaller::Utility {

while (in.good())
{
AICLI_LOG(Core, Info, << "Reading stream");
in.read((char*)(buffer.get()), bufferSize);
AICLI_LOG(Core, Info, << " read " << in.gcount() << " bytes");
if (in.gcount())
{
AICLI_LOG(Core, Info, << " adding to hash");
hasher.Add(buffer.get(), static_cast<size_t>(in.gcount()));
}
AICLI_LOG(Core, Info, << " stream is " << in.rdstate());
}

if (in.eof())
{
AICLI_LOG(Core, Info, << "Returning hash");
return hasher.Get();
}
else
Expand Down

1 comment on commit dc818af

@github-actions
Copy link

@github-actions github-actions bot commented on dc818af Nov 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

Unrecognized words, please review:

  • rdstate
Previously acknowledged words that are now absent activatable Globals mytool URIs Utils
To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:JohnMcPMS/winget-cli.git repository
on the createdll branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/JohnMcPMS/winget-cli/comments/60199713" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  
update_files
rm $comment_body
git add -u

Please sign in to comment.