LoopPerfect / buckaroo

The decentralized package manager for C++ and friends 🏝️
https://buckaroo.pm
MIT License
933 stars 33 forks source link

Windows path issue #340

Closed aahmed-se closed 5 years ago

aahmed-se commented 5 years ago

Wasn't able to install packages on windows

Description

PS C:\Users\test\apache-pulsar-demo> buckaroo install
LibGit2Sharp.LibGit2SharpException: invalid escape at Users\test\Documents\.buckaroo\cache\https-github-com-buckaroo-pm-apache-pulsar-git-a68ec2d684e0c601
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
   at <StartupCode$buckaroo>.$GitLib.Buckaroo-IGit-Unshallow@160-5.Invoke(Unit _arg20) in C:\projects\buckaroo\buckaroo\GitLib.fs:line 161
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)

Possible Fix

remap paths during windows execution

Version

2.0.0

nikhedonia commented 5 years ago

remap paths during windows execution

yeah we should...

The latest version of Buckaroo (v2.2) checks if Git is installed and uses that instead of LibGit2. Git on Windows supports backslashes in paths.

aahmed-se commented 5 years ago

@nikhedonia you are right but the error is different now on 2.2.0

C:\Users\test\apache-pulsar-demo>buckaroo install
info Installing packages...
info No receipt found for buckaroo\github\buckaroo-pm\apache-pulsar; it will be installed.
info Installing buckaroo\github\buckaroo-pm\apache-pulsar...
Buckaroo.Bash+BashException: The command "git -C buckaroo\github\buckaroo-pm\apache-pulsar fetch origin +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*" exited with code 128
   at Buckaroo.Bash.runBashSync@66-4.Invoke(Unit _arg3) in C:\projects\buckaroo\buckaroo\Bash.fs:line 68
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)

not sure what's the reason

nikhedonia commented 5 years ago

My hypothesis is that LibGit2 does not support backslashes and as a result we may have created a broken git repository in your cache. There are two cache folders on your system and deleting them should resolve the issue: global cache: ~/Documents/.buckaroo/cache project local cache: $ProjectRoot/buckaroo

Let me know if that resolves your issue.

In the meantime I'll try to narrow down the issue and if required report the issue to the maintainers of LibGit2.

aahmed-se commented 5 years ago

deleted both and tried again

C:\Users\test\apache-pulsar-demo>buckaroo install
info Installing packages...
info No receipt found for buckaroo\github\buckaroo-pm\apache-pulsar; it will be installed.
info Installing buckaroo\github\buckaroo-pm\apache-pulsar...
[git] info Shallow cloning https://github.com/buckaroo-pm/apache-pulsar.git
Buckaroo.Bash+BashException: The command "git -C buckaroo\github\buckaroo-pm\apache-pulsar fetch origin +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*" exited with code 128
   at Buckaroo.Bash.runBashSync@66-4.Invoke(Unit _arg3) in C:\projects\buckaroo\buckaroo\Bash.fs:line 68
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
njlr commented 5 years ago

What happens if you do:

git clone --depth=1 https://github.com/buckaroo-pm/apache-pulsar.git
aahmed-se commented 5 years ago

looks fine

C:\Users\test\test>git clone --depth=1 https://github.com/buckaroo-pm/apache-pulsar.git
Cloning into 'apache-pulsar'...
remote: Enumerating objects: 4733, done.
remote: Counting objects: 100% (4733/4733), done.
remote: Compressing objects: 100% (3499/3499), done.
remote: Total 4733 (delta 1541), reused 2271 (delta 496), pack-reused 0Receiving objects: 100% (4733/4733), 9.09 MiB Receiving objects: 100% (4733/4733), 12.58 MiB | 20.61 MiB/s, done.

Resolving deltas: 100% (1541/1541), done.
Checking out files: 100% (3458/3458), done.

C:\Users\test\test>
nikhedonia commented 5 years ago

Sry for the late response. The command that failed was:

The command "git -C buckaroo\github\buckaroo-pm\apache-pulsar fetch origin +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*" exited with code 128```

Unfortunately the error-message didn't make it to the console. Only way we could know more is if @aahmed-se would run this command in powershell.

We should print the reason of failure for fatal errors and maybe pipe all errors to an error.log. So far I was not able to reproduce this error

aahmed-se commented 5 years ago

PS C:\Users\test\apache-pulsar-demo> buckaroo install 2>$1 > buckaroo.log

here are the contents of the file

info Installing packages...
info No receipt found for buckaroo\github\buckaroo-pm\apache-pulsar; it will be installed. 
info Installing buckaroo\github\buckaroo-pm\apache-pulsar... 
Buckaroo.Bash+BashException: The command "git -C buckaroo\github\buckaroo-pm\apache-pulsar fetch origin +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*" exited with code 128
   at Buckaroo.Bash.runBashSync@66-4.Invoke(Unit _arg3) in C:\projects\buckaroo\buckaroo\Bash.fs:line 68
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
nikhedonia commented 5 years ago

Thanks for the quick response but I meant running the command in bold:

git -C buckaroo\github\buckaroo-pm\apache-pulsar fetch origin +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*

sry for beeing unclear.

aahmed-se commented 5 years ago

this is the only error I get

fatal: bad config line 7 in file .git/config
aahmed-se commented 5 years ago
git version
git version 2.21.0.windows.1
nikhedonia commented 5 years ago

I bet if you open it you'll see backslashes on line 7. This is a git folder generated by LibGit2 (when using the old Buckaroo 2.0.0). It should work if you delete the buckaroo folder inside your project folder.

aahmed-se commented 5 years ago

that solves it