Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

ksh93u+ dumps core when fds >32 #1494

Open
@sowmya573

Description

@sowmya573

I have an application which invokes multiple ksh93 scripts and ,where each script might call other and it goes on... and most of the commands are run in subshell enviroment with pipe.
ex: $(echo "file1 file2 file3" | grep "file1").

So in a particular situation, application is dumping core in sfsync.
After some investigation, I could see that in sh_subtmpfile, "fcntl" call returns fd as "99". But when i tried to print shp->lim.open_max, it shows 32. So it looked like some memory overflow has happened which resulted in coredump.
As per my understanding i feel like in sh_subtmpfile,
(sp->tmpfd = fd = fcntl(1,F_DUPFD,10) ==> here, replacing fcntl() call with sh_fcntl() call would solve the purpose, which will inturn call the sh_iovalidfd, and that takes care of (fd>max) cases.

So my question here is, is there a global #define of fcntl to sh_fcntl which would take care of such cases. Looks like in my envirnonment, fcntl() is not replaced with sh_fcntl. Did i miss anything during compilation. Please suggest.

Note: This is seen on ksh93u+ version, built on AIX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions