Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'kill %%' and 'kill %+' segfault #34

Closed
McDutchie opened this issue Jun 22, 2020 · 0 comments
Closed

'kill %%' and 'kill %+' segfault #34

McDutchie opened this issue Jun 22, 2020 · 0 comments
Labels
bug Something is not working

Comments

@McDutchie
Copy link

McDutchie commented Jun 22, 2020

Any reference to the current job (%% or %+) before there is one, passed to the kill command, currently causes a segfault. This is also the case in the 93u+ 2012-08-01 release. For example:

$ ksh -c 'kill -s STOP %%; echo exit status $?'
Segmentation fault: 11

Backtrace from lldb:

* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x000000010ff80944 ksh`job_kill + 20
    frame #1: 0x000000010ff80809 ksh`job_walk + 309
    frame #2: 0x000000010ff5856d ksh`b_kill + 806
    frame #3: 0x000000010ffab18b ksh`sh_exec + 16128
    frame #4: 0x000000010ff5f48b ksh`exfile + 3243
    frame #5: 0x000000010ff60387 ksh`sh_main + 3367
    frame #6: 0x00007fff5832b3d5 libdyld.dylib`start + 1

edit: Same happens when using %- to refer to the previous job before there is one.

@McDutchie McDutchie added the bug Something is not working label Jun 22, 2020
JohnoKing added a commit to JohnoKing/ksh that referenced this issue Jun 22, 2020
Ksh was trying to use the `pw` variable as a valid pointer even
when it was NULL. This is fixed by doing the error check for
`pw` before doing anything else in `job_kill`.

This bugfix is from Red Hat:
https://git.centos.org/rpms/ksh/blob/44e0a643a93492b1f6beebbf6ffcfd453d9ab8f2/f/SOURCES/ksh-20130214-fixkill.patch

Fixes ksh93#34
McDutchie pushed a commit that referenced this issue Jun 22, 2020
Ksh was trying to use the 'pw' variable as a valid pointer even
when it was NULL. This is fixed by doing the error check for
'pw' before doing anything else in 'job_kill'.

This bugfix is from Red Hat:
https://git.centos.org/rpms/ksh/blob/44e0a643a93492b1f6beebbf6ffcfd453d9ab8f2/f/SOURCES/ksh-20130214-fixkill.patch

Fixes #34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

1 participant