Commit Graph
38 Commits
Author SHA1 Message Date
suter_aandClaude Opus 5 f7191a2907 fix musrview ctest failures on macOS: RGB order and path buffers
Three unrelated issues made the musrview_check tests fail on macOS while
passing on Linux.

1. Unspecified argument evaluation order

   TColor::GetColor(rand.Integer(255), rand.Integer(255), rand.Integer(255))

   evaluates its (side-effecting) arguments in an unspecified order: clang
   goes left-to-right, gcc right-to-left, so the same seed yielded RGB on
   one platform and BGR on the other. Visible whenever more runs are
   plotted than the startup xml colour list provides, e.g.
   test-histo-HAL9500.msr with 16 runs against 10 colours.

   The rgb values are now drawn into separate variables first. This keeps
   the clang result and changes gcc to match, hence the regenerated
   reference PNG for musrview-histo-HAL9500 (99.94% of the differing
   pixels were exact R<->B swaps).

   Fixed in PMusrCanvas, PFourierCanvas and both mupp PMuppCanvas copies.

2. Fixed size path buffers

   char fileName[128] plus strncpy(dst, src, sizeof(dst)) truncates *and*
   leaves the buffer unterminated once the path reaches the buffer size.
   musrview then failed on a 132 character msr-path in doc/examples/ViewOpts.
   musrFT and musrt0 were worse: an unbounded strcpy of the startup file
   path into char startup_path_name[128], i.e. a stack buffer overflow.

   All path/filename buffers in the drivers are now std::string:
   musrview, musrFT, musrt0, musrfit, any2many, addRun, dump_header.
   PMusrCanvas::SaveGraphicsAndQuit() takes const Char_t* accordingly.

   Along the way in the same files:
   - msr2msr_replace() wrote a 256 byte line into char temp[128]
   - msr2msr assembled "cp"/"rm" shell commands from paths in a 256 byte
     buffer; replaced by std::filesystem
   - msr2msr and addRun read lines with getline(buf, N), which silently
     abandons the rest of the file on the first over-long line
   - addRun: bound the unbounded sscanf "%s" to "%255s"
   - dropped scratch buffers that only held a string literal, in favour of
     TString::ReplaceAll(const char*, const char*)

3. musrview_check.py left its PNGs behind on failure

   The two early error returns skipped the cleanup, and since generated
   PNGs were identified by "not in the pre-run snapshot", one leftover file
   permanently masked the real output of that test: musrview overwrites the
   stale PNG, so it was there, just filtered out. One failure thus poisoned
   every later run (30 of the 37 observed failures) after a 15 s poll each.

   Cleanup now runs in a finally block on every exit path, and generated
   PNGs are detected by mtime instead, which sees rewritten leftovers while
   staying safe for a sibling test running concurrently under ctest -j.
   Also dropped the MUSRVIEW_PNG_DIR env var and its tmp-dir fallback: it
   is read nowhere in src/, so the fallback was dead code that guaranteed
   the full 15 s poll before every "no PNGs found" failure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 14:49:17 +02:00
suter_a 9a48487220 updated the copyright info. 2026-02-13 13:59:49 +01:00
suter_a 9545811e20 added some more sanity checks for any2many. 2025-11-26 17:31:58 +01:00
suter_a 71fb4c9435 add TDirectory option to any2many. 2025-10-03 16:21:14 +02:00
suter_a 44821cb8cd updated the copyright info. 2025-01-30 12:00:49 +01:00
suter_a 17339e191d updated copyright info. 2024-02-07 15:29:08 +01:00
suter_a f9d0d7f18f more work to get rid of raw pointers. 2023-10-25 09:12:10 +02:00
suter_a bad6812b2b replaced raw pointers by smart pointers for any2many.cpp. 2023-10-25 09:01:02 +02:00
suter_a a356534e6a updated the copyright info. 2023-01-05 11:04:42 +01:00
Andreas Suterandsuter_a fea7b535b6 use proper return value (int) rather than bool. 2022-04-29 08:59:37 +02:00
suter_a e679546d60 replace the run-list handling through the already existing handler class PStringNumberList. 2022-04-27 16:49:15 +02:00
suter_a d3d55f8719 make sure that git repo info is only added if the musrfit project source is indeed a git repo, and not e.g. a download. 2021-07-12 16:46:10 +02:00
suter_a aa2766bbaf add info on how musrfit is compiled Debug or Release. 2021-05-21 08:02:37 +02:00
suter_a 2a531bd58d add ROOT version information for better diagnostics. 2021-04-09 16:03:04 +02:00
suter_a a7b540cfdb update of the copyright info. 2021-03-29 08:30:43 +02:00
suter_a b6dba8965b update of the copyright info. 2020-04-30 17:46:10 +02:00
suter_a c64c74dbf8 modernized code to C++11 and newer.
This allows to analyze the code by external code analyzers. Since a lot is adopted,
the version is changed to 1.4.3

Conflicts:
	src/classes/PFitter.cpp
	src/classes/PFourier.cpp
	src/classes/PMsrHandler.cpp
	src/classes/PMusrCanvas.cpp
	src/classes/PRunAsymmetry.cpp
	src/classes/PRunAsymmetryRRF.cpp
	src/classes/PRunListCollection.cpp
	src/classes/PRunSingleHisto.cpp
	src/classes/PRunSingleHistoRRF.cpp
	src/classes/PStartupHandler.cpp
	src/include/PFourier.h
	src/include/PRunListCollection.h
	src/musrFT.cpp
2019-04-24 17:44:58 +02:00
suter_a fca13283e1 changed generation of git-revision.h which allows to keep it up-to-date. Aditionally git-branch info has been added. 2017-02-22 09:42:07 +01:00
Thomas Prokscha fab7acfedc added a group histo selector in any2many for MusrRoot when exporting to a too limited file format as PSI-BIN. 2015-05-29 15:11:04 +02:00
suter_a bbb8550f96 since we moved to git, I cleaned up the svn prop's from the sources and added a GIT_REVISION through git-revision.h 2014-02-12 12:43:32 +01:00
suter_a 4e554aaf84 fixed any2many bug concerning input file lists as described in MUSR-247. Rewrote the template browser. 2013-01-21 11:43:11 +00:00
suter_a 459a36fa79 added some information about elapsed fitting times. Corrected some outdated online helps. 2013-01-07 11:54:28 +00:00
suter_a 6c8ce66e1d (i) add PRINT_LEVEL to the command block (0='nothing' to
3='everything'). This allows to tune the Minuit2 output. (ii) added the
possibilty to give the fit range in bins. For details see the docu.
2012-10-25 14:44:16 +00:00
suter_a 1d6f8082f0 newly added dump_header, which dumps the header information of a muSR data file. Furthermore some minor cleanup took place. 2012-05-12 14:08:27 +00:00
suter_a f04dd5a283 prevent any2many from overwriting an input file. At the some additional bug fixing of any2many has be carried out. 2012-05-10 14:43:48 +00:00
suter_a 138e7ba369 first implementation of MusrRoot. Cleaner handling of Red/Green mode data. General cleanup 2012-03-22 07:00:34 +00:00
suter_a 7e2ea62ac3 more work towards NeXus exchange 2011-12-22 10:27:01 +00:00
suter_a 60a11bffa5 more work on the conversion routines, NeXus, etc. 2011-12-16 15:22:35 +00:00
nemu 03b9fe1e71 added minimal NeXus IDF 2 support. 2011-08-23 17:22:29 +00:00
Bastian M. Wojek caa3fdfc12 * Define a function for the XML-reading workaround in order to clean up a bit.
For the moment we keep to copies of it -- one for the use within the various
  musrfit programs, one that can be used in user functions.

* musrt0 is now again activated in musrgui/musredit by default.
2011-06-23 11:00:09 +00:00
Bastian M. Wojek dc48ea9712 * Suggestion how to "solve" the XML-reading problems in certain environments:
A workaround has been implemented where it is not tried any more to "directly
  parse the file" but rather the file is read into a memory buffer which then
  is parsed.
  For further information, see MUSR-122.

* Fixed a linking problem when only shared libraries are built on Cygwin
  (introduced with the split-off of libPUserFcnBase).
2011-06-16 22:00:33 +00:00
Bastian M. Wojek 8dc31cad54 Fixed crash of musrview in case the XML startup file is present but cannot be parsed correctly 2011-06-14 17:53:33 +00:00
nemu 2f8e393dfa any2many: force the user to define the exact NeXus ouput formate (HDF4,HDF5,XML) 2011-04-14 08:01:44 +00:00
nemu 49619fcffb added NeXus support. Still a lot of testing will be needed, documentation updated, etc. 2011-04-08 09:24:32 +00:00
nemu 90ed9df1b6 some more work, including the PSI-BIN write routines which are officially not released yet. 2011-02-07 06:02:56 +00:00
nemu 826ad1efa9 a more fexible handling of filename list and run list in any2many (see MUSR-166). Still far from production 2011-01-13 12:10:30 +00:00
nemu a406219826 some more work on any2may. Still not meant for production 2011-01-11 06:24:02 +00:00
nemu 452018bedf added any2many, an attempt to write the universial musr-data-file converter. Still some work needed. Added the possibility to show the t0 saved in the data file. 2010-12-23 13:16:57 +00:00