fsprojects / fsprojects/Paket

Specifying Git source breaks for url containing "%"

Open
#2,730 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug crash git
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

It appears that Paket gets confused when specyfing Git urls that contain a percent sign "%".

Repro steps
  1. Create a git repository that has a % in the URL. For example, on VSTS you can do the following:
  • create a project name with a space: "Bad Name"
  • use it as a git repo
  • in this example I created a repo in my VSTS, with the following contents
  1. Try using it in packet.dependencies
source https://www.nuget.org/api/v2

git ssh://jakzale@jakzale.visualstudio.com:22/_git/Bad%20Name Packages:/nupkg/
//git git@github.com:jakzale/bad-name-for-paket.git Packages:/nupkg/
nuget SomeRandomNameThatIsNotOnNuget
Expected behavior

Paket install the package. For instance, by using the other package source, paket install -v will give the following behaviour

source https://www.nuget.org/api/v2

//git ssh://jakzale@jakzale.visualstudio.com:22/_git/Bad%20Name Packages:/nupkg/
git git@github.com:jakzale/bad-name-for-paket.git Packages:/nupkg/
nuget SomeRandomNameThatIsNotOnNuget
Paket version 5.92.4
found: /Users/jakub/Developer/Bar/paket.dependencies
Parsing /Users/jakub/Developer/Bar/paket.dependencies
d14211e795c94edd473a2f5bdf8a9aeb129c106e	HEAD
d14211e795c94edd473a2f5bdf8a9aeb129c106e	refs/heads/master
f3d60b53fe12c2d1ae8c7d9874579f9b97c85c09
Fetching git@github.com:jakzale/bad-name-for-paket.git to /Users/jakub/.paket/git/db/bad-name-for-paket
Fetching origin
Fetching file:////Users/jakub/.paket/git/db/bad-name-for-paket to /Users/jakub/Developer/Bar/paket-files/github.com/jakzale/bad-name-for-paket
Checking for uncommitted changes in /Users/jakub/Developer/Bar/paket-files/github.com/jakzale/bad-name-for-paket
Checking for commits made in detached HEAD state in /Users/jakub/Developer/Bar/paket-files/github.com/jakzale/bad-name-for-paket
HEAD tags/paket/lock
Setting /Users/jakub/Developer/Bar/paket-files/github.com/jakzale/bad-name-for-paket to d14211e795c94edd473a2f5bdf8a9aeb129c106e
Updated tag 'paket/lock' (was f3d60b5)
Resolving packages for group Main:
   0 packages in resolution.
   1 requirements left
     - SomeRandomNameThatIsNotOnNuget,  (from /Users/jakub/Developer/Bar/paket.dependencies)

  Trying to resolve SomeRandomNameThatIsNotOnNuget  (from /Users/jakub/Developer/Bar/paket.dependencies)
Starting request to 'https://www.nuget.org/api/v2/FindPackagesById()?semVerLevel=2.0.0&id='SomeRandomNameThatIsNotOnNuget''
Source 'paket-files/github.com/jakzale/bad-name-for-paket/nupkg' yielded (0): [1.0.0]
 - Request '/Users/jakub/Developer/Bar/paket-files/github.com/jakzale/bad-name-for-paket/nupkg' finished with: [1.0.0]
Source 'https://www.nuget.org/api/v2' yielded (0): []
 - Request 'https://www.nuget.org/api/v2/FindPackagesById()?semVerLevel=2.0.0&id='SomeRandomNameThatIsNotOnNuget'' finished with: []
 - Request 'https://www.nuget.org/api/v2/Packages?semVerLevel=2.0.0&$filter=Id eq 'SomeRandomNameThatIsNotOnNuget'' was cancelled (another one was faster)

 - SomeRandomNameThatIsNotOnNuget 1.0.0
   Found Explored Package  SomeRandomNameThatIsNotOnNuget 1.0.0
Locked version resolution written to /Users/jakub/Developer/Bar/paket.lock
Installing into projects:
 - Creating model and downloading packages.
SomeRandomNameThatIsNotOnNuget 1.0.0 unzipped to /Users/jakub/Developer/Bar/packages/SomeRandomNameThatIsNotOnNuget
Garbage collecting /Users/jakub/Developer/Bar/packages/Foo
Performance:
 - Resolver: 962 milliseconds (1 runs)
    - Runtime: 197 milliseconds
    - Blocked (retrieving package details): 78 milliseconds (1 times)
    - Blocked (retrieving package versions): 686 milliseconds (1 times)
 - Disk IO: 73 milliseconds
 - Average Request Time: 616 milliseconds
 - Number of Requests: 1
 - Runtime: 7 seconds
Actual behavior

paket.exe install -v fails with the following error:

Paket version 5.92.4
found: /Users/jakub/Developer/Bar/paket.dependencies
Parsing /Users/jakub/Developer/Bar/paket.dependencies
d14211e795c94edd473a2f5bdf8a9aeb129c106e	HEAD
d14211e795c94edd473a2f5bdf8a9aeb129c106e	refs/heads/master
Fetching ssh://jakzale@jakzale.visualstudio.com:22/_git/Bad%20Name to /Users/jakub/.paket/git/db/Bad%20Name
Fetching origin
Cloning file:////Users/jakub/.paket/git/db/Bad%20Name to /Users/jakub/Developer/Bar/paket-files/jakzale_jakzale.visualstudio.com22/_git/Bad%20Name
Performance:
 - Runtime: 5 seconds
Paket failed with
-> Checkout to /Users/jakub/Developer/Bar/paket-files/jakzale_jakzale.visualstudio.com22/_git/Bad%20Name failed.
   Message: Could not run "git clone "file:////Users/jakub/.paket/git/db/Bad%20Name" "/Users/jakub/Developer/Bar/paket-files/jakzale_jakzale.visualstudio.com22/_git/Bad%20Name"".
   StackTrace:
       at Microsoft.FSharp.Core.PrintfModule+PrintFormatToStringThenFail@1379[TResult].Invoke (System.String message) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finish () [0x00012] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.PrintfImpl+Final3@247[TState,TResidue,TResult,A,B,C].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a, B b, C c) [0x0007d] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3301-2[T2,T3,T4,TResult,T1].Invoke (T2 u, T3 v, T4 w) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3266-1[T2,T3,TResult,T1].Invoke (T2 u, T3 v) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Git.Handling+checkoutToPaketFolder@209-16.Invoke (System.String arg30) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.FSharpFunc`2[T,TResult].InvokeFast[V] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] func, T arg1, TResult arg2) [0x0001f] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Core.FSharpFunc`2[T,TResult].InvokeFast[V,W] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] func, T arg1, TResult arg2, V arg3) [0x0003d] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Git.Handling.checkoutToPaketFolder (System.String repoFolder, System.String cloneUrl, System.String cacheCloneUrl, System.String commit) [0x0020b] in <d977c6907950405387463f29fc250100>:0 
       at Paket.RemoteDownload.downloadRemoteFiles$cont@187 (Paket.ModuleResolver+ResolvedSourceFile remoteFile, System.String destination, System.String cloneUrl, Microsoft.FSharp.Core.Unit unitVar) [0x00049] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@839[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1[T] args) [0x00052] in <d977c6907950405387463f29fc250100>:0 
     --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
       at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a] (Microsoft.FSharp.Control.AsyncBuilderImpl+AsyncImplResult`1[T] res) [0x0002d] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a] (System.Threading.CancellationToken token, Microsoft.FSharp.Control.FSharpAsync`1[T] computation) [0x00029] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a] (System.Threading.CancellationToken token, Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Core.FSharpOption`1[T] timeout) [0x00014] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Core.FSharpOption`1[T] timeout, Microsoft.FSharp.Core.FSharpOption`1[T] cancellationToken) [0x00071] in <d977c6907950405387463f29fc250100>:0 
       at Paket.RemoteDownload.DownloadSourceFiles (System.String rootPath, Paket.Domain+GroupName groupName, System.Boolean force, Microsoft.FSharp.Collections.FSharpList`1[T] sourceFiles) [0x00034] in <d977c6907950405387463f29fc250100>:0 
       at <StartupCode$Paket-Core>.$DependenciesFile+resolveGroup@212-1[b].Invoke (Paket.Domain+GroupName groupName, b _arg1) [0x0008f] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Collections.MapTreeModule.mapiOpt[a,b,c] (Microsoft.FSharp.Core.OptimizedClosures+FSharpFunc`3[T1,T2,TResult] f, Microsoft.FSharp.Collections.MapTree`2[TKey,TValue] m) [0x0002a] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue].Map[b] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f) [0x00014] in <d977c6907950405387463f29fc250100>:0 
       at Microsoft.FSharp.Collections.MapModule.Map[TKey,T,TResult] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] mapping, Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue] table) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Paket.DependenciesFile.Resolve[a] (System.Boolean force, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getSha1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getVersionF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getPreferredVersionF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getPackageDetailsF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getPackageRuntimeGraph, Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue] groupsToResolve, Paket.PackageResolver+UpdateMode updateMode) [0x00013] in <d977c6907950405387463f29fc250100>:0 
       at Paket.UpdateProcess.selectiveUpdate (System.Boolean force, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getSha1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getVersionsF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getPackageDetailsF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] getRuntimeGraphFromPackage, Paket.LockFile lockFile, Paket.DependenciesFile dependenciesFile, Paket.PackageResolver+UpdateMode updateMode, Paket.SemVerUpdateMode semVerUpdateMode) [0x0020d] in <d977c6907950405387463f29fc250100>:0 
       at Paket.UpdateProcess.SelectiveUpdate (Paket.DependenciesFile dependenciesFile, Microsoft.FSharp.Core.FSharpOption`1[T] alternativeProjectRoot, Paket.PackageResolver+UpdateMode updateMode, Paket.SemVerUpdateMode semVerUpdateMode, System.Boolean force) [0x000e6] in <d977c6907950405387463f29fc250100>:0 
       at Paket.UpdateProcess.SmartInstall (Paket.DependenciesFile dependenciesFile, Paket.PackageResolver+UpdateMode updateMode, Paket.UpdaterOptions options) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at <StartupCode$Paket-Core>.$PublicAPI+Install@176.Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x0002e] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Utils.RunInLockedAccessMode[a] (System.String rootFolder, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] action) [0x00084] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Dependencies.Install (Paket.InstallerOptions options) [0x00013] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Dependencies.Install (System.Boolean force, System.Boolean withBindingRedirects, System.Boolean cleanBindingRedirects, System.Boolean createNewBindingFiles, System.Boolean onlyReferenced, Paket.SemVerUpdateMode semVerUpdateMode, System.Boolean touchAffectedRefs, System.Boolean generateLoadScripts, Microsoft.FSharp.Collections.FSharpList`1[T] providedFrameworks, Microsoft.FSharp.Collections.FSharpList`1[T] providedScriptTypes, Microsoft.FSharp.Core.FSharpOption`1[T] alternativeProjectRoot) [0x0005c] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.install (Argu.ParseResults`1[Template] results) [0x00a38] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program+handleCommand@730-9.Invoke (Argu.ParseResults`1[Template] results) [0x00001] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.processWithValidationEx$cont@37[a] (System.Boolean silent, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] commandF, a result, Microsoft.FSharp.Core.Unit unitVar) [0x00002] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.processWithValidationEx[a] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] printUsage, System.Boolean silent, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] validateF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] commandF, a result) [0x00060] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.processWithValidation[T] (System.Boolean silent, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] validateF, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] commandF, Argu.ParseResults`1[Template] result) [0x00006] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.processCommand[a] (System.Boolean silent, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] commandF, Argu.ParseResults`1[Template] result) [0x00007] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.handleCommand (System.Boolean silent, Paket.Commands+Command command) [0x00158] in <d977c6907950405387463f29fc250100>:0 
       at Paket.Program.main () [0x003c4] in <d977c6907950405387463f29fc250100>:0 
Known workarounds

Don't use a git link that has a '%' sign (not always possible).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Paket.Git.Handling.checkoutToPaketFolder and Paket.RemoteDownload.DownloadSourceFiles, which appear in the failure stack trace, and reproduce the case using the paket.dependencies Git URL containing Bad%20Name. Trace how the encoded percent sign is handled during cloning; done means paket install succeeds for the reported URL while preserving the existing Git source behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.