wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 36 forks source link

HeatFile task not adding quotes for command line #2216

Closed wixbot closed 8 years ago

wixbot commented 15 years ago

The HeatFile tasks forgets to add double quotes around the File and Templates variables/arguments:

\src\WixTasks\heatfile.cs

protected override string GenerateResponseFileCommands() { WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();

        commandLineBuilder.AppendSwitch(this.OperationName);

--> commandLineBuilder.AppendSwitch(this.File);

        commandLineBuilder.AppendSwitchIfNotNull("-cg ", this.componentGroupName);
        commandLineBuilder.AppendSwitchIfNotNull("-dr ", this.directoryRefId);
        commandLineBuilder.AppendIfTrue("-scom", this.SuppressCom);
        commandLineBuilder.AppendIfTrue("-srd", this.suppressRootDirectory);
        commandLineBuilder.AppendIfTrue("-sreg", this.SuppressRegistry);

--> commandLineBuilder.AppendSwitchIfNotNull("-template:", this.Template); ...

Originally opened by mberchtold from http://sourceforge.net/p/wix/bugs/1718/

wixbot commented 12 years ago

I mixed -template up with -t (I assumed it was the short form). What I actually meant is that the -t for the xsl transformation should support quotes. I hope this clarifies my confusion with the -template switch.

wixbot commented 12 years ago

Thank you for replying. But this workaround is probably breaking things again (double double quotes if the function does not check for existing quotes) once the fix will be included. Regarding your other question: I recommend to always add double quotes around unquoted strings containing spaces regardless of the "switch". This way it will globally fix the problems with spaces in switches.

wixbot commented 12 years ago

This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).

wixbot commented 12 years ago

Yes, it is possible if we don't do something to deprecate this call suggestion (i.e. check to see if the value already contains quotes). However, the fix for this will not be out for quite awhile. I also feel that when it is fixed, we will check for quotes. Especially when we look back at this bug and these comments.

The -template switch does not allow for spaces. Its use is "-template:fragment" with no space. Also, the value cannot contain spaces either. So no "-template:My Custom".

switch (truncatedCommandSwitch.Substring(9)) { case "fragment": ...

wixbot commented 12 years ago

Unfortunately, this bug doesn't meet the v3.0 bar at this point. Moving to WiX v3.5. In the meantime, short path names should work (even if they are ugly).

wixbot commented 12 years ago

Does the commandLineBuilder.AppendSwitch functions handle this correctly?

wixbot commented 12 years ago

There is a workaround for this in order to get you up and running. Add XML escaped quotes (") on both sides of your file path. This worked in my testing.

<HeatFile
  File="&quot;..\2803656\Test This\Test This\test.txt&quot;"
wixbot commented 12 years ago

Can you help me understand why you need to have the template switch place quotes around the value?