From 1d3cb6b23b42edd93c3d8019780ed3f2e628f17a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 24 Apr 2025 23:39:58 +0200 Subject: [PATCH] Upgrade: fix test-failures (1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - with Debian 12/13, the top-level `/bin`, `/sbin` and `/lib` are collapsed into `/usr`. Seemingly this has prompted changes to the way the shell prints some error messages. This broke the expectation of some test of the test-framework itself. - SCons always had the policy to ''sanitise'' the invocation environment, to prevent unintended impact of environment settings to the test subject. Seemingly this now also leads to `$HOME` not being defined. Our file handling framework however expects to be able to expand "~" - An old-style cast in the constructor lib::diff::Record(Mutator const&) is now translated into a static_cast (≙conversion); and since the appropriate conversion operator is missing on Mutator, the constructor attempts to create a temporary, by re-invoking the same constructor ⟹ Stackoverflow ↯ --- src/lib/diff/record.hpp | 23 +- tests/00test.tests | 2 +- tests/SConscript | 1 + tests/library/diff/generic-record-test.cpp | 6 + wiki/thinkPad.ichthyo.mm | 659 ++++++++++++++++++++- 5 files changed, 663 insertions(+), 28 deletions(-) diff --git a/src/lib/diff/record.hpp b/src/lib/diff/record.hpp index 9860e4a0a..cdbc47432 100644 --- a/src/lib/diff/record.hpp +++ b/src/lib/diff/record.hpp @@ -193,6 +193,10 @@ namespace diff{ { } // all default copy operations acceptable + Record (Record &&) = default; + Record (Record const&) = default; + Record& operator= (Record &&) = default; + Record& operator= (Record const&) = default; /** for diagnostic purpose */ @@ -262,11 +266,11 @@ namespace diff{ /** * While otherwise immutable, * a Record object can be remoulded - * with the help of a Mutator object + * with the help of a Mutator object... * @remarks a Mutator basically wraps a \em copy * of the original object. After performing * the desired changes, the altered copy can either - * be sliced out (by conversion), or moved overwriting + * be copied out (by conversion), or moved overwriting * an existing other Record instance (implemented as swap) */ class Mutator; @@ -287,12 +291,14 @@ namespace diff{ * which in turn becomes the only child of the new Record. */ Record (Mutator const& mut) - : Record((Record const&) mut) + : Record(static_cast (mut)) { } explicit Record (Mutator && mut) - : Record(std::move (Record(mut))) - { } + : Record{} + { + mut.swap(*this); + } friend class Mutator; @@ -418,10 +424,9 @@ namespace diff{ : record_(std::move (startingPoint)) { } - operator Rec&() - { - return record_; - } + /** Builder-terminal: return copy of mutated results when done */ + operator Rec & () { return record_; } + operator Rec const&() const { return record_; } void swap (Rec& existingInstance) noexcept diff --git a/tests/00test.tests b/tests/00test.tests index bdaca6c55..cd097ab3c 100644 --- a/tests/00test.tests +++ b/tests/00test.tests @@ -7,7 +7,7 @@ return: 0 END TEST "test stderr, cat'ing noonexistant file" ,nonexistent_file < - - + + @@ -161258,8 +161258,7 @@ Since then others have made contributions, see the log for the history.argument_type and result_type — which are no longer needed by modern code (and the STL), since traits or even concepts are commonplace nowadays.

- -
+ @@ -161272,8 +161271,7 @@ Since then others have made contributions, see the log for the history.src/lib/time/timevalue.hpp:303:13: note: because 'lib::time::Time' has user-provided 'lib::time::Time& lib::time::Time::operator=(lib::time::Time)'

- - + @@ -161314,6 +161312,11 @@ Since then others have made contributions, see the log for the history. + + + + + @@ -161325,8 +161328,7 @@ Since then others have made contributions, see the log for the history.diesem Scope wird nach dem reinen Namen der Funktion gesucht. Für diesen könnten mehrere Overloads in dieser Funktion sichtbar sein, und nur auf diesen wird die Overload-Resolution gemacht. Nur falls die konkrete Subklasse die Funktion gar nicht definiert, wird dann über die Vererbungshierarchie gesucht (und bei Templates gar nicht). Das heißt, hier kollidiert das Standard-Verhalten von C++ (das von C abstammt), mit dem Konzept eines virtuellen Dispatch. Im Zweifelsfall macht der Compiler immer einen direkten Aufruf, und versucht dann ggfs. sogar, die Argumente automatisch zu konvertieren. Deshalb könnte das tatsächlich eine Falle sein, und die Warnung ist grundsätzlich angebracht.....

- - +
@@ -161361,7 +161363,9 @@ Since then others have made contributions, see the log for the history. - + + + @@ -161401,10 +161405,13 @@ Since then others have made contributions, see the log for the history.echten Compile-Fehler, weil das Symbol zweideutig ist. Und zwar by design, wir bauen das ja über eine Typ-Sequenz auf

- -
+
+ + + + @@ -161423,8 +161430,7 @@ Since then others have made contributions, see the log for the history. - - + @@ -161449,8 +161455,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -161462,8 +161468,7 @@ Since then others have made contributions, see the log for the history. - - + @@ -161488,8 +161493,67 @@ Since then others have made contributions, see the log for the history. - + + + + + + +

+ Frage: wirklich? +

+

+ und jetzt umsetzen? +

+ +
+ + + + + + + + + + + + + +

+ Ich wollte zwar auf der technischen Ebene die Klasse UICoord immutable machen, aber für die Verwendung sollte sich das transparent anfühlen, ähnlich wie die moderne funktionale Programmierung mit immutable-containers umgeht: +

+
    +
  • + gewisse Spezifikations-Funktionen steigen in einen Builder ein, der auf einer Kopie aufbaut +
  • +
  • + dieser Builder kann aber nahtlos überall dort verwendet werden, wo auch UI-Coordinaten verwendet werden können +
  • +
+ +
+
+ + + + +

+ ich wollte definitiv kein Terminal in der Notation +

+ +
+
+
+ + + + + + + +
@@ -161497,6 +161561,334 @@ Since then others have made contributions, see the log for the history. + + + + +

+ TEST test stderr, cat'ing noonexistant file: ,nonexistent_file .. FAILED +

+

+ cat: ,nonexistent_file: No such file or directory +

+

+ unexpected data on stderr +

+

+ more output than expected: 'cat: ,nonexistent_file: No such file or directory':1 +

+

+ stderr was: +

+

+ cat: ,nonexistent_file: No such file or directory +

+

+ END +

+ +
+ + + + + + + + + + + + + + + +

+ TEST Filesystem manipulations: FileSupport_test .. FAILED +

+

+ unexpected return value 5, expected 0 +

+

+ stderr was: +

+

+ 0000000514: INFO: suite.cpp:193: thread_1: invokeTestCase: ++------------------- invoking TEST: stat::test::FileSupport_test +

+

+ *** Test Failure «stat::test::FileSupport_test» +

+

+ ***            : LUMIERA_ERROR_CONFIG:misconfiguration (Program environment doesn't define $HOME (Unix home directory).). +

+

+ 0000000515: ERR: suite.cpp:202: thread_1: invokeTestCase: Error state (null) +

+

+ 0000000516: WARNING: suite.cpp:203: thread_1: invokeTestCase: Caught exception LUMIERA_ERROR_CONFIG:misconfiguration (Program environment doesn't define $HOME (Unix home directory).). +

+

+ END +

+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Record.hpp, 289 +

+
+
+

+ /** +

+

+ * copy-initialise (or convert) from the given Mutator instance. +

+

+ * @remarks need to code this explicitly, otherwise Record's +

+

+ * build-from sequence templated ctor would kick in. +

+

+ * @warning beware of initialiser lists. Record has a dedicated +

+

+ * ctor to accept an initialiser list of GenNode elements, +

+

+ * and GenNode's ctor is deliberately _not explicit,_ to ease +

+

+ * building argument lists wrapped in GenNodes. When writing +

+

+ * initialisation expressions inline, the compiler might pick +

+

+ * the conversion path through initialiser list, which means +

+

+ * the contents of the Mutator end up wrapped into a GenNode, +

+

+ * which in turn becomes the only child of the new Record. +

+

+ */ +

+

+ Record (Mutator const&  mut) +

+

+ : Record((Record const&)  mut) +

+

+ { } +

+

+ +

+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +

+ ...zumindest würde ich das aus dem Kontext und dem Kommentar darüber so deuten +

+
+
+

+ * After performing +

+

+ * the desired changes, the altered copy can either +

+

+ * be sliced out (by conversion), or moved overwriting +

+

+ * an existing other Record instance (implemented as swap) +

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ ...und nicht über einen Umweg; ich bin ja mit dem Debugger durchgesteppt. Obwohl theoretisch der getemplatete Konstruktor gepaßt hätte, war nichts von zwei Iterationen über Attribute und Kinder zu sehen. Und mehr noch: wie würden wir wieder zu einem Mutator-Typ kommen, mit dem wir wieder in den selben Konstruktor einsteigen +

+ +
+
+ + + + + + + + + + + + + + + + + +

+ die allesamt noch gar nicht initialisiert sind +

+ +
+
+
+ + + + + + +

+ dann scheitert die Compilation an anderer Stelle, nämlich an der Initialisierung einer Referenz Rec& root = target. Aber generic-record-test.cpp compiliert ohne Fehler +

+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -161545,6 +161937,237 @@ Since then others have made contributions, see the log for the history. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
   1 import sys
+   2 
+   3 try:
+   4     untrusted.execute()
+   5 except:  # catch *all* exceptions
+   6     e = sys.exc_info()[0]
+   7     write_to_page("<p>Error: %s</p>" % e)
+ +
+
+
+
+ + + + + + + +

+ das ist Python-uralt() +

+ +
+ +
+ + + + + +

+ bzw allgemein fn(*arg,**kw) +

+ +
+
+
+ + + + + + +

+ hiv@flaucher:~/devel/doku/LumiWeb$ ./menugen.py -p -s -w >menu.html.tmp +

+

+ --WARNING--   DSL-method "discover" not applicable for Node(root) +

+

+ --WARNING--   DSL-method "discover" not applicable for Node(documentation) +

+

+ --WARNING--   DSL-method "discover" not applicable for Node(documentation) +

+

+ --WARNING--   DSL-method "link" not applicable for Node(documentation) +

+

+ --WARNING--   DSL-method "link" not applicable for Node(project) +

+

+ --WARNING--   DSL-method "link" not applicable for Node(devs-vault) +

+

+ --WARNING--   DSL-method "link" not applicable for Node(devs-vault) +

+

+ --WARNING--   DSL-method "sortChildren" not applicable for Node(news) +

+

+ Traceback (most recent call last): +

+

+   File "/Werk/devel/doku/LumiWeb/./menugen.py", line 1183, in <module> +

+

+     parseAndDo() +

+

+     ~~~~~~~~~~^^ +

+

+   File "/Werk/devel/doku/LumiWeb/./menugen.py", line 141, in parseAndDo +

+

+     addPredefined() +

+

+     ~~~~~~~~~~~~~^^ +

+

+   File "/Werk/devel/doku/LumiWeb/./menugen.py", line 102, in addPredefined +

+

+     .putChildLast('old_news') +

+

+      ^^^^^^^^^^^^ +

+ +
+ + + + + + + + + + + + + + + +

+ er ist nämlich wirklich point-and-shot geschrieben, in etwa zwei Tagen, und das merkt man +

+ +
+
+ + + + +
    +
  • + er verwendet sehr viel Funktoren +
  • +
  • + einige dieser sind auch als Klassen definiert, mit Polymorphismus +
  • +
  • + jede beshandelte Resource wird in ein Node-Objekt transformiert +
  • +
  • + Processing-Instructions (entweder vom Scannen, oder in den predefined() elements) werden in Placement-Objekte übersetzt +
  • +
  • + Placement-Objekte sind selber Funktoren, die in einer Kette angewendet werden (ja das ist das gleiche Konzept wie in Lumiera selber) +
  • +
  • + es gibt nur eine fest konfigurierte Liste möglicher Placements +
  • +
  • + und hier verwenden wir committed choice,  d.h. das erste Placement, das die DSL-Spec oder die processing-Instruction parsen kann, wird angewendet, und kann den aktuellen Discovery-status manipulieren +
  • +
  • + das ist ein flexibles Baukastensystem, mit dem man direkt im Discovery-Prozeß eingreifen kann und bestimmen kann, was mit der aktuellen Node passiert und was als ihre Kinder rekursiv verarbeitet wird +
  • +
+

+ Am Ende haben wir einen DAG aus Node-Objekten, die wir traversiern und rendern +

+ +
+
+ + + + +

+ ...immer da, wo ich selber "woot?" sage; es genügt, Variable und Funktionen klarer zu benennen +

+ +
+ +
+
+ + + +
+ + + +
+ + + + + +
+