Commit Graph
44 Commits
Author SHA1 Message Date
suter_a 32f2d3defa fix exit status: several executables reported success (0) on failure or vice versa
Build and Deploy Documentation / build-and-deploy (push) Successful in 23s
Two bug patterns fixed across src/*.cpp:

- musrfit, musrview, any2many, addRun, musrFT, musrt0: a local
  success/ok/isGood flag was tracked and an error printed, but the
  function fell through to an unconditional `return PMUSR_SUCCESS;`
  at the end instead of propagating the failure.
- msr2data, msr2msr: the success path returned a nonzero code (1)
  instead of 0.

Also propagate previously-ignored return codes to the process exit
status in dump_header (format-dispatch functions), musrRootValidation
(schema validation / consistency checks), and write_musrRoot_runHeader
(FillFolder failure).
2026-08-27 12:38:46 +02:00
suter_aandClaude Opus 5 618e96fb00 fix musrview ctest failures on macOS: RGB order and path buffers
Build and Deploy Documentation / build-and-deploy (push) Successful in 27s
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-07-29 19:44:50 +02:00
suter_a bedbe2584b proper handling in dump_header of TDirectory in combination with the summary option.
Build and Deploy Documentation / build-and-deploy (push) Successful in 31s
2026-04-30 11:07:20 +02:00
suter_a 30fbd8eb67 fixed typo, and added file pointer checks. 2026-02-02 19:14:14 +01:00
suter_a 76dbd757e3 dump_header can now handle HDF4/HDF5 NeXus files, without the NeXus library. 2026-02-02 19:08:12 +01:00
suter_a 2eb0cf28d5 fixed missing TDirectory handling of RunSummary in dump_header.cpp 2026-01-29 19:40:10 +01:00
suter_a 3eea73f07a stub for new NeXus file handling. Not much is working yet. 2026-01-25 08:26:43 +01:00
suter_a f66c832d56 updated the copyright info. 2026-01-25 07:45:44 +01:00
suter_a 244baa4dd4 add PSI/VMS to dump_header.
Build and Deploy Documentation / build-and-deploy (push) Successful in 18s
2025-11-24 19:25:45 +01:00
suter_a 4ab01f4faf added some more sanity checks for dump_header.
Build and Deploy Documentation / build-and-deploy (push) Successful in 19s
2025-11-12 17:56:33 +01:00
suter_a 10117abeff dump_header can now handle TMusrRoot with TFolder as well as TDirectory. 2025-09-30 12:30:45 +02:00
suter_a 4a20d805dd updated the copyright info. 2025-01-30 11:15:42 +01:00
suter_a 79c8be54bf update of the copyright info. 2024-02-03 19:58:11 +01:00
suter_a ca742a064f more work to get rid of raw pointers. 2023-10-17 16:35:54 +02:00
suter_a 98026c725d replaced raw pointers by smart pointers for dump_header.cpp. 2023-10-13 12:33:47 +02:00
suter_a 1df6643bfa more robust handling of positron detector entries. 2023-08-31 10:17:40 +02:00
suter_a 0b3fc43123 handle dump of RunSummary with and without '\n' and/or '\r' properly. 2023-08-31 07:47:47 +02:00
suter_a 22178f7869 improved search run, allowing to look for a specific file format in case the run is saved in multiple different file formats. 2023-08-30 15:05:56 +02:00
suter_a 2e6e5ecb97 added the flame instrument. 2023-08-30 14:09:19 +02:00
suter_a 39a54d7f63 dump_header can dump #counts for each detector now also for mud and nexus. 2023-05-17 17:22:47 +02:00
suter_a 420b301ac5 dump_header can dump #counts for each detector. Currently only for MusrRoot. 2023-05-16 14:21:33 +02:00
suter_a fe32046c21 updated the copyright info. 2023-01-05 10:24:31 +01:00
suter_a 1b190830e9 fixed typo. 2022-06-01 13:43:01 +02:00
suter_a 7b19ba8b36 use PFindRun facility now. Cleaned up various little things. 2022-06-01 13:08:07 +02:00
suter_a 06d20d4086 adopted to new PSI-BIN lib. Added facility for finding runs via musrfit_startup.xml templates. 2022-05-28 14:10:15 +02:00
suter_a 0625bc008f fixed a typo, and tell the user if the file format info is not provided MusrRoot is assumed. 2022-05-27 13:14:30 +02:00
suter_a c6c7deec9c make PSI bulk MusrRoot files accessible if the file name is generated from the run-number, year, etc. 2021-07-28 13:22:42 +02:00
suter_a daa2ea1347 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 15:34:07 +02:00
suter_a f4232057b8 perform a more robust casting. 2021-06-02 12:29:00 +02:00
suter_a 8cce005fd5 add info on how musrfit is compiled Debug or Release. 2021-05-21 07:44:50 +02:00
suter_a 38b289b99f add ROOT version information for better diagnostics. 2021-04-09 09:33:08 +02:00
suter_a e6e951e8f4 update the copyright info. 2021-03-29 08:22:38 +02:00
suter_a 10271dab9a update of the copyright info. 2020-04-29 09:05:40 +02:00
suter_a 795cd75b1e 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
2019-04-16 15:34:49 +02:00
suter_a be1e47e480 for PSI-BIN/MDU: fixed wrong last good bin, and added number of events per histo. 2017-11-23 10:10:08 +01:00
suter_a f43d51738f added missing temperature unit. 2017-11-23 09:22:20 +01:00
suter_a d49821658b for PSI-BIN/MDU: dump all temperature available including the std devs. 2017-11-23 09:00:09 +01: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
suter_a 30708ff4bc fixed problem with full path-file-name. 2017-01-14 11:44:35 +01:00
suter_a 65d40cfe97 improved user interface. (i) it is searching now not only in the current directory or file-path-name, but also in the default search paths for data files as defined in the musrfit_startup.xml. (ii) it is now also possible to use run numbers rather than full file names. 2016-12-18 10:31:16 +01:00
suter_a d635eb33fd added extension such that also MDU files are recognized correctly. 2014-09-25 20:56:11 +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 bf1d8cc96d added spin rotation angle to the LEM MusrRoot file 2012-05-22 13:51:56 +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