Menu

#13 xml2abc concats paths to create logfiles -- fails with absolut paths

Moritz_2_0_1
closed
None
3
2021-09-22
2020-12-18
No

Hi Eckard,

I found a bug by calling xml2abc with a full path to the sources instead a relative path.
It seems somewhere internally two paths are concatenated and used as target folder for logs created
In my case I have set MORITZ_ROOT to be in my A: drive (which is a Vera crypt drive) and I try to generate the nsd to my users %TEMP% folder wich is in C: drive.
I did the same with abc2xml but this seems not to get in trouble and generated the xml files in %TEMP%\moritz\xml.

The filename, directory name, or volume label syntax is incorrect.
faild to create directory :
A:\src\Moritz_work_copy\trunk\distribution\Moritz\Development\Moritz_Dev\C:\Users\nxf65130\AppData\Local\Temp\1\moritz\log\.\LangPack\ansi_c\_log\snpt\

So the path contains ...\C:... which is invalid

What I called is

%MORITZ_PATH%\bin\xml2abc UA:LogRoot=%MORITZ_LOG_PATH% UA:RootPath=%MORITZ_PATH% UA:DestPath=%TEMP% CF.\cfg\ansi_c_xml2abc_cfg_nsd.xml > %MORITZ_LOG_PATH%\log_xml2abc_nsd.log

where I added an additional variable called DestRoot pointing to the users %TEMP% folder and using it to refer to the xml folder containing the output of step 1 abc2xml)
The ansi_c_xml2abc_cfg_nsd.xml is this

<Configuration project=" ">
 <Path>
  <!-- location of the nsd-file output produced by xml2abc  -->
  <DestinationPath  value="[?(#Configuration/UserArgument/DestPath)!({value})]/moritz/nsd/" /> 
  <User> 
   <LangPackPath    value="[?(#Configuration/UserArgument/RootPath)!({value})]/" />
   <!-- location of the description-file output produced by xml2abc  -->
   <DescriptionPath value="[?(#Configuration/UserArgument/DestPath)!({value})]/moritz/des/" />  
  </User> 
 </Path>

 <Source>
  <!-- to use all _cpp.xml-files in the folder and its sub-folders -->
  <FolderName value="[?(#Configuration/UserArgument/DestPath)!({value})]/moritz/xml/" root="SourcePath" fileAttachment="_c.xml" recursive="No" doNotSkip="No"/>
 </Source>

 <!-- include the detailed generator-configuration for c/cpp located in the 
      root-folder known as root  
      reffer in documentation: 
                       Configuring the Generation-Process in the section Process   
       -->
 <GeneratorNSD includeFile="./LangPack/ansi_c/x2a_nsd/xml2abc_Process_ansi_c_nsd.xml" root="LangPackPath" />

</Configuration>

as workarround I copied the xml folder to the current directory and adapted the ...nsd.xml
xcopy %TEMP%\moritz\xml xml\ /E
<foldername value="./xml/" root="SourcePath" fileattachment="_c.xml" recursive="No" donotskip="No"></foldername>

Discussion

  • Eckard Klotz

    Eckard Klotz - 2020-12-19
    • status: open --> accepted
     
  • Eckard Klotz

    Eckard Klotz - 2020-12-19

    Hello Wasili.

    Thanks for your intensive testing. I'm real appreciated about all the effort you take.

    To solve this problem I have attached 2 new binaries for Windows 64 bit and the source-files you need to build them by your self for Windows 32 bit, Linux or Macintosh.

    • bin_Windows64bit.zip
    • src_abc2xml_xml2abc.zip

    But we have to modify your XML configuration also, since the definition of the source root-path should be done in the following XML tree node:

    • Configuration/Path/User/SourcePath

    In your case the path-definition in the xml2abc configuration looks like this:

     <Path>
    
      <!-- location of the nsd-file output produced by xml2abc  -->
      <DestinationPath  value="[?(#Configuration/UserArgument/ResultPath)!({value})]./nsd/" /> 
    
      <!-- Inside the sub-section User it is possible to define 
           more pathes with own tag-definitions -->
      <User> 
    
       <!-- location-root of the xml-sources to analyse -->
       <SourcePath      value="[?(#Configuration/UserArgument/ResultPath)!({value})]/" />
    
       <!-- location of detailed configuration-input like the grammar text-file
            MoritzPath has to be replaced by the root-folder of the Moritz distribution
             -->
       <LangPackPath    value="[?(#Configuration/UserArgument/RootPath)!({value})]/" />
    
       <!-- location of the description-file output produced by xml2abc  -->
       <DescriptionPath value="[?(#Configuration/UserArgument/ResultPath)!({value})]./des/" />  
      </User> 
     </Path>
    

    Different to you I have called the new user-argument not DestPath but ResultPath to avoid confusions since the source-path is configured with a destination-path.

    • In fact the destination of abc2xml is the source of xml2abc.
    • I think the term result will fit to both source as well as destination.

    As you know the detailed configuration of source-files and source folders contain the attribute root.

      <!-- to use all _cpp.xml-files in the folder and its sub-folders -->
      <FolderName value="./xml/"                  root="SourcePath" fileAttachment="_c.xml" recursive="No" doNotSkip="No"/>
      <!-- to use a specific xml-file  -->
      <FileName   value="mySource_cpp.xml"        root="SourcePath" doNotSkip="No"/>
    

    This attribute root defines the user-path, that should used as root for the specific files or folders.

    The console script for Windows defines and uses the paths this way:

    rem define the new home for additional log-outputs
    set LOG_ROOT=C:\Project\EDD\_SVN\SandBox\trunk\distribution\Moritz\Development\Tutorials\Temp\Log\ 
    
    rem define the new home for additional log-outputs
    set RES_ROOT=C:\Project\EDD\_SVN\SandBox\trunk\distribution\Moritz\Development\Tutorials\Temp\Result\ 
    
    rem call abc2xml for creating the xml parser trees
    %MORITZ_PATH%\bin\abc2xml UA:RootPath=%MORITZ_PATH% UA:LogRoot=%LOG_ROOT% UA:ResultPath=%RES_ROOT% CF.\cfg\ansi_c_abc2xml_cfg.xml >log_abc2xml.txt
    rem pause
    
    rem call xml2abc for creating the nassi shneiderman diagrams
    %MORITZ_PATH%\bin\xml2abc UA:RootPath=%MORITZ_PATH% UA:LogRoot=%LOG_ROOT% UA:ResultPath=%RES_ROOT% CF.\cfg\ansi_c_xml2abc_cfg_nsd.xml >log_xml2abc_nsd.txt
    rem pause
    
    rem call xml2abc for creating the uml like activity diagrams
    %MORITZ_PATH%\bin\xml2abc UA:RootPath=%MORITZ_PATH% UA:LogRoot=%LOG_ROOT% UA:ResultPath=%RES_ROOT% CF.\cfg\ansi_c_xml2abc_cfg_uad.xml >log_xml2abc_uad.txt
    rem pause
    

    I have tested it with relative paths as well as with absolute path on my Win 10 laptop.

    • The file ExampleConfiguration.zip contains the modified configuration and console-script of the introduction tutorial.
    • Inside the console script you will find in remark-lines ( rem ) other path-definitions I have used for testing.
    • Depending on the definition in the XML configuration it may be useful if the path-definition in the console-script ends with a separator (Windows ** \ ** or Linux ** / **).
    • Unfortunately I could not test it for Linux.

    I know that you have currently problems to download the zipped binaries or to build them by your self. But I hope you are able to find a solution for this.

    Take care about you, stay well and healthy,
    Eckard.

     
  • Eckard Klotz

    Eckard Klotz - 2020-12-19

    PS.:
    In the meanwhile I have uploaded a new SVN-Archive here.

     
  • Eckard Klotz

    Eckard Klotz - 2020-12-19
    • status: accepted --> pending
     
  • Wasilios Goutas

    Wasilios Goutas - 2020-12-21

    Hello Eckard,

    many thanks for being that fast in providing the fix.
    Unfortunately I can't download executables and will need to wait until you created a new release containing this fix to get it provided by the companies IT department.
    As I have a workaround, it is not a blocker for me to continue using Moritz :)
    Wish you merry Christmas and a happy new year
    Wasili

     
  • Eckard Klotz

    Eckard Klotz - 2020-12-23

    Hello Wasili.

    I know convincing the IT department may be a difficult task. But even I really think that we have a fruitful discussion, that will result in a extension of Moritz useful for everybody, I think is too early now for a new release.

    We are working currently on the basic configuration setup of the tool and if I would now prepare a new release I have to modify a lot of other configuration file used for Python, Matlab and Pascal also.
    I expect that we will implement some more changes and I want to prepare the next release not before we both come to the conclusion that your issues and needs are really solved. Otherwise one release would come after the other.

    However, today I have released new patches for Moritz. Here you will find 32 bit and 64 bit windows binaries and 32 bit binaries for Linux together with the sources to build them by your self.

    • Note: while building the Linux binaries I found an additional bug in a source used for xml2abc. Thus, please uses the binaries released with the patch instead of those provided by me before in our discussions.

    Last but not least I have also uploaded a new SVN archive.

    I wish you merry Christmas and a happy new year.

    Take care about you, stay well and healthy,
    Eckard.

     
  • Eckard Klotz

    Eckard Klotz - 2021-09-22
    • status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB