Opened 7 years ago

Closed 6 years ago

#4896 closed defect (fixed)

Special characters in directory cause simulation failure

Reported by: Christian Kral <dr.christian.kral@…> Owned by: Martin Sjölund
Priority: high Milestone: 1.14.0
Component: Code Generation Version: v1.13.0-dev-nightly
Keywords: Cc:

Description

Consider the following example

model Test
  parameter Integer m=1;
end Test;

which is stored as /work/#/Test.mo. Due to the special character # the simulation fails with the following error message:

make -j2 -f Test.makefile
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test.o Test.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_functions.o Test_functions.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_records.o Test_records.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_01exo.o Test_01exo.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_02nls.o Test_02nls.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_03lsy.o Test_03lsy.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_04set.o Test_04set.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_05evt.o Test_05evt.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_06inz.o Test_06inz.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_07dly.o Test_07dly.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_08bnd.o Test_08bnd.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_09alg.o Test_09alg.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_10asr.o Test_10asr.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_11mix.o Test_11mix.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_12jac.o Test_12jac.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_13opt.o Test_13opt.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_14lnz.o Test_14lnz.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_15syn.o Test_15syn.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_16dae.o Test_16dae.c
clang  -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o Test_17inl.o Test_17inl.c
clang -I. -o Test Test.o Test_functions.o Test_records.o Test_01exo.o Test_02nls.o Test_03lsy.o Test_04set.o Test_05evt.o Test_06inz.o Test_07dly.o Test_08bnd.o Test_09alg.o Test_10asr.o Test_11mix.o Test_12jac.o Test_13opt.o Test_14lnz.o Test_15syn.o Test_16dae.o Test_17inl.o -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -L"/work/#"    -Os -fPIC -mfpmath=sse     -I"/usr/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=Test -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -L"/work/
/bin/sh: 1: Syntax error: Unterminated quoted string
Test.makefile:30: recipe for target 'omc_main_target' failed
make: *** [omc_main_target] Error 2
Compilation process failed. Exited with code 2.

The simulation runs with no issue when stored as, e.g., /work/Test.mo. So the issue is obviously with the special character #. As similar issue may occur when the directory name contains a blank (space) character:

  • /work/a b/Test.mo does not work
  • /work/Test 1.0/Test.mo works

German umlaut characters are no problem. I think this issue shall either be fixed or somehow clearly communicated to the user, which special characters combinations do not work.

Change History (7)

comment:1 by Adrian Pop, 7 years ago

They should work fine if they are quoted properly in the Makefile we generate.
Can you attach the generated Makefile so I can see were we should add the quotes?

comment:2 by Martin Sjölund, 7 years ago

We generate:

omc_main_target: $(MAINOBJ) M_functions.h M_literals.h $(OFILES)
  $(CC) -I. -o M$(EXEEXT) $(MAINOBJ) $(OFILES) $(CPPFLAGS) -L"/tmp/#"   $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)

Where GNU make considers everything after # as a comment. However, if # is part of a make or env. variable, this is handled as expected.

comment:3 by Martin Sjölund, 7 years ago

I did not find any problems with spaces in paths though (on Linux).

comment:5 by Martin Sjölund, 7 years ago

Milestone: Future1.13.0
Owner: changed from Lennart Ochel to Martin Sjölund
Status: newassigned

I'll wait with closing this until you can test the nightly build. Perhaps there is some use-case I missed.

comment:6 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:7 by Adeel Asghar, 6 years ago

Resolution: fixed
Status: assignedclosed

Feel free to reopen the ticket if the issue is still valid.

Note: See TracTickets for help on using tickets.