simh / simh

The Computer History Simulation Project
http://simh.trailing-edge.com
Other
1.67k stars 303 forks source link

Many (all?) simulators crash when "help set" followed by "command" #723

Closed bub7734 closed 5 years ago

bub7734 commented 5 years ago

Many (perhaps all) simulators will crash with a Bus Error under FreeBSD when the "help set" command is issued followed by exactly "command" in response to the follow-on "Commands SET Subtopic?" prompt from the HELP function.


PDP-10 simulator V4.0-0 Current        git commit id: 2840e3b6
sim> help set
PDP-10 help.  Type <CR> to exit, HELP for navigation help
SET

    Additional information available:

    Console                            Remote                         
    Working_Directory                  Log                            
    Debug                              Breakpoints                    
    Throttle                           Clock                          
    Asynch                             Environment                    
    Command_Status_Trap_Dispatching    Command_Execution_Display      
    Command_Error_Status_Display       Command_Output_Display         
    Command_Prompt                     Device_and_Unit                

PDP-10 Commands SET Subtopic? command
Bus error (core dumped)

Version information: (Git pull for this build occurred on 15-jul-2019)

sim> show version
PDP-10 simulator V4.0-0 Current
    Simulator Framework Capabilities:
        64b data
        32b addresses
        Threaded Ethernet Packet transports:PCAP:TAP:NAT:UDP
        Idle/Throttling support is available
        Virtual Hard Disk (VHD) support
        Asynchronous I/O support (Lock free asynchronous event queue)
        Asynchronous Clock support
        FrontPanel API Version 12
    Host Platform:
        Compiler: GCC 8.2.0
        Simulator Compiled as C arch: x64 (Release Build) on Jul 15 2019 at 16:39:32
        Memory Access: Little Endian
        Memory Pointer Size: 64 bits
        Large File (>2GB) support
        SDL Video support: No Video Support
        PCRE RegEx (Version 8.42 2018-03-20) support for EXPECT commands
        OS clock resolution: 1ms
        Time taken by msleep(1): 1ms
        OS: FreeBSD dudley 12.0-RELEASE-p7 FreeBSD 12.0-RELEASE-p7 GENERIC  amd64
        git commit id: 2840e3b6
        git commit time: 2019-07-15T00:04:40-0700

Build information: Simh is being built out-of-the-box with no code changes or makefile adjustments. No build failures

No simulator configuration file is being used when the failure occurs. "Help set" is the first command issued. The failure will happen any time the help sequence is issued.

I've tested a number of simulators, including pdp10, pdp11, hp2100, isys8010. All fail identically. I believe all simulators will fail, and this fault would be in common code rather than sim-specific code.

bub7734 commented 5 years ago

Upon further experimentation, All of the following will cause the segfault in response to the HELP prompt of "Commands SET Subtopic?":

C CO COM COMM COMMA COMMAN COMMAND

Any deviation from those, i.e. "COMMX" or "COMMANDS", will no segfault but simply return the expected message of "Help for COMMX is not available".

markpizz commented 5 years ago

Got it. This doesn't happen on Windows, but it does on Linux. Will fix soon.

bub7734 commented 5 years ago

Thanks, Mark.

And, of course, I see the pattern now. The "additional information available" options shows five options all prefixed with "command_". When issuing an ambiguous match, the segfault occurs. Must be in the code performing matching where multiple matches occur.

markpizz commented 5 years ago

Indeed it was in the code which determines that an ambiguous match occurs.