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

Nuspec files with forward slash creates nested layer of directories when packed on Windows #2166

Closed
TheCakeIsNaOH opened this issue Dec 21, 2020 · 1 comment

Comments

@TheCakeIsNaOH
Copy link
Member

What You Are Seeing?

When running choco pack on windows, if a file element in the .nuspec has a forward slash instead of a backslash, then nested directories will be created in the .nupkg.

An example of this issue is visable with adobereader 2020.006.20034, where the chocolateyinstall.ps1 file is not in tools but in tools\tools.

The resulting package still does still "work", however, it is non-ideal behavior, and I can see edge cases where this could become problematic.

What is Expected?

That nested directories are not created.

How Did You Get This To Happen? (Steps to Reproduce)

  1. Get the package source for a package with a directory (like tools) in the .nuspec files element. Example: 4k-slideshow-maker
  2. Change the backslash of the src to a forward slash. From <file src="tools\**" target="tools" /> to <file src="tools/**" target="tools" />
  3. Pack it with choco pack on a Windows machine.
  4. Inspect the resulting .nupkg
@TheCakeIsNaOH
Copy link
Member Author

This was fixed in the template by commit e5a02a0

But it can be fixed in all cases by chocolatey/nuget-chocolatey#19

@gep13 gep13 added this to the 0.10.16 milestone May 4, 2021
@gep13 gep13 added 4 - Done and removed 2 - Working labels May 4, 2021
@gep13 gep13 closed this as completed May 4, 2021
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue May 7, 2021
When using a relative path, pack only works if the current directory is
the same as the directory containing the nuspec. This switches the
relative path to an absolute path for non-windows platforms (windows
already uses an absolute path). This change allows pack to work from
any directory.

Previously, in c0b23a6 and e5a02a0, non-windows platforms were switched
to using a relative path for files, so that the default files separator
in the nuspec files element could be switched to a backslash (chocolatey#2166)
However, the issue with forward/back slashes is fixed by
nuget-chocolatey#19, so the previous changes can now be reverted.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue May 7, 2021
When using a relative path, pack only works if the current directory is
the same as the directory containing the nuspec. This switches the
relative path to an absolute path for non-windows platforms (windows
already uses an absolute path). This change allows pack to work from
any directory.

Previously, in c0b23a6 and e5a02a0, non-windows platforms were switched
to using a relative path for files, so that the default files separator
in the nuspec files element could be switched to a backslash (chocolatey#2166)
However, the issue with forward/back slashes is fixed by
chocolatey/nuget-chocolatey#19, so the previous change can now be
reverted.
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue May 10, 2021
When using a relative path, pack only works if the current directory is
the same as the directory containing the nuspec. This switches the
relative path to an absolute path for non-windows platforms (windows
already uses an absolute path). This change allows pack to work from
any directory.

Previously, in c0b23a6 and e5a02a0, non-windows platforms were switched
to using a relative path for files, so that the default files separator
in the nuspec files element could be switched to a backslash (chocolatey#2166)
However, the issue with forward/back slashes is fixed by
chocolatey/nuget-chocolatey#19, so the previous change can now be
reverted.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Jul 12, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Jul 12, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Jul 13, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Jul 27, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Jul 29, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Aug 1, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Nov 8, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Nov 8, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
TheCakeIsNaOH added a commit to TheCakeIsNaOH/NuGet.Client that referenced this issue Nov 10, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
AdmiringWorm pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 15, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
AdmiringWorm pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 15, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 16, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 16, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 17, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 17, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 17, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 21, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
AdmiringWorm pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 21, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
AdmiringWorm pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 21, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 21, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 21, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
gep13 pushed a commit to chocolatey/NuGet.Client that referenced this issue Nov 21, 2022
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants