POV-Ray : Newsgroups : povray.beta-test : A v3.8 onward bug in version initialization. Server Time
1 Mar 2024 18:53:37 EST (-0500)
  A v3.8 onward bug in version initialization. (Message 1 to 1 of 1)  
From: William F Pokorny
Subject: A v3.8 onward bug in version initialization.
Date: 28 Jan 2024 15:35:31
Message: <65b6ba93$1@news.povray.org>
Found a v3.8 onward bug(*) while running a scene Kenneth posted in this 
thread:

https://news.povray.org/povray.binaries.programming/thread/%3C65b14502%40news.povray.org%3E/

The internal version defaulting sometimes does not run leaving the 
values which should be set by the defaulting mechanism to whatever 
defaulting is otherwise done on the creation of initial scene data.

In parser.cpp and the function Parser::Run() there is a call to 
InitDefaults(). Whether InitDefaults() does anything depends on whether 
the initial version selects the DefaultsVersion::kLegacy set or the 
DefaultsVersion::k380 set; Further, after the selection, whether the set 
of version defaults is different than that set just above the call to 
InitDefaults() pointed to with the variable defaultsVersion.

If the defaultVersion aligns with DefaultsVersion, InitDefaults() does 
nothing. There are only two states, so half the time it doesn't do the 
initialization it should(*). We need three DefaultsVersion states to 
force InitDefaults() to always run at least once at the start of parsing.

The fix
-------

In parser.h change:

         enum class DefaultsVersion : char
         {
             kLegacy,  ///< Pre-v3.8 defaults.
             k380,     ///< v3.8.0 defaults.
         };

to:

         enum class DefaultsVersion : char
         {
             kInvalid, ///< Use in Parser::Run() as initial default.
             kLegacy,  ///< Pre-v3.8 defaults.
             k380,     ///< v3.8.0 defaults.
         };

In parser.cpp and Parser::Run(), before the InitDefaults() call, change:

             defaultsVersion = DefaultsVersion::kLegacy;
or
             defaultsVersion = DefaultsVersion::k380;

to:

             defaultsVersion = DefaultsVersion::kInvalid;


(*) - There are many ways the bug can be hidden by option and scene 
settings. It might be too, even if tripping the bug, the internal 
defaulting of values outside of InitDefaults() aligns with the 
particular scene being run - and so no ill effects are seen.

Bill P.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.