Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr

 pwd: /out/package
ppid: 128910
   1: WRITELN sleep 10
   2: CTRL+C
Scan child pids of ppid: 128910
SIGINT
Send signal 2 to pid: 128910
Scan child pids of ppid: 128911
Send signal 2 to pid: 128911
Scan child pids of ppid: 128912
Send signal 2 to pid: 128912
Scan child pids of ppid: 128913
Send signal 2 to pid: 128913
   3: WRITELN echo 123 > 1.txt
   4: WRITELN sleep 10 > 1.txt
   5: CTRL+C
Scan child pids of ppid: 128910
SIGINT
Send signal 2 to pid: 128910
Scan child pids of ppid: 128911
Send signal 2 to pid: 128911
Scan child pids of ppid: 128918
Send signal 2 to pid: 128918
Scan child pids of ppid: 128919
Send signal 2 to pid: 128919
   6: WRITELN cat 1.txt
   7: WRITELN echo success
   8: CTRL+C
Scan child pids of ppid: 128910
SIGINT
Send signal 2 to pid: 128910
Scan child pids of ppid: 128911
Send signal 2 to pid: 128911
Scan child pids of ppid: 128925
Send signal 2 to pid: 128925
   9: WRITELN exit
exit: 1

Hints

Your answer may be identical to the JOJ answer in the first several lines.

However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.

Please double check your code to solve this problem and try again.

Your Answer

mumsh $ 
mumsh $ mumsh $ 
mumsh $ mumsh $ success
mumsh $ /in/read.c:31:29: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /in/read.c:31:29 in 
=================================================================
==128911==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x619000001d82 at pc 0x000000517b62 bp 0x7ffc36f51070 sp 0x7ffc36f51068
READ of size 1 at 0x619000001d82 thread T0
    #0 0x517b61  (/out/package/mumsh_memory_check+0x517b61)
    #1 0x5159f9  (/out/package/mumsh_memory_check+0x5159f9)
    #2 0x7fad57b58b96  (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #3 0x41d1e9  (/out/package/mumsh_memory_check+0x41d1e9)

0x619000001d82 is located 0 bytes to the right of 1026-byte region [0x619000001980,0x619000001d82)
allocated by thread T0 here:
    #0 0x4dd0a0  (/out/package/mumsh_memory_check+0x4dd0a0)
    #1 0x5177a9  (/out/package/mumsh_memory_check+0x5177a9)
    #2 0x5159f9  (/out/package/mums

JOJ Answer

mumsh $ 
mumsh $ mumsh $ 
mumsh $ mumsh $ success
mumsh $ 
mumsh $ exit