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

Crash on 'simplify' #394

Closed
haf opened this issue Nov 26, 2014 · 16 comments
Closed

Crash on 'simplify' #394

haf opened this issue Nov 26, 2014 · 16 comments

Comments

@haf
Copy link
Member

haf commented Nov 26, 2014

mono tools/paket.exe simplify --verbose
Paket version 0.16.2.0
found: /Users/henrik.feldt/dev/haf/EventStore.Client.FSharp/paket.dependencies
Parsing /Users/henrik.feldt/dev/haf/EventStore.Client.FSharp/paket.dependencies
Paket failed with:
   The given key was not present in the dictionary.
StackTrace:
    at Microsoft.FSharp.Collections.MapTreeModule.find[NormalizedPackageName,FSharpSet`1] (IComparer`1 comparer, Paket.NormalizedPackageName k, Microsoft.FSharp.Collections.MapTree`2 m) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.FSharpMap`2[Paket.Domain+NormalizedPackageName,Microsoft.FSharp.Collections.FSharpSet`1[Paket.Domain+PackageName]].get_Item (Paket.NormalizedPackageName key) [0x00000] in <filename unknown>:0
  at [email protected] (Microsoft.FSharp.Collections.FSharpSet`1 set, Paket.PackageName directDep) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.ListModule.loop@151-20[PackageName,FSharpSet`1] (Microsoft.FSharp.Core.FSharpFunc`3 f, Microsoft.FSharp.Collections.FSharpSet`1 s, Microsoft.FSharp.Collections.FSharpList`1 xs) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.ListModule.Fold[PackageName,FSharpSet`1] (Microsoft.FSharp.Core.FSharpFunc`2 folder, Microsoft.FSharp.Collections.FSharpSet`1 state, Microsoft.FSharp.Collections.FSharpList`1 list) [0x00000] in <filename unknown>:0
  at Paket.Simplifier+getSimplifiedDeps@40-1[Paket.Requirements+PackageRequirement].Invoke (Microsoft.FSharp.Collections.FSharpList`1 allDeps) [0x00000] in <filename unknown>:0
  at Paket.Simplifier.Analyze (Microsoft.FSharp.Collections.FSharpList`1 allPackages, Paket.DependenciesFile depFile, Microsoft.FSharp.Collections.FSharpList`1 refFiles, Boolean interactive) [0x00000] in <filename unknown>:0
  at Paket.Simplifier.Simplify (System.String dependenciesFileName, Boolean interactive) [0x00000] in <filename unknown>:0
  at Paket.Dependencies.Simplify (Boolean interactive) [0x00000] in <filename unknown>:0
  at [email protected] (Microsoft.FSharp.Core.Unit unitVar) [0x00000] in <filename unknown>:0
  at <StartupCode$paket>.$Paket.Program.main@ () [0x00000] in <filename unknown>:0

When having

nuget NuGet.CommandLine

in paket.dependencies. Also, that nuget is never downloaded when running paket.exe restore.

@theimowski
Copy link
Member

Could be related to #359. I'll have a look

@theimowski
Copy link
Member

cannot reproduce:

tomasz.heimowski@THEIMOWSKI-W7 /d/SkyDrive/Dev/sandbox/PakeT (master)
$ ls -al
total 7
drwxr-xr-x    4 tomasz.h Administ     4096 Nov 27 09:00 .
drwxr-xr-x    9 tomasz.h Administ     4096 Nov 27 08:55 ..
drwxr-xr-x   13 tomasz.h Administ     4096 Nov 27 09:02 .git
-rw-r--r--    1 tomasz.h Administ       56 Nov 27 08:56 paket.dependencies

tomasz.heimowski@THEIMOWSKI-W7 /d/SkyDrive/Dev/sandbox/PakeT (master)
$ cat paket.dependencies
source https://nuget.org/api/v2

nuget NuGet.CommandLine
tomasz.heimowski@THEIMOWSKI-W7 /d/SkyDrive/Dev/sandbox/PakeT (master)
$ paket install
Paket version 0.16.2.0
found: d:\SkyDrive\Dev\sandbox\PakeT\paket.dependencies
Resolving packages:
  - fetching versions for NuGet.CommandLine
    - exploring NuGet.CommandLine 2.8.3
Locked version resolutions written to d:\SkyDrive\Dev\sandbox\PakeT\paket.lock
NuGet.CommandLine 2.8.3 unzipped to d:\SkyDrive\Dev\sandbox\PakeT\packages\NuGet.CommandLine
3 seconds - ready.

tomasz.heimowski@THEIMOWSKI-W7 /d/SkyDrive/Dev/sandbox/PakeT (master)
$ paket simplify
Paket version 0.16.2.0
found: d:\SkyDrive\Dev\sandbox\PakeT\paket.dependencies

d:\SkyDrive\Dev\sandbox\PakeT\paket.dependencies is already simplified
0 seconds - ready.

@haf
Copy link
Member Author

haf commented Nov 27, 2014

I think my description of the problem was not complete. It seems from the stack trace that Paket tries to look up indirect dependencies; and indeed this is something which wouldn't yield any results, as non of the projects in the src directory have dependencies on any nugets at this point.

So if you also a project which is paket enabled through convert-from-nuget, but which doesn't depend on any packages, you might trigger the same path?

@theimowski
Copy link
Member

Flow in simplify looks like this:

  • parse lock file to create a map of all packages and their dependencies
  • iterate through dependencies file and references files and calculate which indirect dependencies could be potentially removed

So as long as there are no dependencies for a project, simplify shouldn't affect that project.

Too bad the stacktrace you provided is not completed, ie I can't determine line numbers.
Could you share the project for repro?

@haf
Copy link
Member Author

haf commented Nov 27, 2014

I'll try

@haf
Copy link
Member Author

haf commented Nov 29, 2014

Here's a repro; I run:

 mono tools/paket.exe install
Paket version 0.16.3.0
found: /Users/henrik.feldt/dev/haf/NLog.RabbitMQ/paket.dependencies
0 seconds - ready.

@haf
Copy link
Member Author

haf commented Nov 29, 2014

@theimowski
Copy link
Member

Ok I can reproduce now.
It looks like the reason is that the lock file is out of date.
paket install doesn't recreate lock file, paket update does - if you run the latter, the NuGet.CommandLine will get restored correctly, and simplify will not crash.

@forki - should we generate warning when one tries to paket install, but dependencies file is out of sync with the lock file?

simplify should not crash in neither case, so I'll try to fix that issue

@haf
Copy link
Member Author

haf commented Nov 29, 2014

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I think people would expect that the new package is added to the lock file.

Update i would expect to update all packages. How otherwise would I add a package without affecting the others?

On November 29, 2014 1:54:02 PM CET, Tomasz Heimowski [email protected] wrote:

Ok I can reproduce now.
It looks like the reason is that the lock file is out of date.
paket install doesn't recreate lock file, paket update does -
if you run the latter, the NuGet.CommandLine will get restored
correctly, and simplify will not crash.

@forki - should we generate warning when one tries to paket install, but dependencies file is out of sync with the lock file?

simplify should not crash in neither case, so I'll try to fix that
issue


Reply to this email directly or view it on GitHub:
#394 (comment)


Sent from my Android device with K-9 Mail. Please excuse my brevity.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQI+BAEBCgAoBQJUecO/IRxIZW5yaWsgRmVsZHQgPGhlbnJpa0Bsb2dpYml0LnNl
PgAKCRB9FjoG5k92RaKzD/4nmSFMhsHFBA9ppRmotr3GYZIc7eJBrwbPkL/eKBHe
MPJFgcLAmes9lMCwz7hpet4ovbZajPAZdFHKH2iixp2LwCU++/vrJ8JrGlIvDwgK
5MASm1hdAKNy728QIeLe0P436t8iQu1QCmt8GtOw8DdMGkf+KwzM0V2VBmCC86sD
YHGwnPd638oI5tTXeR0bxN8t2i9KX0Mlpv8UpvVTiurw5/hPffXtrYFKB/IELmRF
gch1T2zehBiJLFhu5gjm9RQ5iAG5JYINKZkowtLvBAc56ng8BHejrRYROzjNtN7a
+GdJIIMssONK6lhSnwCnTNguIpf443VsFV7pFWvnvlcLtcrDR2925Z7DYZqUl6B3
wOj9jcKZsEWIAHeJBboSKeYjgyd5nzfEPY0aqXPbcFmaOwVSRtHufs+Z3orjP18d
9c+x97L2chEaBmpPteQPac0xEF3CSenQhGdhF/TdQAmoRERpAKV7/w4yQb6QWuZt
dwPjrc1+godzCOHay52iAyzseRUDRvEAU5B5Ha0fCl9urLscaYMAf7HSiQFFHAvO
PCxIJ0rO78s+wX6hq6dLmefDKFxndYGmFX9fgsrpijlb1dBNHtLGsFxBZF9kZ+gW
FO6I4s6t1g04ue8e4LXENM3Wc/BiwgHpgQLdulRJ0TGn9MA7xrFwzlH8TbB/rIem
wg==
=CsHf
-----END PGP SIGNATURE-----

@theimowski
Copy link
Member

You can update single package - this should not affect other packages

@theimowski
Copy link
Member

I sent a PR for the simplify command - it will still crash in above case, but at least there should be a clear error message

@haf
Copy link
Member Author

haf commented Nov 29, 2014

But then how do I update a single package so that it does affect other packages? E.g.:

  • A (1.2.3)
  • B (4.5.6)
  • C (7.8.9)

(->): depends on
A -> C
B -> C

paket update A is in my world:

  1. See if new versions of A exist, A'
  2. See if C needs updating to match A''s new versions
  3. If C needs updating because of A', update it, version-levelled against what B depends on.
  4. Don't change B

On (3) if B can't have the new version of C, update A to the highest possible version where B's dependencies can be met with semver and version levelling, otherwise give error message.

paket install is in my world: ensure paket.dependencies is in effect and update paket.lock if needed; see how 'bundler' does it, and consider that paket.lock, especially if you add support for different runtims/frameworks, will need to support locking down a package to the particular runtime that 'paket' was run on, meaning another call to 'paket install' will cause an addition to paket.lock.

@haf
Copy link
Member Author

haf commented Nov 29, 2014

Deleted last comment.

@haf
Copy link
Member Author

haf commented Nov 29, 2014

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Thank you very much. =)

On November 29, 2014 2:33:59 PM CET, Tomasz Heimowski [email protected] wrote:

I sent a PR for the simplify command - it will still crash, but at
least there should be a clear error message


Reply to this email directly or view it on GitHub:
#394 (comment)


Sent from my Android device with K-9 Mail. Please excuse my brevity.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQI+BAEBCgAoBQJUedCbIRxIZW5yaWsgRmVsZHQgPGhlbnJpa0Bsb2dpYml0LnNl
PgAKCRB9FjoG5k92RUqoD/4qxf5yrx4NzcS/KC7TnQlIehsCGsLNHBN7Rb8Wi219
jVWGMTLlV+e4ZOsv6u3JYxYEVIAFNU4C5cv4zdrALtZS5cVcApBt8jolEimMD76J
ORXfSicCQUSoWd30wgAc4tu+YOcZlmRrHZptqM7cyjrwga0WVnucxu3Krs1eRupw
MnZg4vEjLkBb7/ZDh5ijRP3hDuynFusK9frSHFU+f0nhdZkaA56tm4T7pHxF2Fan
p2DSdS9Ad3EUb+SF/ESPgI8BdqSYbQziznW+KrRGccr539neK0q9Si+q4lAx39Gy
nbT4rkTXNzHMzbT5NpSAe5B04LiQl73CcmqRh3DhRTJPFP+Bfg61KCfwaVWO6ECN
3KSZdFCTWJSjqAAWA63obl79//ZoD3HcwI0yE9XjnxfuyZcMfBYsfxsnjo2JC4ni
/OcpJCxmuVum4oEztfDvAxe2ifkEm0/qVqOV/mFCwm0DvPUbEl6j+s8dIO9nIzaC
Kyy15p3zYTxAHZg4O3kNCW20XSW4JwqtQP+nQcxgFkqrswopefqdNdmmtQt1ZyvS
Nlb/QTuXCea9tUpBsOmJQcyizQOLvsj6ePZjVJmgeY8fgTvxzutawGrC1ZxNcNJk
ll7ofV9Dh1yvxQPPNvgpHp2X9kat2Iw45c9JAHmq8ktHZtYQjQvkXuq3LqoxS1Lf
uA==
=PQbn
-----END PGP SIGNATURE-----

@theimowski
Copy link
Member

AFAIK such scenario is not supported (fully automated), however you could use the update command for single packaged in conjunction with outdated command.

Re paket install I think it's by design that it does not modify the lock file. @forki please correct me if I'm wrong here

@forki
Copy link
Member

forki commented Nov 29, 2014

Yes. We opted against this bundler behavior. I think @agross always wanted
to let it behave like bundler. I had some concerns.
On Nov 29, 2014 3:03 PM, "Tomasz Heimowski" [email protected]
wrote:

AFAIK such scenario is not supported (fully automated), however you could
use the update command for single packaged in conjunction with outdated
command.

Re paket install I think it's by design that it does not modify the lock
file. @forki https://github.com/forki please correct me if I'm wrong
here


Reply to this email directly or view it on GitHub
#394 (comment).

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

3 participants