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

Support for special symbols in path: ' &!~`@#$^(+)_=%-;[.]{,} #7

Closed
3F opened this issue Nov 24, 2018 · 1 comment
Closed

Support for special symbols in path: ' &!~`@#$^(+)_=%-;[.]{,} #7

3F opened this issue Nov 24, 2018 · 1 comment
Milestone

Comments

@3F
Copy link
Owner

3F commented Nov 24, 2018

So... it continues 3F/DllExport#88 (comment)

The following possible chars in paths ' &!~`@#$^(+)_=%-;[.]{,} may cause some problems for use in third party components, however this is still possible to escape all of this. See this changes: 3F/DllExport@d4b46cd

But looks like not for ;

Initially GetNuTool (2015) uses same compilation of list of packages for different types:

  1. packages.config file that was designed for compatibility with original NuGet clients. (today's nuget have priorities for PackageReference only). But anyway, I personally used mostly command-line arguments instead of this. So I'm not sure about the future of this file also for current project. But this is other story.
  2. Env and msbuild properties via something like set ngpackages=... or /p:ngpackages="..." ...

Both of this encodes same syntax like:

  • id[/version][:output]|id2[/version][:output]|...
  • id[/version][:output];id2[/version][:output];... (; introduced in 1.6 because | requires escaping in some places for batch scripts)

But while | requires escaping in command-line usage, the truth is that this never be allowed in path in windows.

Okay, what we have today:

  • id/1.6.0:output;id2;id3:output
  • id/1.6.0:output|id2|id3:output

Where output may contain absolute path like id/1.6.0:D:\dir\name\;... (it's also ok for latest versions).

Thus, for current stage we need to support only ; without changing syntax as possible for both cases above.

The possible way

💡 Escaping ; -> ;;.

  • This is not so good option when this is used through variables, e.g.:
    • id/1.6.0:out;;put;id2;id3:%dir:;=;;%

💡 Leave only |.

  • It may require escaping like ^| as I said above. And for some usage it may also require escape ^ too, e.g.:
    • id/1.6.0:output^|id2^|id3:withcaret^^|
    • id/1.6.0:output^^|id2^^|id3:withcaret^^^^|

💡 Empty delimiter ;. This is vice versa logic to first variant. When is empty data ;; like nothing to be parsed:

  • id/1.6.0:out;put;;id2;id3:%dir%;; a single ; after id2 because it should be only when ':' is presented.
  • Too hard in implementing because of possible double semicolon in path, like "my;;name"

💡 Ignore ; only when | is found from ::

  • id/1.6.0:output;id2;id3:%dir%
  • id/1.6.0:out;put|id2;id3:%dir%|
  • id/1.6.0:out;put^|id2;id3:%dir%^| ....

💡 All above.

Need to think.

feedback

Anyone who also uses this directly as a tool (i.e. not as dependencies from 3rd projects), please leave here your comment.

3F added a commit that referenced this issue Dec 8, 2018
…,}`. Issue #7

* gnt.bat now uses safe logic for work with special symbols from `-msbuild` key.
* And main logic just ignores `;` only when `|` is found.
* Also fixes .packer for new logic with "|" and just adds .compressor from DllExport project.
@3F
Copy link
Owner Author

3F commented Dec 8, 2018

Okay, I fully reviewed processing with special symbols like ' &!~`@#$^(+)_=%-; o_o also for GetNuTool

So... now it should be ok even without hacks like it was in DllExport manager, e.g.:

    REM :: gnt's requirements (1.6.2 and less)
    REM set "_gntC=!_gntC:&=%%E_CARET%%&!"

But what about ;:

Finally, I implemented item4 from the possible ways, that means usage as an delimiter only when the | is not found.

The way for escaping ; -> ;; is fully compatible with this, but I don't want to add about ~+0.5Kb of duplicated logic, because of |. That is, just think about | like about escape character for ;

@3F 3F closed this as completed Dec 8, 2018
@3F 3F added this to the v1.7 milestone Dec 15, 2018
3F added a commit that referenced this issue Dec 22, 2018
* NEW:  New logic to specify multiple packages and config files via delimiters.
        Now main core just ignores `;` when `|` is found.
        #7 (comment)

        Read the documentation.

* FIXED: Fixed problems with special symbols in path. Issue #7
        ```
         ' &!~`@#$^(+)_=%-;[.]{,}
        ```

* CHANGED: Batch version now uses safe logic for work with special symbols from `-msbuild` key.
* CHANGED: Fully updated compression for generating more lightweight distribution.
           Useful for projects like DllExport, hMSBuild, and so on.

           New way for argument passing into the main core.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant