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

Inconsistent space handling during packaging and unpackaging of nuget packages. #1837

Closed
imyrke opened this Issue Jul 28, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@imyrke

imyrke commented Jul 28, 2016

Description

We have a nuget package where there are lots of spaces in file and folder names. We experience two different levels of inconsistency related to this repository:

  1. The replacement of space with %20 is not consistent, leading the content of folders being split in the generated package. In itself this is cosmetical, at least when using paket to also install it, since the reversion of spaces will put them together again in an unpacked folder.
  2. However, the restoring is also not consistent. This sometimes lead to a situation where a folder created to hold a file get one name while the folder it just afterwards tries to put the file get another name, causing a "Directory not found" exception. Tracking down this situation has been rather awkward! It seems to be related to space not always being replaced with %20, but with something more complex.

Repro steps

Due to the inconsitency (and apparent arbitrariness) it might take some effort to reproduce.

You need
a. A project with files and folders with spaces in the names. Use paket to generate a nuget package of this project.
b. A project that depends on this package (in its paket.dependencies).

Build project b).

Expected behavior

On building project b) the package from a) is fetched and unpacked.

Actual behavior

On building project b) the package from a) is fetched and unpacked. During unpacking there will be an exception indicating "Directory not found" or similar.

Known workarounds

Use nuget pack instead.

With nuget there is no space conversion at all, spaces go straight through and everything works.

Related information

  • Windows 10.
  • The description is based on version 3.1.9.
  • .NET Runtime 4.6

The exception gives a fair hint into failing code, which has enabled med to set breakpoints and watch variables. Is is all in method NugetV2.cleanup where I can follow the inconsistent and somewhat strange input and how Uri.UnescapeDatastring does not produce the expected result. The eventual exception comes from File.Move in the same method, but looking at variables during debugging might provide enough clues even if you are not able to make it actually crash.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Aug 2, 2016

Member

I'd need to have a repro sample.
Can you please upload a zip with everything in place?

Member

forki commented Aug 2, 2016

I'd need to have a repro sample.
Can you please upload a zip with everything in place?

@forki forki added the needs-repro label Aug 2, 2016

@imyrke

This comment has been minimized.

Show comment
Hide comment
@imyrke

imyrke Aug 2, 2016

CKM.zip

Includes paket.template and the fallback nuspec.

imyrke commented Aug 2, 2016

CKM.zip

Includes paket.template and the fallback nuspec.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Aug 2, 2016

Member

ok extracted the zip. what do I have to do exactly to see the error?

Member

forki commented Aug 2, 2016

ok extracted the zip. what do I have to do exactly to see the error?

@imyrke

This comment has been minimized.

Show comment
Hide comment
@imyrke

imyrke Sep 8, 2016

Use the attached template and create nuget package using paket. Then use paket to extract the same package.
paket.template.txt

imyrke commented Sep 8, 2016

Use the attached template and create nuget package using paket. Then use paket to extract the same package.
paket.template.txt

@imyrke

This comment has been minimized.

Show comment
Hide comment
@imyrke

imyrke Sep 8, 2016

Looking at the content of the generated nupkg actually reveals one side of the problem. Spaces in file and folder names have all been replaced. The idea is to reverse this on unpacking and it is here it can go wrong since the space-replacing is inconsistent.

imyrke commented Sep 8, 2016

Looking at the content of the generated nupkg actually reveals one side of the problem. Spaces in file and folder names have all been replaced. The idea is to reverse this on unpacking and it is here it can go wrong since the space-replacing is inconsistent.

@forki forki closed this in cae2f84 Sep 14, 2016

@matthid matthid added the pack/unpack label Aug 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment