Skip to content

Implement uninstall flow#659

Merged
florelis merged 32 commits into
microsoft:masterfrom
florelis:UninstallCommand
Dec 16, 2020
Merged

Implement uninstall flow#659
florelis merged 32 commits into
microsoft:masterfrom
florelis:UninstallCommand

Conversation

@florelis

@florelis florelis commented Dec 2, 2020

Copy link
Copy Markdown
Member

This is in progress and does not work completely yet. I'm opening it as a draft to see if there are any major issues.

Changes:

  • Added an UninstallCommand as an experimental feature.
  • Added workflow tests for uninstall (not passing yet).
  • Added uninstall WorkflowTasks for uninstalling MSIX/MSStore apps with the package name, and everything else with the uninstall string. This uses already existing information form manifests/ARP.

Still missing:

  • Logging, reporting, telemetry
  • E2E tests
  • More manual validation to work out details/edge cases

Related: #121 #397

Microsoft Reviewers: Open in CodeFlow

@github-actions

github-actions Bot commented Dec 2, 2020

Copy link
Copy Markdown

New misspellings found, please review:

  • fca
  • insalled
  • kzf
  • qxf
  • Skype
  • skypeapp
  • STARTUPINFOW
  • uninstallation
  • wcsdup
  • zg
To accept these changes, run the following commands
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"AComment addressof ALIGNAS allescaped alse ARMEL backend bitfield blep BORLAND cassert cctype cdunn cerr clocale CMake cmath cname codepoint cplusplus CPPLIB cstddef cstdio cstdlib cstr cstring CStyle ctor czstring deque deref dllimport dnp elif emark endcode endverbatim EOL eturn eyc fpclassify gcc GNUC hpux HREF hrow ieeefp inl iosfwd isfinite Isfinitef isnan isprint IString javascript jsonvalue keey keylength lconv len Lepilleur localeconv lossfree malloc maxsize memcmp memcpy memset MINGW modf msvc Multiline mutators nfinity noreturn NULLREF nvcc NVIDIAs OString ote ptrdiff py Solaris sourceforge sout SOVERSION ssin stackoverflow stdarg strchr strcmp strdup strlen strncmp unindent Unserialize usf valueiterator vscprintf vsnprintf walkaround wiki wikipedia Workaround xf xl "');
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)(?:$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"fca insalled kzf qxf Skype skypeapp STARTUPINFOW uninstallation wcsdup zg "');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a) cmp lc($b)} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;'
git add .github/actions/spelling || echo '... you want to ensure .github/actions/spelling/expect.txt is added to your repository...'
#Closed

@github-actions

github-actions Bot commented Dec 3, 2020

Copy link
Copy Markdown

New misspellings found, please review:

  • fca
  • insalled
  • INSTALLLEVEL
  • INSTALLSTATE
  • INSTALLUILEVEL
  • kzf
  • qxf
  • Skype
  • skypeapp
  • STARTUPINFOW
  • uninstallation
  • zg
To accept these changes, run the following commands
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"AComment addressof ALIGNAS allescaped alse ARMEL backend bitfield blep BORLAND cassert cctype cdunn cerr clocale CMake cmath cname codepoint cplusplus CPPLIB cstddef cstdio cstdlib cstr cstring CStyle ctor czstring deque deref dllimport dnp elif emark endcode endverbatim EOL eturn eyc fpclassify gcc GNUC hpux HREF hrow ieeefp inl iosfwd isfinite Isfinitef isnan isprint IString javascript jsonvalue keey keylength lconv len Lepilleur localeconv lossfree malloc maxsize memcmp memcpy memset MINGW modf msvc Multiline mutators nfinity noreturn NULLREF nvcc NVIDIAs OString ote ptrdiff py Solaris sourceforge sout SOVERSION ssin stackoverflow stdarg strchr strcmp strdup strlen strncmp unindent Unserialize usf valueiterator vscprintf vsnprintf walkaround wiki wikipedia Workaround xf xl "');
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)(?:$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"fca insalled INSTALLLEVEL INSTALLSTATE INSTALLUILEVEL kzf qxf Skype skypeapp STARTUPINFOW uninstallation zg "');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a) cmp lc($b)} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;'
git add .github/actions/spelling || echo '... you want to ensure .github/actions/spelling/expect.txt is added to your repository...'
#Closed

Comment thread src/AppInstallerCLITests/TestData/InstallFlowTest_MSStore.yaml
Comment thread src/AppInstallerCLICore/Commands/UninstallCommand.cpp
Comment thread src/AppInstallerCommonCore/ExperimentalFeature.cpp
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
@github-actions

github-actions Bot commented Dec 3, 2020

Copy link
Copy Markdown

New misspellings found, please review:

  • fca
  • INET
  • kzf
  • qxf
  • zg
To accept these changes, run the following commands
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"AComment addressof ALIGNAS allescaped alse ARMEL backend bitfield blep BORLAND cassert cctype cdunn cerr clocale CMake cmath cname codepoint cplusplus CPPLIB cstddef cstdio cstdlib cstr cstring CStyle ctor czstring deque deref dllimport dnp elif emark endcode endverbatim EOL eturn eyc fpclassify gcc GNUC hpux HREF hrow ieeefp inl iosfwd isfinite Isfinitef isnan isprint IString javascript jsonvalue keey keylength lconv len Lepilleur localeconv lossfree malloc maxsize memcmp memcpy memset MINGW modf msvc Multiline mutators nfinity noreturn NULLREF nvcc NVIDIAs OString ote ptrdiff py Skype Solaris sourceforge sout SOVERSION ssin stackoverflow stdarg strchr strcmp strdup strlen strncmp unindent Unserialize usf valueiterator vscprintf vsnprintf walkaround wiki wikipedia Workaround xf xl "');
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)(?:$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"fca INET kzf qxf zg "');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a) cmp lc($b)} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;'
git add .github/actions/spelling || echo '... you want to ensure .github/actions/spelling/expect.txt is added to your repository...'
#Closed

Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp
// TODO: log & report
AICLI_TERMINATE_CONTEXT(E_ABORT);
}
else if (uninstallResult.value() != 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(uninstallResult.value() != 0) [](start = 16, length = 30)

This may need to be smarter; at a minimum I would expect a lot of "reboot required" errors coming out. I think that for at least MSI we should probably figure out what can come back from msiexec.exe and be able to handle those values.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm leaving this as a TODO for now as I'm not entirely sure what's the right thing to do with other exit codes. I'm trying to find an application that returns something non-zero to see what it does and how it is handled when uninstalling with Porgrams and Features or the Settings app. I'll probably add a telemetry point for errors that will help here.

Comment thread src/AppInstallerCLITests/WorkFlow.cpp
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp Outdated
* Add test package family names to spell checker.
* Update settings schema and docs.
* Use wil RAII wrappers.
* Use standard/silent uninstall string if requested is not available.
* Remove unneeded catch.
@florelis florelis changed the title Implement uninstall flow (draft) Implement uninstall flow Dec 11, 2020
@florelis florelis marked this pull request as ready for review December 11, 2020 03:33
@florelis florelis requested a review from a team as a code owner December 11, 2020 03:33
@yao-msft

yao-msft commented Dec 11, 2020

Copy link
Copy Markdown
Contributor

/azp run #Closed

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment thread src/AppInstallerTestExeInstaller/main.cpp Outdated
Comment thread src/AppInstallerTestExeInstaller/main.cpp Outdated
@yao-msft

yao-msft commented Dec 15, 2020

Copy link
Copy Markdown
Contributor
        productCodeStream << argv[i];

I know it's not your fault but probably a previous unaddressed comment. This should just be std::string productCode; (not std::wstring) declaration in line 131 and direct assignment here.

In line 131,
std::string produceCode;

And here:
productCode = argv[i]; #Closed


Refers to: src/AppInstallerTestExeInstaller/main.cpp:151 in 1181019. [](commit_id = 1181019, deletion_comment = False)

Comment thread src/AppInstallerTestExeInstaller/main.cpp Outdated
Comment thread src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw Outdated
Comment thread src/AppInstallerCLIE2ETests/BaseCommand.cs
Comment thread src/AppInstallerCLIE2ETests/UninstallCommand.cs Outdated
Comment thread src/AppInstallerCLIE2ETests/UninstallCommand.cs Outdated
Comment thread src/AppInstallerCLICore/Workflows/UninstallFlow.cpp
@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Comment thread src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp
Comment thread src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw Outdated

@yao-msft yao-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@florelis florelis merged commit d170d65 into microsoft:master Dec 16, 2020
@jedieaston jedieaston mentioned this pull request Jan 26, 2021
@florelis florelis deleted the UninstallCommand branch February 5, 2021 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants