Re: qcad does not segfault when qtscript is compiled with -O0.

2023-12-26 Thread Andy Bradford
Thus said Stuart Henderson on Tue, 26 Dec 2023 23:25:42 +:

> This was already diagnosed and fixed in -current, see
> https://marc.info/?l=openbsd-ports&m=170160684730438&w=2

Indeed it was. While I do follow  ports@ I must not have noticed because
I only recently discovered the association with qtscript and -O0 today.

Thanks for the response.

Andy



Re: qcad does not segfault when qtscript is compiled with -O0.

2023-12-26 Thread Stuart Henderson
This was already diagnosed and fixed in -current, see
https://marc.info/?l=openbsd-ports&m=170160684730438&w=2
https://github.com/openbsd/ports/blob/e10f7e1a39f85873183c232462850449f777e16f/x11/qt5/qtscript/patches/patch-src_3rdparty_javascriptcore_JavaScriptCore_interpreter_CallFrame_h

On 2023-12-26, Andy Bradford 
 wrote:
> Hello,
>
> A  little  over a  year  ago  I  reported[1]  that qcad  started  having
> segfaults in 7.0  (or 7.1). I thought  I would try to debug  it today in
> 7.4 and  so enabled DEBUG_PACKAGES  and DEBUG variables in  the cad/qcad
> Makefile  and also  the x11/qt5/qtscript  Makefile hoping  to debug  the
> segfault. In the Makefile for both I set:
>
> DEBUG_PACKAGES=   ${BUILD_PACKAGES}
> DEBUG=-O0 -g
>
> Then I built  the packages, installed them and their  debug packages and
> hoped to capture  a segfault, but it doesn't  crash. Apparently enabling
> -O0 in qtscript's Makefile makes it  not crash. To test that hypothesis,
> I commented out the DEBUG line completely and rebuilt qtscript with just
> the  defaults  that  DEBUG_PACKAGES  inherits  and  sure  enough,  after
> installing that qtscript package built with -O2 qcad again crashes.
>
> (gdb) bt
> #0  0x03eae2f9a990 in QScriptEnginePrivate::mark (this=0x3eb4af54a80, 
> markStack=...) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:1320
> #1  0x03eae2f14d6c in QTJSC::Heap::markRoots (this=0x3ea8c2129e8) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:1167
> #2  0x03eae2f13ac5 in QTJSC::Heap::reset (this=0x3ea8c2129e8) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:1269
> #3  QTJSC::Heap::allocate (this=0x3ea8c2129e8, s=) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:405
> #4  0x03eae2fa3ac2 in QTJSC::JSCell::operator new (size=56, 
> exec=) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.h:167
> #5  QScriptEnginePrivate::newVariant (this=0x3eb4af54a80, value=...) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:1797
> #6  0x03eae2fa51b5 in QScriptEngine::newVariant (this=, 
> value=...) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:2233
> #7  0x03eade54f63f in qtscript_create_Qt_Axis_class 
> (engine=0x3eaf5f91770, clazz=...) at 
> ../../generated_cpp/com_trolltech_qt_core/qtscript_Qt.cpp:4157
> #8  0x03eade5445ee in qtscript_create_Qt_class (engine=0x3eaf5f91770) at 
> ../../generated_cpp/com_trolltech_qt_core/qtscript_Qt.cpp:8386
> #9  0x03eade62a327 in qtscript_initialize_com_trolltech_qt_core_bindings 
> (extensionObject=...) at 
> ../../generated_cpp/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp:312
> #10 0x03eade3a1d9e in com_trolltech_qt_core_ScriptPlugin::initialize 
> (this=0x3eabb1f6100, key=..., engine=0x3eaf5f91770) at plugin.cpp:21
> #11 0x03eae2fabdf9 in QScriptEngine::importExtension (this=0x3eaf5f91770, 
> extension=...) at 
> /usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:3769
> #12 0x03ea8abc35ab in RScriptHandlerEcma::RScriptHandlerEcma 
> (this=0x3eabb1e94e0) at RScriptHandlerEcma.cpp:434
> #13 0x03ea8abd4919 in RScriptHandlerEcma::factory () at 
> RScriptHandlerEcma.cpp:1074
> #14 0x03ead8eb2c3e in RScriptHandlerRegistry::createScriptHandler 
> (extension=...) at RScriptHandlerRegistry.cpp:67
> #15 0x03ead8eb2caf in RScriptHandlerRegistry::getGlobalScriptHandler 
> (extension=...) at RScriptHandlerRegistry.cpp:76
> #16 0x03e87ec05021 in main (argc=1, argv=0x7b524ae78618) at main.cpp:389
> (gdb) list
> 1315}
> 1316
> 1317if (q) {
> 1318QScriptContext *context = q->currentContext();
> 1319
> 1320while (context) {
> 1321JSC::ScopeChainNode *node = 
> frameForContext(context)->scopeChain();
> 1322JSC::ScopeChainIterator it(node);
> 1323for (it = node->begin(); it != node->end(); ++it) {
> 1324JSC::JSObject *object = *it;
>
> Stepping through with -O2, it seems to go through one or two iterations of a 
> while loop and then crashes:
>
> (gdb) print context
> $8 = (QScriptContext *) 0xf0800cd3288
> (gdb) print *context
> $9 = {d_ptr = 0x1}
> (gdb) next
> 1323for (it = node->begin(); it != node->end(); ++it) {
> (gdb) 
> 1324JSC::JSObject *object = *it;
> (gdb) 
> 1325if (object)
> (gdb) 
> 1326markStack.append(object);
> (gdb) 
> 1323  

qcad does not segfault when qtscript is compiled with -O0.

2023-12-26 Thread Andy Bradford
Hello,

A  little  over a  year  ago  I  reported[1]  that qcad  started  having
segfaults in 7.0  (or 7.1). I thought  I would try to debug  it today in
7.4 and  so enabled DEBUG_PACKAGES  and DEBUG variables in  the cad/qcad
Makefile  and also  the x11/qt5/qtscript  Makefile hoping  to debug  the
segfault. In the Makefile for both I set:

DEBUG_PACKAGES= ${BUILD_PACKAGES}
DEBUG=  -O0 -g

Then I built  the packages, installed them and their  debug packages and
hoped to capture  a segfault, but it doesn't  crash. Apparently enabling
-O0 in qtscript's Makefile makes it  not crash. To test that hypothesis,
I commented out the DEBUG line completely and rebuilt qtscript with just
the  defaults  that  DEBUG_PACKAGES  inherits  and  sure  enough,  after
installing that qtscript package built with -O2 qcad again crashes.

(gdb) bt
#0  0x03eae2f9a990 in QScriptEnginePrivate::mark (this=0x3eb4af54a80, 
markStack=...) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:1320
#1  0x03eae2f14d6c in QTJSC::Heap::markRoots (this=0x3ea8c2129e8) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:1167
#2  0x03eae2f13ac5 in QTJSC::Heap::reset (this=0x3ea8c2129e8) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:1269
#3  QTJSC::Heap::allocate (this=0x3ea8c2129e8, s=) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:405
#4  0x03eae2fa3ac2 in QTJSC::JSCell::operator new (size=56, exec=) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.h:167
#5  QScriptEnginePrivate::newVariant (this=0x3eb4af54a80, value=...) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:1797
#6  0x03eae2fa51b5 in QScriptEngine::newVariant (this=, 
value=...) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:2233
#7  0x03eade54f63f in qtscript_create_Qt_Axis_class (engine=0x3eaf5f91770, 
clazz=...) at ../../generated_cpp/com_trolltech_qt_core/qtscript_Qt.cpp:4157
#8  0x03eade5445ee in qtscript_create_Qt_class (engine=0x3eaf5f91770) at 
../../generated_cpp/com_trolltech_qt_core/qtscript_Qt.cpp:8386
#9  0x03eade62a327 in qtscript_initialize_com_trolltech_qt_core_bindings 
(extensionObject=...) at 
../../generated_cpp/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp:312
#10 0x03eade3a1d9e in com_trolltech_qt_core_ScriptPlugin::initialize 
(this=0x3eabb1f6100, key=..., engine=0x3eaf5f91770) at plugin.cpp:21
#11 0x03eae2fabdf9 in QScriptEngine::importExtension (this=0x3eaf5f91770, 
extension=...) at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:3769
#12 0x03ea8abc35ab in RScriptHandlerEcma::RScriptHandlerEcma 
(this=0x3eabb1e94e0) at RScriptHandlerEcma.cpp:434
#13 0x03ea8abd4919 in RScriptHandlerEcma::factory () at 
RScriptHandlerEcma.cpp:1074
#14 0x03ead8eb2c3e in RScriptHandlerRegistry::createScriptHandler 
(extension=...) at RScriptHandlerRegistry.cpp:67
#15 0x03ead8eb2caf in RScriptHandlerRegistry::getGlobalScriptHandler 
(extension=...) at RScriptHandlerRegistry.cpp:76
#16 0x03e87ec05021 in main (argc=1, argv=0x7b524ae78618) at main.cpp:389
(gdb) list
1315}
1316
1317if (q) {
1318QScriptContext *context = q->currentContext();
1319
1320while (context) {
1321JSC::ScopeChainNode *node = 
frameForContext(context)->scopeChain();
1322JSC::ScopeChainIterator it(node);
1323for (it = node->begin(); it != node->end(); ++it) {
1324JSC::JSObject *object = *it;

Stepping through with -O2, it seems to go through one or two iterations of a 
while loop and then crashes:

(gdb) print context
$8 = (QScriptContext *) 0xf0800cd3288
(gdb) print *context
$9 = {d_ptr = 0x1}
(gdb) next
1323for (it = node->begin(); it != node->end(); ++it) {
(gdb) 
1324JSC::JSObject *object = *it;
(gdb) 
1325if (object)
(gdb) 
1326markStack.append(object);
(gdb) 
1323for (it = node->begin(); it != node->end(); ++it) {
(gdb) 
1329context = context->parentContext();
(gdb) 
1320while (context) {
(gdb) print context
$10 = (QScriptContext *) 0x1
(gdb) next

Thread 1 received signal SIGSEGV, Segmentation fault.
0x0f07f754b990 in QScriptEnginePrivate::mark (this=0xf079205c480, 
markStack=...)
at 
/usr/ports/pobj/qtscript-5.15.10/qtscript-everywhere-src-5.15.10/src/script/api/qscriptengine.cpp:1320
1320while (co

Re: self-hosted man.openbsd.org script?

2023-12-26 Thread Ingo Schwarze
Hi Paul,

Paul Pace wrote on Sun, Dec 24, 2023 at 05:25:55AM -0800:

> I have this vague memory of reading someone who posted a script, IIRC, 
> to convert the system's man pages to HTML, or similar, into somewhere 
> under /var/www and the pages worked just like the highly useful 
> man.openbsd.org, and not like the plain text pages that everyone always 
> posts to their websites.
> 
> Does someone happen to know where that is?

I don't know about any such "script" and believe using a script for it
would be a bad idea - a dirty hack at best.

Converting a whole tree of manual pages to a different format
sounds like the job for the tradition catman(8) utility program
that Christoph Robitschko first implemented in 1993.  NetBSD
and FreeBSD contain implementations by various other authors.

OpenBSD does not contain the catman(8) utility because it is rarely
needed by ordinary users and we tend to only include code in the base
system that is useful for many people.

However, the portable mandoc distribution does contain a version
that i wrote together with Michael Stapelberg (of the Debian project)
in 2017:

  https://mandoc.bsd.lv/
  https://mandoc.bsd.lv/man/catman.8.html

For your purpose, you may want to replace to line

options.fragment = 1;

in mandocd.c by something like

{ char style[] = "/usr/share/misc/mandoc.css";
options.style = style; }

before compiling such that you get complete HTML code including
, , , and  elements.

Be careful to not clobber the system mandoc(1) installation by blindly
running "make install".  Instead, just manually installing the
binary "mandocd" anywhere in the $PATH is enough.  Installing
the "catman" binary in not necessary but won't hurt either.

Also note that viewing the results with a monster browser like
firefox or chrome may require some tweaking with respect to unveil(2),
see the respective files below /usr/local/share/doc/pkg-readmes/.

I freely admit all this is not particularly user-friendly but more
geared towards the needs of server admins.  For example, the
server manpages.debian.org is essentially using something similar
to this method.  For them, it's critical that this implementation
of catman(8) is much more efficient than the NetBSD and FreeBSD
implementations: it saves lots of time because it does *not* fork
and exec a new parser/formatter process for every manual page
but instead merely reinitialized and resuses the same parser and
formatter process over and over again, which is *much* faster.
With the huge amount of manual pages Debian has to format very
often, their server would not be able to keep up without that
optimization.

Yours,
  Ingo



systat mbuf vs. netstat -m

2023-12-26 Thread Chris Cappuccio
In various places, netstat/mbuf.c does stuff like this against the hiwat value:

printf("%u/%lu mbuf %d byte clusters in use"
" (current/peak)\n",
mclpools[i].pr_nout,
(unsigned long)
mclpools[i].pr_hiwat * mclpools[i].pr_itemsperpage,
mclpools[i].pr_size);

for this result:

3/144 mbuf 2048 byte clusters in use (current/peak)
1011/83430 mbuf 2112 byte clusters in use (current/peak)

the hiwat according to systat mbuf is:

IFACERING  LIVELOCKS  SIZE ALIVE   LWM   HWM   CWM
System   mbufs 0   256  23115254
 mcl2k2048 6  18
 mcl2k2   2112  10145562

Is this sensible?



Re: OpenSSH update web page: typo

2023-12-26 Thread Alex Naumov
revision 1.147
date: 2023/12/20 17:30:01;  author: millert;  state: Exp;  lines: +3 -3;
 commitid: nZ6tdVWYkmCCLb6k;
Correct the links in the 9.6 section.
Reported by Christos Zoulas.

Are you guys kidding? :)

On Tue, Dec 19, 2023 at 9:35 AM Alex Naumov 
wrote:

> Hey,
>
> It seems there are two same update manuals for OpenSSH 9.5 and 9.6[1].
> Link to the tarball and the second shell command should be updated.
>
> Cheers,
> Alex
>
> [1] https://www.openssh.com/openbsd.html
>