HTTP/2 200
date: Thu, 31 Jul 2025 12:50:42 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/ksh93/ksh.git
etag: W/"4c9feb37ef8df45f82e9e98174b8bd07"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=zbbzJ1FuC5c0fshMUT1G1Jdn755NAbvU8bz9IcDNcw0wQhBN8EuLRuln9cMpg%2FaxLzJmLBXpsXRnJ1l1oVPXlQPNe6iJljMyVz1cODCb4lPOoN7ngjckqwLsW9S5vGfhWm5ppEnJZyEUoG%2BSd0UMmAL%2FDCkv5GWCfOkPeB85%2BnHS%2FQyhTfRqz2woqDN7Xp3azNbRaZjsh%2BoHz%2BEUVTFa2hoLBnZ3nq3dJ7BwB1szNDnjb7V3lZK6sForGFxzn6EnCRIxO9HbWjNjn8fbL3DN5g%3D%3D--8RV4eyN1euwQDllU--waUhLC4cs75NIlZw527Ejg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1634454451.1753966240; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 12:50:40 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 12:50:40 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: A376:5A781:4090C6:47F2C6:688B66A0
Fix crash upon running many subshells (#113) · ksh93/ksh@05ac1db · GitHub
File tree Expand file tree Collapse file tree 13 files changed +25
-17
lines changed Expand file tree Collapse file tree 13 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ For full details, see the git log at: https://github.com/ksh93/ksh
3
3
4
4
Any uppercase BUG_* names are modernish shell bug IDs.
5
5
6
+ 2020-08-11:
7
+
8
+ - Fixed an intermittent crash upon running a large number of subshells.
9
+
6
10
2020-08-10:
7
11
8
12
- A number of fixes have been applied to the printf formatting directives
Original file line number Diff line number Diff line change @@ -167,8 +167,8 @@ struct shared
167
167
Namval_t * prev_table ; /* previous table used in nv_open */ \
168
168
Sfio_t * outpool ; /* output stream pool */ \
169
169
long timeout ; /* read timeout */ \
170
- short curenv ; /* current subshell number */ \
171
- short jobenv ; /* subshell number for jobs */ \
170
+ unsigned int curenv ; /* current subshell number */ \
171
+ unsigned int jobenv ; /* subshell number for jobs */ \
172
172
int infd ; /* input file descriptor */ \
173
173
short nextprompt ; /* next prompt is PS<nextprompt> */ \
174
174
short poolfiles ; \
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ struct process
68
68
unsigned short p_exit ; /* exit value or signal number */
69
69
unsigned short p_exitmin ; /* minimum exit value for xargs */
70
70
unsigned short p_flag ; /* flags - see below */
71
- int p_env ; /* subshell environment number */
71
+ unsigned int p_env ; /* subshell environment number */
72
72
#ifdef JOBS
73
73
off_t p_name ; /* history file offset for command */
74
74
struct termios p_stty ; /* terminal state for job */
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ struct Namfun
75
75
{
76
76
const Namdisc_t * disc ;
77
77
char nofree ;
78
- unsigned char subshell ;
78
+ unsigned int subshell ;
79
79
uint32_t dsize ;
80
80
Namfun_t * next ;
81
81
char * last ;
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ struct Shell_s
143
143
int exitval ; /* most recent exit value */
144
144
unsigned char trapnote ; /* set when trap/signal is pending */
145
145
char shcomp ; /* set when running shcomp */
146
- short subshell ; /* set for virtual subshell */
146
+ unsigned int subshell ; /* set for virtual subshell */
147
147
#ifdef _SH_PRIVATE
148
148
_SH_PRIVATE
149
149
#endif /* _SH_PRIVATE */
Original file line number Diff line number Diff line change 17
17
* David Korn <dgk@research.att.com> *
18
18
* *
19
19
***********************************************************************/
20
- #define SH_RELEASE "93u+m 2020-08-10 "
20
+ #define SH_RELEASE "93u+m 2020-08-11 "
Original file line number Diff line number Diff line change @@ -748,7 +748,8 @@ void sh_setmatch(Shell_t *shp,const char *v, int vsize, int nmatch, regoff_t mat
748
748
{
749
749
struct match * mp = & ip -> SH_MATCH_init ;
750
750
Namval_t * np = nv_namptr (mp -> node ,0 );
751
- register int i ,n ,x , savesub = shp -> subshell ;
751
+ register int i ,n ,x ;
752
+ unsigned int savesub = shp -> subshell ;
752
753
Namarr_t * ap = nv_arrayptr (SH_MATCHNOD );
753
754
shp -> subshell = 0 ;
754
755
#ifndef SHOPT_2DMATCH
Original file line number Diff line number Diff line change @@ -1647,7 +1647,7 @@ static struct process *job_unpost(register struct process *pwtop,int notify)
1647
1647
register struct process * pw ;
1648
1648
/* make sure all processes are done */
1649
1649
#ifdef DEBUG
1650
- sfprintf (sfstderr ,"ksh: job line %4d: drop pid=%d critical=%d pid=%d env=%d \n" ,__LINE__ ,getpid (),job .in_critical ,pwtop -> p_pid ,pwtop -> p_env );
1650
+ sfprintf (sfstderr ,"ksh: job line %4d: drop pid=%d critical=%d pid=%d env=%u \n" ,__LINE__ ,getpid (),job .in_critical ,pwtop -> p_pid ,pwtop -> p_env );
1651
1651
sfsync (sfstderr );
1652
1652
#endif /* DEBUG */
1653
1653
pwtop = pw = job_byjid ((int )pwtop -> p_job );
Original file line number Diff line number Diff line change @@ -2716,6 +2716,7 @@ static char *sh_tilde(Shell_t *shp,register const char *string)
2716
2716
register int c ;
2717
2717
register struct passwd * pw ;
2718
2718
register Namval_t * np = 0 ;
2719
+ unsigned int save ;
2719
2720
static Dt_t * logins_tree ;
2720
2721
if (* string ++ != '~' )
2721
2722
return (NIL (char * )) ;
@@ -2771,10 +2772,10 @@ static char *sh_tilde(Shell_t *shp,register const char *string)
2771
2772
logins_tree = dtopen (& _Nvdisc ,Dtbag );
2772
2773
if (np = nv_search (string ,logins_tree ,NV_ADD ))
2773
2774
{
2774
- c = shp -> subshell ;
2775
+ save = shp -> subshell ;
2775
2776
shp -> subshell = 0 ;
2776
2777
nv_putval (np , pw -> pw_dir ,0 );
2777
- shp -> subshell = c ;
2778
+ shp -> subshell = save ;
2778
2779
}
2779
2780
return (pw -> pw_dir );
2780
2781
}
Original file line number Diff line number Diff line change @@ -2464,7 +2464,7 @@ static void table_unset(Shell_t *shp, register Dt_t *root, int flags, Dt_t *oroo
2464
2464
{
2465
2465
if (nv_cover (nq ))
2466
2466
{
2467
- int subshell = shp -> subshell ;
2467
+ unsigned int subshell = shp -> subshell ;
2468
2468
shp -> subshell = 0 ;
2469
2469
if (nv_isattr (nq , NV_INTEGER ))
2470
2470
{
You can’t perform that action at this time.
0 commit comments