Skip to content

Something during XML loading (re)sets locale settings #3203

Closed as not planned

Description

@jpfeuffer

This let's all C library printing and conversion functions "fail"/be inconsistent. (sprintf, atof, ...)
Although we keep a pointer to the locale settings in our Types.cpp, the contents get overwritten, too.
E.g. before https://github.com/OpenMS/OpenMS/blob/develop/src/topp/OpenSwathFeatureXMLToTSV.cpp#L450
the locale is "C", but after it is "de_DE.utf8" (which is set in my LANG environment variable).

I read about QApplications of QT resetting the locale but could not find where it would be constructed in that tool.
Could also be Xerces.
I did not find any other setlocale usage of our library.

Activity

  1. timosachsenberg commented on Feb 12, 2018

    @timosachsenberg
    Contributor

    hmm just an idea:

    // We need to use a QCoreApplication to fire up the QEventLoop to process the signals and slots.

    This constructs a QCoreApplication which might set the local

  2. jpfeuffer commented on Feb 13, 2018

    @jpfeuffer
    ContributorAuthor

    Hmm I was checking. But the tests correctly have a "-test" flag which should deactivate UpdateCheck right?

  3. jpfeuffer commented on Feb 13, 2018

    @jpfeuffer
    ContributorAuthor

    Until we find the true reason: @grosenberger or @hroest can you have a look at OpenSwathFeatureXMLtoTSV and find an alternative to sprintf so that the tool does not depend on the locale?
    Maybe you can set the locale to German on the command line (e.g. Linux) and see if the tests pass. You know the expected TSV format a bit better.

  4. jpfeuffer commented on Feb 13, 2018

    @jpfeuffer
    ContributorAuthor

    Not sure why this is showing up now on the build machines (QT5? threadsafety of the locale?) but as you see, I remember having the problem before on my Mac.

    Offending lines:			(tab_width = 8, first_column = 1)
    
    in1:  C:\jenkins\ws\openms_pr_ci\979a8a2f\source\src\tests\topp\OpenSwathFeatureXMLToTSV_3_output.short.csv   (line: 2, position/column: 360/531)
    tr_gr1_run0	0	testfile.file	3119.09196821988	f_11965988948540676971	PEPTIDEA	NA	NA	500	3574.23		0	3118.65196821988	3096.28002929688	-21994.8526298809	2	3147.67993164062	3118.65196821988	86.0041379995282	3680.16062933207	0.985403060913086	0.971216417399615	1	0.108663236021716	4.45439541136954	3118.65196821988	0	0	0.998183460545928	0.997577947394571	803.023010!
               	 	             	                	                      	        	  	  	   	       		 	                	                	                 	 	                	                	                	                	                 	                 	 	                 	                	                	 	 	                 	                 	          ;2771.209961	NA;NA	tr1;tr2
    
    in2:  C:\jenkins\ws\openms_pr_ci\979a8a2f\build\src\tests\topp\OpenSwathFeatureXMLToTSV_3_output.short.csv.tmp   (line: 2, position/column: 353/524)
    tr_gr1_run0	0	testfile.file	3119.09196821988	f_11965988948540676971	PEPTIDEA	NA	NA	500	3574.23		0	3118.65196821988	3096.28002929688	-21994.8526298809	2	3147.67993164062	3118.65196821988	86.0041379995282	3680.16062933207	0.985403060913086	0.971216417399615	1	0.108663236021716	4.45439541136954	3118.65196821988	0	0	0.998183460545928	0.997577947394571	803!
               	 	             	                	                      	        	  	  	   	       		 	                	                	                 	 	                	                	                	                	                 	                 	 	                 	                	                	 	 	                 	                 	   ,023010;2771,209961	NA;NA	tr1;tr2
    
    
    Easy Access:
    C:\jenkins\ws\openms_pr_ci\979a8a2f\source\src\tests\topp\OpenSwathFeatureXMLToTSV_3_output.short.csv:2:531:
    C:\jenkins\ws\openms_pr_ci\979a8a2f\build\src\tests\topp\OpenSwathFeatureXMLToTSV_3_output.short.csv.tmp:2:524:
    
  5. hroest commented on Feb 16, 2018

    @hroest
    Contributor

    hmm interesting, it uses a , to separate instead of a .. We currently use sprintf in a few places:

    $ grep -R -c sprintf src/openms  | grep -v ":0"
    src/openms/source/ANALYSIS/OPENSWATH/OpenSwathTSVWriter.cpp:2
    src/openms/source/CONCEPT/Exception.cpp:10
    src/openms/include/OpenMS/FILTERING/TRANSFORMERS/SpectraMerger.h:1
    
  6. added
    minor
    and removed on Mar 12, 2018
  7. jpfeuffer commented on Mar 12, 2018

    @jpfeuffer
    ContributorAuthor

    I made it to minor. Easy workaround is not using C functions to print out stuff.
    Please use our toString methods for DataTypes. I'll keep it open since it could be solved better.

  8. stale commented on Apr 30, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  9. github-actions commented on Mar 9, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectminorwontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions