If I run shells/pdksh on FreeBSD 13.0-RELEASE-p3 on an amd64, and type ((--)) then ksh gets a segmentation fault.
The problem is that v_evaluate() in expr.c doesn't initialize curstate.val, and token() doesn't set es->val when given this particular input.
Hi Robert, Thanks for the report. I try to reproduce the behavior in my environment (FreeBSD 12 amd64) and pdksh doesn't crash. I only got an error message : "ksh: --: -- requires lvalue" Do you use project packages ? latest or quarterly branch ? If do, can you made a sum of the pdksh binary, just to be sure I'm testing with the right environment. If you build your own packages, can you provide more details about your setup. All the best -- Rodrigo
(In reply to Rodrigo Osorio from comment #2) I get this crash whether I use the pkg or /usr/ports. When I install with pkg, it says: New packages to be INSTALLED: pdksh: 5.2.14p2_6 Here's the checksum &c of the binary: % sum /usr/local/bin/ksh 13590 279 /usr/local/bin/ksh % ls -l /usr/local/bin/ksh -r-xr-xr-x 1 root wheel 285096 Jul 1 15:24 /usr/local/bin/ksh $ echo $KSH_VERSION @(#)PD KSH v5.2.14.2 99/07/13.2 % uname -a FreeBSD xxx 13.0-RELEASE-p3 FreeBSD 13.0-RELEASE-p3 #0: Tue Jun 29 19:46:20 UTC 2021 root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 % echo '((--' | ksh Segmentation fault I see the same bug when compiling from /usr/ports, but I do not know how to find out what version of ports I'm using. If you tell me what to do, I'll do it. As far as I know there's nothing special about my setup.
(In reply to Robert Morris from comment #3) Thanks for the details, with the command line you provide I can reproduce the issue. I move the issue to the open state.