MantisBT - CMake
View Issue Details
0014466CMakeCPackpublic2013-10-09 05:422014-03-05 09:58
Ådne Hovda 
Nils Gladitz 
normalfeaturealways
closedfixed 
CMake 2.8.11.2 
CMake 3.0 
0014466: Deterministic file/directory IDs
Automatically generated IDs for <File />, <Directory /> and
<Component /> tags, DIR_ID_1, FILE_ID_1, COMP_ID_1, are
non-deterministic and that makes it impossible to reference those
objects by ID from other parts of the WiX code, to execute an
installed binary, add service config and firewall exceptions, for
example.

So, instead compose the ID by concatenating the relative path from
INSTALL_ROOT and the file name, using some valid delimiter, a
combination which should always be unique within one installer.

A file and its component should simply share ID.

Example output:



directories.wxs:

<Directory Id="INSTALL_ROOT" Name="MyProduct">
  <Directory Id="bin" Name="bin"/>
  <Directory Id="include" Name="include"/>
  <Directory Id="lib" Name="lib"/>
  <Directory Id="share" Name="share">
    <Directory Id="share.man" Name="man">
      <Directory Id="share.man.man3" Name="man3"/>
    </Directory>
  </Directory>
</Directory>




files.wxs:

<DirectoryRef Id="bin">
  <Component Id="bin.prog1.exe" Guid="*" Win64="$(var.Win64)">
    <File Id="bin.prog1.exe" Source="c:/.../bin/prog1.exe" KeyPath="yes"/>
  </Component>
</DirectoryRef>
<DirectoryRef Id="include">
  <Component Id="include.lib1.h" Guid="*" Win64="$(var.Win64)">
    <File Id="include.lib1.h" Source="c:/.../include/lib1.h" KeyPath="yes"/>
  </Component>
</DirectoryRef>
<DirectoryRef Id="lib">
  <Component Id="lib.lib1.lib" Guid="*" Win64="$(var.Win64)">
    <File Id="lib.lib1.lib" Source="c:/.../lib/lib1.lib" KeyPath="yes"/>
  </Component>
</DirectoryRef>
<DirectoryRef Id="share.man.man3">
  <Component Id="share.man.man3.prog.3" Guid="*" Win64="$(var.Win64)">
    <File Id="share.man.man3.prog.3" Source="c:/.../share/man/man3/prog.3" KeyPath="yes"/>
  </Component>
</DirectoryRef>
WiX
Issue History
2013-10-09 05:42Ådne HovdaNew Issue
2013-10-09 05:47Ådne HovdaTag Attached: WiX
2013-10-09 05:51Ådne HovdaNote Added: 0034083
2013-10-10 03:08Nils GladitzAssigned To => Nils Gladitz
2013-10-10 03:08Nils GladitzStatusnew => assigned
2013-10-10 03:09Nils GladitzNote Added: 0034088
2013-10-10 08:46Ådne HovdaNote Added: 0034094
2013-10-15 13:37Nils GladitzNote Added: 0034126
2013-10-15 13:37Nils GladitzStatusassigned => resolved
2013-10-15 13:37Nils GladitzFixed in Version => CMake 3.0
2013-10-15 13:37Nils GladitzResolutionopen => fixed
2013-10-16 09:02Robert MaynardFixed in Version => CMake 3.0
2014-03-05 09:58Robert MaynardNote Added: 0035284
2014-03-05 09:58Robert MaynardStatusresolved => closed

Notes
(0034083)
Ådne Hovda   
2013-10-09 05:51   
The Win64="$(var.Win64)" attribute is an optional abstraction and dependent on the included variables I suggested at http://www.cmake.org/Bug/view.php?id=14467 [^] (although it's a good idea). Sorry for the confusion.
(0034088)
Nils Gladitz   
2013-10-10 03:09   
The msi schema has a 72 character limit for the identifiers while file names can go up to 255 characters which makes concatenation of path components (or even just including the file name) for the identifier difficult.
Also when non latin letters are prominently used I would have to substitute them with place holders which could make this scheme very ambiguous.

I am pondering a (shortened) SHA1 hash of the path (incl. file name) + shortened file name (+ optional ambiguity counter?) ... so e.g.:
a1b2c3d_prog1.exe
d1b2c3a_verylongfilenamethathadtobeshortened_cropped

Maybe I could alternate between both schemes depending on path lengths and the use of non latin letters.
(0034094)
Ådne Hovda   
2013-10-10 08:46   
I'm guessing that most setups will not run into those issues and if they do, replacing the last possible part of the ID with a hash of some sort, while stripping non-ASCII characters seems like a decent fallback. Most files and directories that you are likely to reference from other WiX code are going to fit in the standard scheme. Note, this is just my assumption.
(0034126)
Nils Gladitz   
2013-10-15 13:37   
Fixed by http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a4a74828ce83a6233107b14ab219c98a4ef5eab [^]
(0035284)
Robert Maynard   
2014-03-05 09:58   
Closing resolved issues that have not been updated in more than 4 months