-
Notifications
You must be signed in to change notification settings - Fork 154
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
/tmp gets filled up on ksh93 93u+ #1472
Comments
@rphaniram: checkout "ksh-community" in github search soon (it has been created today, so no repos, yet. but ksh93u+ will be there soon) and possibly reopen your issue there in due time. |
@jghub Thanks for the response and info. Shall checkout the new group ksh-community and will look to reopen the issue. |
I could not reproduce this with my FreeBSD ksh93v- but I have checked on Solaris 11.3 and I get the following behaviour:
While it is pretty strange to get that shell code dumped out after pressing Ctrl-C, I press Enter after this is the shell command exists normally. |
Ah, that funny code is my default Solaris
After I reset my PS1 to a simple value, things seem to work good as well:
|
a) you might need to notify @rphaniram explicitly since he closed the issue due to my initial reply. b) you used Version JM 93u 2011-02-08, so that is pre-ksh93u+, no? c) I just verified that on OSX with ksh93u+ 2012-08-01 nothing "special" or strange happens. indeed I just get PS2 (not PS1!) prompts (not their source code ;)) after Ctrl-C until I hit Ctrl-D at which point the shell exits normally. |
@rphaniram |
I think the original issue is about |
yes, but he experienced this when not being able to quit the HERE document (presumably because missing to hit ^D and trying to get out with ^C) and then something went wild, no? my question was, whether he can get out of that situation with ^D (and avoiding ^C, possibly) etc. regarding notification: no regular git(hub) user here, so not sure. I thought it depends on your settings etc. but whatever :) |
Maybe something catches |
Why not? You may use the following dtrace script to dive deeper:
Anyway, step-by-step we get the ksh-community running, and than we'll be happy to work on it in the ksh repository. |
What I mean by "we do not support Solaris" is "we do not really know what code is running as ksh93 on closed source Solaris releases done by Oracle". Of course mainline ksh93 should run and be tested on Solaris as well. |
Basically we know, because Oracle dumps it on its github repos ;-) |
A couple of points: I'm not able to reproduce this on ksh93u nor on ksh2020 on FreeBSD-current. You might want to look at the illumos source, which I think might still be close to Oracle's base. Though I'm not familiar with that part of their tree, I doubt illumos have touched that since Sun open sourced it and it's unlikely Oracle has either. |
The illumos base is far far behind. Oracle's is based on the last stable version, i.e. 2012-08-01 + patches. |
This was first reported in att#1472. Attempting to cancel a heredoc with ^C or ^D can cause ksh to crash with a segfault, or hangup and fill /tmp with files. Copy of the reproducer: $ cat << EOS > <Press Ctrl+C or Ctrl+D> src/cmd/ksh93/sh/main.c: - Reset the lexer state in an interactive shell if here-document creation was cancelled. This patch has been adapted from Solaris: https://github.com/oracle/solaris-userland/blob/e478b48/components/ksh93/patches/400-29444429.patch Due to the nature of this bug, I've skipped adding a regression test as it risks causing pty to hang up if run against an older release of ksh93 (cf. ksh93#356).
…ls (#721) This was first reported in att#1472. Attempting to cancel a heredoc with ^C or ^D can cause ksh to crash with a segfault, or hang up and fill /tmp with files. Copy of the reproducer: $ cat << EOS > <Press Ctrl+C or Ctrl+D> src/cmd/ksh93/sh/main.c: - Reset the lexer state in an interactive shell if here-document creation was cancelled. This patch has been adapted from Solaris: https://github.com/oracle/solaris-userland/blob/e478b48/components/ksh93/patches/400-29444429.patch
…ls (#721) This was first reported in att#1472. Attempting to cancel a heredoc with ^C or ^D can cause ksh to crash with a segfault, or hang up and fill /tmp with files. Copy of the reproducer: $ cat << EOS > <Press Ctrl+C or Ctrl+D> src/cmd/ksh93/sh/main.c: - Reset the lexer state in an interactive shell if here-document creation was cancelled. This patch has been adapted from Solaris: https://github.com/oracle/solaris-userland/blob/e478b48/components/ksh93/patches/400-29444429.patch
On versions of Solaris 10/Solaris 11 that ship with ksh93, the following behavior is observed:
Version of ksh93 on system:
$ ksh --version
version sh (AT&T Research) 93u+ 2012-08-01
The issue:
ksh93 seems to fill up the /tmp filesystem under certain scenarios. when redirection/here-doc operators are involved.
Example:
ksh93 does not seem to handle here-doc correctly in scenario's such as one below: Here's an expected behavior.
$ cat << EOS
But if I think of canceling the here-document by doing Ctrl-C, it's process is not interrupted.
$ cat << EOS
^C^C^C^C^C^C^C^C
Now, the ksh93 cannot be killed with SIGINT although it can be killed with SIGSEGV, SIGBUS, etc. (and of course SIGKILL). And until it's killed, /tmp keeps growing !!!!
/tmp on Solaris being a memory based tempfs filesystem, the above starts to consume a lot of memory.
There have been other scenarios too where the above problem is hit - while migrating ksh88 script to ksh93.
Also, the call stack looks something like below every time we hit the issue:
And, process tree looks like below most times:
AT(live/11V)> proc tree 16522
704 /usr/lib/ssh/sshd
16508 /usr/lib/ssh/sshd -R
16512 /usr/lib/ssh/sshd -R
16513 -bash
16517 su -
16518 -bash
16522 ksh -o vi
16686 less /var/adm/messages.0
16690 ksh
OR
CAT(vmcore.14/11V)> proc tree 10198
1 /usr/sbin/init
10198 ksh
PS: I presume the above is seen with the latest version of ksh93 as well.
The text was updated successfully, but these errors were encountered: