diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-12-19 14:41:19 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-12-19 21:32:39 -0600 |
commit | 85deb61f666f6817c1a137ace4d666c8ae2940fb (patch) | |
tree | b341f45a3a9d1a58d7cd2bf37f1565d7d34ce970 | |
parent | 149867e176f22fe0af1a57355a7ace820710a791 (diff) | |
download | wix-85deb61f666f6817c1a137ace4d666c8ae2940fb.tar.gz wix-85deb61f666f6817c1a137ace4d666c8ae2940fb.tar.bz2 wix-85deb61f666f6817c1a137ace4d666c8ae2940fb.zip |
4862 - Disallow Burn Variables that are Hidden and Persisted.
5 files changed, 36 insertions, 2 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 0817aef3..86fec16e 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
@@ -3178,6 +3178,11 @@ namespace WixToolset.Core | |||
3178 | this.Core.Write(ErrorMessages.ReservedNamespaceViolation(sourceLineNumbers, node.Name.LocalName, "Name", "Wix")); | 3178 | this.Core.Write(ErrorMessages.ReservedNamespaceViolation(sourceLineNumbers, node.Name.LocalName, "Name", "Wix")); |
3179 | } | 3179 | } |
3180 | 3180 | ||
3181 | if (hidden && persisted) | ||
3182 | { | ||
3183 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Hidden", "yes", "Persisted")); | ||
3184 | } | ||
3185 | |||
3181 | var type = this.ValidateVariableTypeWithValue(sourceLineNumbers, node, typeValue, value); | 3186 | var type = this.ValidateVariableTypeWithValue(sourceLineNumbers, node, typeValue, value); |
3182 | 3187 | ||
3183 | this.Core.ParseForExtensionElements(node); | 3188 | this.Core.ParseForExtensionElements(node); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs index 7a630a36..02422cf7 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs | |||
@@ -55,5 +55,28 @@ namespace WixToolsetTest.CoreIntegration | |||
55 | Assert.Equal(21, result.ExitCode); | 55 | Assert.Equal(21, result.ExitCode); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | |||
59 | [Fact] | ||
60 | public void BundleVariableWithHiddenPersistedIsRejected() | ||
61 | { | ||
62 | var folder = TestData.Get(@"TestData\BadInput"); | ||
63 | |||
64 | using (var fs = new DisposableFileSystem()) | ||
65 | { | ||
66 | var baseFolder = fs.GetFolder(); | ||
67 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
68 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
69 | |||
70 | var result = WixRunner.Execute(new[] | ||
71 | { | ||
72 | "build", | ||
73 | Path.Combine(folder, "HiddenPersistedBundleVariable.wxs"), | ||
74 | "-intermediateFolder", intermediateFolder, | ||
75 | "-o", wixlibPath, | ||
76 | }); | ||
77 | |||
78 | Assert.Equal(193, result.ExitCode); | ||
79 | } | ||
80 | } | ||
58 | } | 81 | } |
59 | } | 82 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs index 293b379f..a2d49b18 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs | |||
@@ -1,6 +1,5 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | 1 | <?xml version="1.0" encoding="utf-8" ?> |
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | xmlns:ex="http://www.example.com/scheams/v1/wxs"> | ||
4 | <Fragment> | 3 | <Fragment> |
5 | <Variable Name="BadType" Type="doesnotexist" Value="dne" /> | 4 | <Variable Name="BadType" Type="doesnotexist" Value="dne" /> |
6 | </Fragment> | 5 | </Fragment> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs new file mode 100644 index 00000000..5ebe5472 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <Variable Name="BadType" Hidden="yes" Persisted="yes" Value="dne" /> | ||
5 | </Fragment> | ||
6 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 8680bb8a..a38e89ce 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -21,6 +21,7 @@ | |||
21 | <Content Include="TestData\BadInput\BundleVariable.wxs" CopyToOutputDirectory="PreserveNewest" /> | 21 | <Content Include="TestData\BadInput\BundleVariable.wxs" CopyToOutputDirectory="PreserveNewest" /> |
22 | <Content Include="TestData\BadInput\DuplicateCacheIds.wxs" CopyToOutputDirectory="PreserveNewest" /> | 22 | <Content Include="TestData\BadInput\DuplicateCacheIds.wxs" CopyToOutputDirectory="PreserveNewest" /> |
23 | <Content Include="TestData\BadInput\DuplicatePayloadNames.wxs" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="TestData\BadInput\DuplicatePayloadNames.wxs" CopyToOutputDirectory="PreserveNewest" /> |
24 | <Content Include="TestData\BadInput\HiddenPersistedBundleVariable.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
24 | <Content Include="TestData\BadInput\RegistryKey.wxs" CopyToOutputDirectory="PreserveNewest" /> | 25 | <Content Include="TestData\BadInput\RegistryKey.wxs" CopyToOutputDirectory="PreserveNewest" /> |
25 | <Content Include="TestData\BadInput\UnscheduledPackage.wxs" CopyToOutputDirectory="PreserveNewest" /> | 26 | <Content Include="TestData\BadInput\UnscheduledPackage.wxs" CopyToOutputDirectory="PreserveNewest" /> |
26 | <Content Include="TestData\BadInput\UnscheduledRollbackBoundary.wxs" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="TestData\BadInput\UnscheduledRollbackBoundary.wxs" CopyToOutputDirectory="PreserveNewest" /> |