Repository: cake-build/cake

Issue #1342: Error: Unknown Token when directory contains @ character.
Created: 2016-11-04T04:36:50Z
This is a major issue when using Jenkins Pipeline Multi-Branch builds with multiple executors.
What You Are Seeing?
Windows
D:\Dev\test@123
λ .\build.ps1
Preparing to run build script...
Running build script...
Analyzing build script...
Processing build script...
Installing tools...
Error: Unknown token
OS X
jeremycade@lupmini:test@123 (master)$ ./build.sh 
Feeds used:
  /Users/jeremycade/.local/share/NuGet/Cache
  /Users/jeremycade/.nuget/packages/
  https://api.nuget.org/v3/index.json

All packages listed in /Users/jeremycade/src/lup/web/test@123/tools/packages.config are already installed.
Analyzing build script...
Processing build script...
Installing tools...
Error: Unknown token
What is Expected?
Build to execute.
What version of Cake are you using?
Version 0.16.2+Branch.main.Sha.fb23be463dacfa51c9b19a7cd111149dda7e8c6b
Are you running on a 32 or 64 bit system?
64 Bit
What environment are you running on?  Windows? Linux? Mac?

Windows 10
Windows 2012 R2
OS X 10.12.1

Are you running on a CI Server?  If so, which one?

Jenkins (Windows 2012 R2)
Local (Windows & OS X)

How Did You Get This To Happen? (Steps to Reproduce)
Create a directory with a @ in the Directory Name
Output Log
Windows
D:\Dev\test@123
λ .\build.ps1 -Verbosity Diagnostic
Preparing to run build script...
Running build script...
Module directory does not exist.
Analyzing build script...
Analyzing D:/Dev/test@123/build.cake...
Processing build script...
Installing tools...
Error: System.NotSupportedException: Unknown token
   at Cake.Core.IO.Globbing.GlobTokenizer.ScanToken()
   at Cake.Core.IO.Globbing.GlobTokenizer.Scan()
   at Cake.Core.IO.Globbing.GlobParserContext.Accept()
   at Cake.Core.IO.Globbing.GlobParserContext.Accept(GlobTokenKind[] kind)
   at Cake.Core.IO.Globbing.GlobParserContext.Accept(GlobTokenKind kind)
   at Cake.Core.IO.Globbing.GlobParser.ParseIdentifier(GlobParserContext context)
   at Cake.Core.IO.Globbing.GlobParser.ParseSubSegment(GlobParserContext context)
   at Cake.Core.IO.Globbing.GlobParser.ParseSegment(GlobParserContext context)
   at Cake.Core.IO.Globbing.GlobParser.Parse(GlobParserContext context)
   at Cake.Core.IO.Globbing.GlobParser.Parse(String pattern, Boolean caseSensitive)
   at Cake.Core.IO.Globber.Match(String pattern, Func`2 predicate)
   at Cake.Core.IO.GlobberExtensions.Match(IGlobber globber, String pattern)
   at Cake.Core.IO.GlobberExtensions.GetFiles(IGlobber globber, String pattern)
   at Cake.NuGet.NuGetContentResolver.GetFiles(DirectoryPath path, PackageReference package)
   at Cake.NuGet.NuGetContentResolver.GetToolFiles(DirectoryPath path, PackageReference package)
   at Cake.NuGet.NuGetContentResolver.GetFiles(DirectoryPath path, PackageReference package, PackageType type)
   at Cake.NuGet.NuGetPackageInstaller.Install(PackageReference package, PackageType type, DirectoryPath path)
   at Cake.Core.Scripting.ScriptProcessor.InstallTools(ScriptAnalyzerResult analyzerResult, DirectoryPath installPath)
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
   at Cake.Commands.BuildCommand.Execute(CakeOptions options)
   at Cake.CakeApplication.Run(CakeOptions options)
   at Cake.Program.Main()
OS X
jeremycade@lupmini:dev@123 (master)$ ./build.sh -v Diagnostic
Feeds used:
  /Users/jeremycade/.local/share/NuGet/Cache
  /Users/jeremycade/.nuget/packages/
  https://api.nuget.org/v3/index.json

All packages listed in /Users/jeremycade/src/lup/web/dev@123/tools/packages.config are already installed.
Module directory does not exist.
Analyzing build script...
Analyzing /Users/jeremycade/src/lup/web/dev@123/build.cake...
Processing build script...
Installing tools...
Error: System.NotSupportedException: Unknown token
  at Cake.Core.IO.Globbing.GlobTokenizer.ScanToken () <0x2592d88 + 0x00207> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobTokenizer.Scan () <0x2592ce8 + 0x0003b> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParserContext.Accept () <0x2592c98 + 0x00017> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParserContext.Accept (Cake.Core.IO.Globbing.GlobTokenKind[] kind) <0x25975d8 + 0x0008f> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParserContext.Accept (GlobTokenKind kind) <0x2597570 + 0x0003f> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParser.ParseIdentifier (Cake.Core.IO.Globbing.GlobParserContext context) <0x2597540 + 0x00023> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParser.ParseSubSegment (Cake.Core.IO.Globbing.GlobParserContext context) <0x2597480 + 0x00037> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParser.ParseSegment (Cake.Core.IO.Globbing.GlobParserContext context) <0x2597280 + 0x00137> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParser.Parse (Cake.Core.IO.Globbing.GlobParserContext context) <0x2592a78 + 0x0010b> in <filename unknown>:0 
  at Cake.Core.IO.Globbing.GlobParser.Parse (System.String pattern, Boolean caseSensitive) <0x2589bb8 + 0x0004b> in <filename unknown>:0 
  at Cake.Core.IO.Globber.Match (System.String pattern, System.Func`2 predicate) <0x25899c8 + 0x00097> in <filename unknown>:0 
  at Cake.Core.IO.GlobberExtensions.Match (IGlobber globber, System.String pattern) <0x2589908 + 0x00032> in <filename unknown>:0 
  at Cake.Core.IO.GlobberExtensions.GetFiles (IGlobber globber, System.String pattern) <0x2589880 + 0x00027> in <filename unknown>:0 
  at Cake.NuGet.NuGetContentResolver.GetFiles (Cake.Core.IO.DirectoryPath path, Cake.Core.Packaging.PackageReference package) <0x2589000 + 0x0013f> in <filename unknown>:0 
  at Cake.NuGet.NuGetContentResolver.GetToolFiles (Cake.Core.IO.DirectoryPath path, Cake.Core.Packaging.PackageReference package) <0x2588c38 + 0x00073> in <filename unknown>:0 
  at Cake.NuGet.NuGetContentResolver.GetFiles (Cake.Core.IO.DirectoryPath path, Cake.Core.Packaging.PackageReference package, PackageType type) <0x2588b50 + 0x0006b> in <filename unknown>:0 
  at Cake.NuGet.NuGetPackageInstaller.Install (Cake.Core.Packaging.PackageReference package, PackageType type, Cake.Core.IO.DirectoryPath path) <0x2588528 + 0x00139> in <filename unknown>:0 
  at Cake.Core.Scripting.ScriptProcessor.InstallTools (Cake.Core.Scripting.Analysis.ScriptAnalyzerResult analyzerResult, Cake.Core.IO.DirectoryPath installPath) <0x2587ee0 + 0x001ea> in <filename unknown>:0 
  at Cake.Core.Scripting.ScriptRunner.Run (IScriptHost host, Cake.Core.IO.FilePath scriptPath, IDictionary`2 arguments) <0x257d040 + 0x001bc> in <filename unknown>:0 
  at Cake.Commands.BuildCommand.Execute (Cake.CakeOptions options) <0x257cf50 + 0x0004b> in <filename unknown>:0 
  at Cake.CakeApplication.Run (Cake.CakeOptions options) <0x2579cb0 + 0x00042> in <filename unknown>:0 
  at Cake.Program.Main () <0x580ee0 + 0x002ff> in <filename unknown>:0

Duplicate issue #1316: NotSupportedException when run a simple script on new machine
Created: 2016-10-25T07:10:34Z
cake script (file build.cake):
#tool "nuget:?package=NUnit.Runners&version=2.6.4"

Task("Test")
    .Does(()=>
{
    Information("Test");
});

RunTarget("Test");

build.cmd
@echo off
powershell ./build.ps1 %CAKE_ARGS% %* -Verbosity Diagnostic
pause

Closing comment (2016-11-06T20:38:14Z): There is a PR #1343  that fixes this issue and it's duplicate #1342.
May I suggest that it is merged in the interim to avoid issues with Jenkins CI Pipeline builds, given that Jenkins Workspace directories in the Pipeline Multibranch model almost always have @ in the directory name. It is a significant pain point.