1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Remove unused libcoshell

The coshell(1) command, which is required for libcoshell to be
useful, is not known to be shipped by any distribution. It was
removed by the ksh-community fork and hence also by 93u+m (in
2940b3f5). The coshell facility as a whole is obsolete and
insecure. For a long time now, the statically linked libcoshell
library has been 40+ kilobytes of dead weight in the ksh binary.

Prior discussion (ksh2020): https://github.com/att/ast/issues/619

src/lib/libcoshell/*:
- Removed.

src/cmd/ksh93/*:
- Remove the SHOPT_COSHELL compiler option (which was enabled) and
  a lot of code that was conditional upon #ifdef SHOPT_COSHELL.

- init.c: e_version[]: Removing SHOPT_COSHELL changed the "J"
  feature identifier in ${.sh.version} to a lowercase "j", which
  was conditional upon SHOPT_BGX (background job extensions).
  But src/cmd/ksh93/RELEASE documents (at 08-12-04, on line 1188):
    | +SHOPT_BGX enables background job extensions. Noted by "J" in
    |  the version string when enabled. [...]
  That is the only available documentation. So change that "j" back
  to a "J", leaving the version string unchanged after this commit.

- jobs.c: job_walk(): We need to keep one 'job_waitsafe(SIGCHLD);'
  call that was conditional upon SHOPT_COSHELL; removing it caused
  a regression test failure in tests/sigchld.sh, 'SIGCHLD blocked
  for script at end of pipeline' (which means that until now, a ksh
  compiled without libcoshell had broken SIGCHLD handling.)

bin/package, src/cmd/INIT/package.sh:
- Don't export COSHELL variable.
This commit is contained in:
Martijn Dekker 2020-07-17 17:13:53 +01:00
parent fbc6cd4286
commit 3613da4240
39 changed files with 87 additions and 4635 deletions

View file

@ -317,7 +317,6 @@ inetopen(const char* path, int flags, Inetintr_f onintr, void* handle)
#else
#undef O_SERVICE
#undef SHOPT_COSHELL
#endif
@ -924,57 +923,6 @@ int sh_pipe(register int pv[])
}
#endif
#if SHOPT_COSHELL
int sh_coaccept(Shell_t *shp,int *pv,int out)
{
int fd = accept(pv[0],(struct sockaddr*)0,(socklen_t*)0);
sh_close(pv[0]);
pv[0] = -1;
if(fd<0)
errormsg(SH_DICT,ERROR_system(1),e_pipe);
if((pv[out]=sh_fcntl(fd,F_DUPFD,10)) >=10)
sh_close(fd);
else
pv[out] = sh_iomovefd(fd);
if(fcntl(pv[out],F_SETFD,FD_CLOEXEC) >=0)
shp->fdstatus[pv[out]] |= IOCLEX;
shp->fdstatus[pv[out]] = (out?IOWRITE:IOREAD);
shp->fdstatus[pv[out]] |= IONOSEEK;
sh_subsavefd(pv[out]);
#if defined(SHUT_RD) && defined(SHUT_WR)
shutdown(pv[out],out?SHUT_RD:SHUT_WR);
#endif
return(0);
}
int sh_copipe(Shell_t *shp, int *pv, int out)
{
int r,port=20000;
struct sockaddr_in sin;
socklen_t slen;
if ((pv[out] = socket (AF_INET, SOCK_STREAM, 0)) < 0)
errormsg(SH_DICT,ERROR_system(1),e_pipe);
do
{
sin.sin_family = AF_INET;
sin.sin_port = htons(++port);
sin.sin_addr.s_addr = INADDR_ANY;
slen = sizeof (sin);
}
while ((r=bind (pv[out], (struct sockaddr *) &sin, slen)) == -1 && errno==EADDRINUSE);
if(r<0 || listen(pv[out],5) <0)
{
close(pv[out]);
errormsg(SH_DICT,ERROR_system(1),e_pipe);
}
fcntl(pv[out],F_SETFD,FD_CLOEXEC);
shp->fdstatus[pv[out]] |= IOCLEX;
pv[1-out] = -1;
pv[2] = port;
return(0);
}
#endif /* SHOPT_COSHELL */
static int pat_seek(void *handle, const char *str, size_t sz)
{
char **bp = (char**)handle;
@ -1199,14 +1147,6 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag)
}
errno=0;
np = 0;
#if SHOPT_COSHELL
if(shp->inpool)
{
if(!(iof&(IODOC|IOLSEEK|IOMOV)))
sh_coaddfile(shp,fname);
continue;
}
#endif /* SHOPT_COSHELL */
if(iop->iovname)
{
np = nv_open(iop->iovname,shp->var_tree,NV_NOASSIGN|NV_VARNAME);