Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commandline arguments parsed improperly #1639

Open
hadek314 opened this issue Sep 11, 2018 · 2 comments
Open

Commandline arguments parsed improperly #1639

hadek314 opened this issue Sep 11, 2018 · 2 comments

Comments

@hadek314
Copy link

hadek314 commented Sep 11, 2018

What You Are Seeing?

In my nuspec I have variables:

$src$ and $bin$

It looks like this:


<file src="$src$\tools\chocolateyInstall.ps1" target="tools"/>

 <file src="$src$\tools\chocolateyUninstall.ps1" target="tools"/>

 <file src="$bin$\bin\**\*" target="bin-service"/>

What is Expected?

Running this:

choco pack filename.nuspec

Generates error:

The replacement token 'src' has no value

However this:

choco pack filename.nuspec src="testpath"

Generates error:

File specified is either not found or not a .nuspec file. 'filename.nuspec src=testpath'

Adding any other flag between nuspec file name and parameter does not change the error. For example:

choco pack filename.nuspec --version 0.0.3 src="testpath"

generates the same error.

Note that parser picks out '--' variable but then concatenates the nuspec file name and key=val as if the combined string was the complete path to nuspec file.

Output Log

SourceType='normal'|Debug='True'|Verbose='False'|Trace='False'|

Force='False'|Noop='False'|HelpRequested='False'|

UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|

PromptForConfirmation='False'|AcceptLicense='False'|

AllowUnofficialBuild='False'|

Input='filename.nuspec src=testpath'|Version='0.0.3'|

AllVersions='False'|SkipPackageInstallProvider='False'|

Prerelease='False'|ForceX86='False'|OverrideArguments='False'|

NotSilent='False'|ApplyPackageParametersToDependencies='False'|

ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|

AllowMultipleVersions='False'|AllowDowngrade='False'|

ForceDependencies='False'|Information.PlatformType='Windows'|

Information.PlatformVersion='6.3.9600.0'|

Information.PlatformName='Windows Server 2012 R2'|

Information.ChocolateyVersion='0.10.5.0'|

Information.ChocolateyProductVersion='0.10.5'|

Information.FullName='choco, Version=0.10.5.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|

Information.Is64BitProcess='True'|Information.IsInteractive='True'|

Information.IsUserAdministrator='True'|

Information.IsProcessElevated='True'|

Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|

Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|

Features.AllowEmptyChecksums='False'|

Features.AllowEmptyChecksumsSecure='True'|

Features.FailOnAutoUninstaller='False'|

Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|

Features.LogEnvironmentValues='False'|Features.VirusCheck='False'|

Features.FailOnInvalidOrMissingLicense='False'|

Features.IgnoreInvalidOptionsSwitches='True'|

Features.UsePackageExitCodes='True'|

Features.UseFipsCompliantChecksums='False'|

Features.ShowNonElevatedWarnings='True'|

Features.ShowDownloadProgress='True'|

Features.StopOnFirstPackageFailure='False'|

Features.UseRememberedArgumentsForUpgrades='False'|

Features.ScriptsCheckLastExitCode='False'|

ListCommand.LocalOnly='False'|

ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|

ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|

ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|

ListCommand.ApprovedOnly='False'|

ListCommand.DownloadCacheAvailable='False'|

ListCommand.NotBroken='False'|

ListCommand.IncludeVersionOverrides='False'|

UpgradeCommand.FailOnUnfound='False'|

UpgradeCommand.FailOnNotInstalled='False'|

UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|

UpgradeCommand.ExcludePrerelease='False'|

NewCommand.AutomaticPackage='False'|

NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|

SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|

SourceCommand.AllowSelfService='False'|

FeatureCommand.Command='unknown'|

ConfigCommand.Command='unknown'|PinCommand.Command='unknown'|

Proxy.BypassOnLocal='True'|

_ Chocolatey:ChocolateyPackCommand - Normal Run Mode _

Chocolatey had an error occur:

System.ArgumentException: File specified is either not found or not a .nuspec file. 'clientreporting-service.nuspec src=

testpath'

at chocolatey.infrastructure.app.services.NugetService.<>c__DisplayClass23.<validate_and_return_package_file>b__22(St

ring name, String value)

at chocolatey.infrastructure.guards.Ensure1.meets(Func2 ensureFunction, Action`2 exceptionAction)

at chocolatey.infrastructure.app.services.NugetService.validate_and_return_package_file(ChocolateyConfiguration confi

g, String extension)

at chocolatey.infrastructure.app.services.NugetService.pack_run(ChocolateyConfiguration config)

at chocolatey.infrastructure.app.services.ChocolateyPackageService.pack_run(ChocolateyConfiguration config)

at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boole

an isConsole, Action`1 parseArgs)

at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Contai

ner container)

at chocolatey.console.Program.Main(String[] args)

@hadek314
Copy link
Author

hadek314 commented Sep 11, 2018

I'm going to close this issue but maybe someone needs to take a look at it later and/or handle errors better.
It turned out that nuspec had the following string for version "1.1.x". When launched 'pack' like this:
choco pack filename.nuspec the first error it presented was about lack of $src$ substitution. When I provided substitution to $src$ and $bin$ the error should have been that XML Element "version" was invalid. Instead it was presenting error with strangely concatenated nuspec name.

Bottom line there is a bug but it's in error handling when XML element value is not valid.

@gep13
Copy link
Member

gep13 commented Sep 13, 2018

@hadek314 in case someone gets a chance to look at this, can you please provide a sample nuspec that illustrates the problem that you are seeing?

@gep13 gep13 reopened this Sep 13, 2018
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

No branches or pull requests

2 participants