-
Bug
-
Resolution: Done-Errata
-
Normal
-
rhel-7.9.z, rhel-8.8.0, rhel-9.3.0
-
ksh-20120801-265.el8
-
None
-
Moderate
-
sst_cs_plumbers
-
ssg_core_services
-
26
-
5
-
False
-
-
None
-
None
-
Pass
-
Automated
-
If docs needed, set a value
-
-
All
-
None
It will also fail the rename in the chunk:
src/cmd/ksh93/edit/history.c
"""
unlink(hist_old->histname);
if(access(hist_old->histname,F_OK) >= 0)
{
/* The unlink can fail on windows 95 */
int fd;
char *last, *name=hist_old->histname;
close(sffileno(hist_old->histfp));
tmpname = (char*)malloc(strlen(name)+14);
if(last = strrchr(name,'/'))
else
pathtmp(tmpname,".","hist",NIL(int*));
if(rename(name,tmpname) < 0)
fd = open(tmpname,O_RDONLY);
sfsetfd(hist_old->histfp,fd);
if(tmpname==name)
tmpname = 0;
}
hist_ptr = 0;
if(fstat(sffileno(hist_old->histfp),&statb)>=0)
"""
Another condition required is to have a full .sh_history.
This will cause sh_histinit to call hist_trim, that will
again call sh_histinit.
On the backtrace, the condition is verified in the statb
local variable of hist_trim, where the call trace shows that
the unlink and rename syscalls failed.
The unlink call may fail due to a stale file or some filesystem
issue. The rename call will fail if tmpname is on another filesystem;
could be nfs vs local filesystem or local filesystem and a tmpfs /tmp.
The issue only happens if the unlink fails, but still, could use
a smarter or fallback approach to not cause the stack overflow crash.