-
Notifications
You must be signed in to change notification settings - Fork 907
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
Ensure Install-ChocolateyInstallPackage
does not add a trailing space to silent arguments
#2345
Comments
@majkinetor I am not sure if I follow the problem that you are seeing here. Can you please go back and update this issue using the issue template for reporting a bug? This includes a steps to reproduce section, which will help in understanding the problem that you are seeing. Thanks |
[moved] |
1 similar comment
[moved] |
@majkinetor thank you for the additional information, that helps to understand the problem. Are you able to update the original issue with all that information so that it is in one place? Thanks |
Sure. Should I PR this change, since its obviously buggy for some class of tools ? |
Yip, happy to accept a PR which addresses this problem. If we can put some tests around this as well, that would be great, but I don't think that would be possible. |
Would testing the change by patching my local system be good enough ? I would change the Changed the initial description. |
In terms of "developer" testing, what you have suggested would be great, yes. What I was thinking about is how to introduce automated tests, to ensure that this isn't regressed in future releases. We don't have any infrastructure in this repository to add those style of tests, but we do have some internally, so we may have to look to getting a test(s) added there to cover this bug. |
In the meantime, since package is highly used, should I trick the validator or can you (or somebody else) "promote" the TC package ? |
It is possible to provide an exemption (at the package version level) from package-validation, so if you reply to the moderation thread with a request for exemption, pointing at this issue, one of the moderators should be able to pick it up. |
I will do that. Thanks. |
Actually, I can't do that, since its chocolatey-community user behind the scenes. |
I've added an exemption for the current version ( |
@majkinetor did you ever create a PR of your proposed changes to choco/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1? |
@gobalius, No. |
@majkinetor would you consider creating the PR? I think it's a low risk (unaffected packages will still work) and high gain (packages like totalcommander will not need the workaround and will pass the automatic check) situation. |
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
Fix a bug where concatenating silentArgs and additionalInstallArgs adds a trailing space at the end of silentArgs even when additionalInstallArgs is empty. Such trailing space can change the meaning of the last positional argument (that may contain spaces). Final arguments are now created as space joined string arrays filtered down to only non-empty items. Fix is applied to all installer types. Fixes: chocolatey#2345
Hi, I am interested in fixing this (already raised a PR which I believe addresses the issue) as it blocks me from using Chocolatey internally with our installers (that behave similarly to Total Commander). I looked at previous two PRs and they seem inactive and I feel that solution one of them proposes (simply merging arguments without space in between) would break some other installers while my solution (not adding any spaces before empty strings) should work in those cases (same as draft above). |
@gep13 I'm sorry to tag, not really sure what is process here to get the PR reviewed and eventually merged. |
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
@majkinetor I am sorry to tag, but is there anything I can do to have this PR reviewed and eventually merged? Is it just there's not enough reviewer bandwidth or is anything else missing on my side? |
@blami , sorry, I am just a regular guy, not a choco employee. I don't think the outcome deserves the effort that is requested here. |
@gep13 is there anything from my side I can do to have this fix merged? |
@blami We'll review the PR when we're ready to pull it in. The issue ha snot been assigned to a milestone as yet so it's not something we are currently working on. |
@pauby Thanks for clarification, since there were earlier replies from assignee, particularly this one:
I thought this issue is already on radar. I understand the situation now and will wait until this makes it to some milestone. |
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
This prevents the addition of a trailing space after silent arguments in Install-ChocolateyInstallPackage when there are no additional arguments.
Fix a bug where concatenating silentArgs and additionalInstallArgs adds a trailing space at the end of silentArgs even when additionalInstallArgs is empty. Such trailing space can change the meaning of the last positional argument (that may contain spaces). Final arguments are now created as space joined string arrays filtered down to only non-empty items. Fix is applied to all installer types. Fixes: chocolatey#2345
This adds a set of tests to validate that the spaces that may be passed in by the package are honoured, while not introducing erroneous spaces.
This adds a set of tests to validate that the spaces that may be passed in by the package are honoured, while not introducing erroneous spaces.
This adds a set of tests to validate that the spaces that may be passed in by the package are honoured, while not introducing erroneous spaces.
Fix a bug where concatenating silentArgs and additionalInstallArgs adds a trailing space at the end of silentArgs even when additionalInstallArgs is empty. Such trailing space can change the meaning of the last positional argument (that may contain spaces). Final arguments are now created as space joined string arrays filtered down to only non-empty items. Fix is applied to all installer types. It is expected not to manipulate the arguments themselves in case there are any spaces that the package maintainer has included.
This adds a set of tests to validate that the spaces that may be passed in by the package are honoured, while not introducing erroneous spaces.
Fix a bug where concatenating silentArgs and additionalInstallArgs adds a trailing space at the end of silentArgs even when additionalInstallArgs is empty. Such trailing space can change the meaning of the last positional argument (that may contain spaces). Final arguments are now created as space joined string arrays filtered down to only non-empty items. Fix is applied to all installer types. It is expected not to manipulate the arguments themselves in case there are any spaces that the package maintainer has included.
This adds a set of tests to validate that the spaces that may be passed in by the package are honoured, while not introducing erroneous spaces.
Fix a bug where concatenating silentArgs and additionalInstallArgs adds a trailing space at the end of silentArgs even when additionalInstallArgs is empty. Such trailing space can change the meaning of the last positional argument (that may contain spaces). Final arguments are now created as space joined string arrays filtered down to only non-empty items. Fix is applied to all installer types. It is expected not to manipulate the arguments themselves in case there are any spaces that the package maintainer has included.
This adds a set of tests to validate that the spaces that may be passed in by the package are honoured, while not introducing erroneous spaces.
(#2345) Avoid any trailing spaces after silentArgs
Install-ChocolateyInstallPackage
does not add a trailing space to silent arguments
🎉 This issue has been resolved in version 2.3.0 🎉 The release is available on: Your GitReleaseManager bot 📦 🚀 |
In powershell function
Install-ChocolateyInstallPackage
trailing space is added to silentArgs:choco/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1
Line 359 in f68a242
The problematic part is
statement
parameter of functionStart-ChocolateyProcessAsAdmin
which gets into it as"$silentArgs $additionalInstallArgs"
.With Total Commander for example, passing silentArgs as
'/AHDU c:\totalcmd'
gets executed as'/AHDU c:\totalcmd '
(notice the trailing space). Then TC tries to create folder'c:\totalcmd '
with space at the end and it fails.To prove it is the problem and after looking into source code I used workaround solution for that package:
With that code package installation works which proves that statement parameter handling is problematic and can not be set in this case. This solution is however flagged by gallery validator.
To fix it, something like this will work:
The text was updated successfully, but these errors were encountered: