Commit Graph
73 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 4de660788d updated the copyright info.
Build and Deploy Documentation / build-and-deploy (push) Successful in 26s
2026-01-25 07:42:29 +01:00
suter_a f1587af451 added some more sanity checks for musrview. 2025-11-12 11:05:56 +01:00
suter_a 7491a2c331 now all error messages from musrview can be sent to PMsgBox. 2025-06-29 09:12:11 +02:00
suter_a 832a74e0b5 added a feature which brings up a error message box, if there was any issue with the msr-file when starting musrview from musredit. 2025-06-29 09:04:45 +02:00
suter_a 4a20d805dd updated the copyright info. 2025-01-30 11:15:42 +01:00
ext-mcfadd_r 61749b91c4 fix segfault
This patch provides a memory-safe alternative to the changes introduced in commit 418adfde67, which causes a segfault when the "batch mode" flag is required (i.e., for ascii/graphic export).

Note: the program name (i.e., argv[0]) has been added the list arguments passed to ROOT's TApplication. This ensures that the TApplication name matches that of the program (see https://github.com/root-project/root/blob/542b98b2ccca760fd83117b750b89d81b8e9b926/core/base/src/TApplication.cxx#L179-L180).
2024-06-17 10:52:14 -03:00
suter_a 418adfde67 propagate only necessary root flags to TApplication. 2024-06-06 10:06:50 +02: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 2a2e2b40d5 replaced raw pointers by smart pointers for musrview.cpp. 2023-10-13 12:10:06 +02:00
suter_a fe32046c21 updated the copyright info. 2023-01-05 10:24:31 +01:00
suter_a f3414f687c replaced sprintf -> snprintf throughout. 2022-11-05 20:16:44 +01: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 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 66f3b48e2a musrview gets the new feature: calculate theory points only at data points. 2020-08-29 11:15:02 +02:00
suter_a 10271dab9a update of the copyright info. 2020-04-29 09:05:40 +02:00
suter_a 785b32e945 proper cleanup. 2020-02-10 08:57:35 +01:00
suter_a 96d9ba5f88 added some more specifc error codes. 2019-04-25 20:23: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 97beb80c4b Dynamic Search Path for ROOT Dictionary
Added by default the dynamic search path '/usr/local/lib' to ROOT.
This is needed to find the necessary dictionaries for musrfit,
musrview, musrt0. Furthermore, added an option '--show-dynamic-path'
to these programs which allow the user to dump the currently used
dynamic search paths. This is potentially handy for diagnostics.
2019-02-05 09:51:30 +01:00
suter_a 86e1544c0e adopted the technical docu, according to the new sphinx user docu. 2018-07-04 12:43:26 +02:00
suter_a 1f73e808b5 improved the close canvas mechanism (from the global to the object level) 2017-11-30 22:02:25 +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 ceb7aa6818 changed from legacy rootcint to the new rootcling ROOT dictionary generator. 2017-02-08 09:47:35 +01:00
suter_a 63516fc499 added a first version of a optimized phase correction for the real Fourier transform 2016-12-18 10:37:50 +01:00
suter_a 7be8b4c2ea add a switch to musrview that it plots initially the Fouier data rather than the time domain data. 2015-02-20 12:22:24 +01:00
suter_a 0e6ceecf24 changed the data export handling from musrview. It is now more main line and follows the implementation of musrFT. At the same time removed an autodated comment in PFourierCanvas.h. 2015-02-16 17:23:39 +01:00
suter_a 2d2594c903 first almost feature complete version of musrFT 2015-02-13 16:56:19 +01:00
salman acb5a1af09 Remove redundant and optimize code for saving data to ascii in batch mode. 2015-01-27 11:17:06 +01:00
salman 55fb9df820 Turn on batch mode for --ascii option. 2015-01-26 16:56:36 +01:00
salman 8035bafec4 Added option to save data from canvas a quit for non-interactive mode (web). 2015-01-23 17:17:08 +01:00
suter_a da6fa2f544 changed timeout check 2014-06-30 14:56:29 +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 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 7368884482 added timeout facility for musrfit, musrview, musrt0. Adopted musredit/musrgui accordingly. 2012-04-15 08:39:30 +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
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 49619fcffb added NeXus support. Still a lot of testing will be needed, documentation updated, etc. 2011-04-08 09:24:32 +00:00
Bastian M. Wojek 34e462e05f Put in line the time-resolution output of single-histogram and asymmetry data.
Now both have a line break at the end--before this has only been true for the asymmetry data.
(If the line break is not needed it should be consistently removed and replaced by a cout.flush()
followed by a line break when musrview is terminated.)
2011-03-03 13:49:22 +00:00
nemu 5386342cf4 some more docu 2010-06-04 19:51:20 +00:00
nemu 41c5d45d8b replace RRF Asymmetry Fit dummy, by Mu Minus Single Histo Fit dummy 2010-01-12 16:00:12 +00:00
nemu 6f49067095 improved handling for invalid MUSRFITPATH 2010-01-05 10:13:12 +00:00
nemu 90807030f1 started with the next step of encapsulation, will take a while 2009-11-02 08:40:47 +00:00