Opened 4 years ago
Last modified 3 years ago
#6152 new defect
Linker warning mktemp is dangerous
Reported by: | Andreas Heuermann | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Build Environment | Version: | v1.17.0-dev |
Keywords: | linker, mktemp, tmpnam | Cc: |
Description
When compiling omc we get warnings that some functions like mktemp
and tmpnam
are dangerous and should be replaced.
/usr/bin/ld: /home/andreas/workspace/OpenModelica/build/lib/x86_64-linux-gnu/omc/libModelicaExternalC.a(ModelicaInternal.o): in function `ModelicaInternal_temporaryFileName': /home/andreas/workspace/OpenModelica/OMCompiler/3rdParty/ModelicaExternalC/BuildProjects/autotools/../../C-Sources/ModelicaInternal.c:652: warning: the use of `tmpnam' is dangerous, better use `mkstemp' /usr/bin/ld: /home/andreas/workspace/OpenModelica/build/lib/x86_64-linux-gnu/omc/libModelicaMatIO.a(ModelicaMatIO.o): in function `Mat_VarDelete': /home/andreas/workspace/OpenModelica/OMCompiler/3rdParty/ModelicaExternalC/BuildProjects/autotools/../../C-Sources/ModelicaMatIO.c:4854: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
Annoying but not really a problem (besides security concerns of course).
When compiling Modelica models with OMEdit users will get the same errror message in the "Compilation" tab.
/usr/bin/ld: /home/andreas/workspace/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libModelicaMatIO.a(ModelicaMatIO.o): in function `Mat_VarDelete': /home/andreas/workspace/OpenModelica/OMCompiler/3rdParty/ModelicaExternalC/BuildProjects/autotools/../../C-Sources/ModelicaMatIO.c:4854: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
This will raise questions for a lot of users if they did something wrong when building a model.
Change History (4)
comment:2 by , 4 years ago
temporaryFileName is not called from and might be possible to remove/obsolete in the next major release of MSL (but I guess it would still remain in the C library for backwards compatibility; maybe it could use mkstemp and return a filename to an existing file instead and hope this is good enough):
ADGenKinetics 1.0.0+r23 ADMSL 1.1.0-alpha-Hamburg AdvancedNoise 1.0.0 AixLib 0.3.0 AixLib 0.4.0 AixLib 0.9.1 AlgebraTestSuite master ApproxSpline 1.0.0-master Arduino 0.1.0 ATplus 2.1.0 BioChem 1.0.2 BondGraph 1.1.0 BondLib 2.3.0 BrineProp 0.5.8 BuildingControlLib 1.0.0 Buildings 4.0.0 Buildings 6.0.0 Buildings 7.0.0 BuildingSystems 2.0.0-beta BuildSysPro 3.3.0 Chemical 1.1.0 Complex 3.2.3+maint.om Complex 4.0.0+maint.om ComplexLib 1.0.0 ConPNlib 1.0.0 DataFiles master DeployStructLib 1.0.0 Design master DESLib 1.0.0 DisHeatLib 1.2.0-master DriveControl 4.0.0-master ElectricalEnergyStorage 3.2.2-master ElectroMechanicalDrives 2.4.0 EMOTH 1.4.1-master ExtendedPetriNets 1.0.0 ExternalLibrary master ExternalMedia 3.2.1 ExternalMemoryLib master ExternData 2.5.0 FailureModes 1.2.1 FastBuildings master FaultTriggering 0.6.6 FCSys 0.2.6 FCSysTest 0.2.6 FeedDriveLibrary 1.0.1 Flight master FMITest master FractionalOrder master FreeFluids 1.1.6-master FuelCellLib 1.0.0 FuzzyControl 1.0.0 GNU_ScientificLibrary master HanserModelica 1.1.1 HelmholtzMedia 0.9.8 IBPSA 3.0.0 Icons master IdealizedContact 0.1.0 IDEAS 2.1.0 IndustrialControlSystems 1.1.0 iPSL 1.1.1 KeyWordIO 0.9.0 LibRAS master LinearMPC 1.0.0 ManualTracking master MessagePack 0.1.1-master Modelica 1.6.0+om Modelica 2.2.2+maint.om Modelica 3.2.3+maint.om Modelica 4.0.0+maint.om ModelicaAdditions 1.5.0 ModelicaADS 1.0.1 ModelicaByExample 0.6.0 ModelicaCompliance 3.2.0-master Modelica_DeviceDrivers 1.4.4 Modelica_DeviceDrivers 1.7.0 Modelica_DeviceDrivers 2.0.0 ModelicaDEVS 1.0.0 Modelica_LinearSystems2 2.3.4 Modelica_LinearSystems2 2.4.0 Modelica_Noise 1.0.0-Beta.1 ModelicaReference 3.2.3+maint.om Modelica_Requirements 0.6.0-master ModelicaServices 3.2.3+default.modelica.association ModelicaServices 3.2.3+maint.om ModelicaServices 4.0.0+maint.om Modelica_StateGraph2 2.0.1 Modelica_StateGraph2 2.0.2 Modelica_StateGraph2 2.1.0 Modelica_Synchronous 0.92.1 Modelica_Synchronous 0.93.0 ModelicaTest 3.2.3+maint.om ModelicaTestOverdetermined 3.2.3+maint.om ModelManagement master ModPowerSystems master MultiPhaseMixture 1.0.0 MVEMLib 1.0.1 NcDataReader2 2.5.0 NeuralNetwork 1.0.0 Noise 0.2.0 Nuclear master ObjectStab 1.1.0-Dev ObsoleteModelica3 3.2.3+maint.om ObsoleteModelica4 4.0.0+maint.om OpenBLDC master OpenHPL 1.2.0 OpenHydraulics 1.0.1 OpenIPSL 1.5.0 Optimisers 0.1.0-master PDE master PhotoVoltaics 1.6.0 PhotoVoltaics_TGM 1.6.0 Physiolibrary 2.3.1 Physiomodel 1.0.0 PJlib master PJLoeslib master PlanarMechanics 1.4.1 PNlib 2.2.0 PowerGrids 1.0.1 PowerSystems 1.0.0 PraxisSimulationstechnik master PropulsionSystem 2020.4.30 PVlib 0.4.0 PVSystems 0.6.2 QCalc 0.3.3 QCalcTests 0.3.3 QSSFluidFlow 1.0.0 RealTimeCoordinationLibrary 1.0.2 RotorAeroLib master ScalableTestSuite 10.0.0 SDF master Servomechanisms master SiemensPower 2.2.0 SMPS master SolarTherm 0.2.0-master Soltermica master Spot 0.706.1 SpotExamples 0.706.1 StreamConnectors master SystemDynamics 2.1.1-master ThermalSeparation 0.2.0-master ThermoCycle 1.0.0 ThermoPower 3.1.0-master ThermoSysPro 3.2.0 TILMedia 1.5.1-ClaRa TRANSFORM 1.0.0-beta UserInteraction master VehicleInterfaces 1.2.5 VehicleInterfaces 2.0.0 VVDRlib master WasteWater 2.1.0 WaterHub master Wavelet master wbEHPTlib master wbEHVpkg master WindPowerPlants 1.2.0 XogenyTest 1.1.0-master
The use of mktemp in ModelicaMatIO could be resolved by using mkstemp instead.
comment:3 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
Take it up at https://github.com/modelica/ModelicaStandardLibrary/issues
That is where the warning originates from