1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

sh_init(): rm directoryless '.profile' login file path

This applies a patch from Solaris:
https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/160-CR7175995.patch

There is no public information on why it's needed, but it seems
sensible on the face of it. Using a file called '.profile' in the
PWD on login, without a directory path, is redundant at best, since
"$HOME/.profile" (e_profile, see data/msg.c) is already used. And
if the PWD is not $HOME at login time, it seems to me there are
serious problems and the last thing you want is to read some
random and probably dodgy '.profile' from the PWD.

src/cmd/ksh93/sh/init.c: sh_init(): login_files[]:
- Remove redundant/problematic ".profile" entry.
This commit is contained in:
Martijn Dekker 2021-01-08 23:53:04 +00:00
parent 5d7e00a109
commit aa7713c2a9

View file

@ -1178,7 +1178,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
register int n;
int type;
char *save_envmarker;
static char *login_files[3];
static char *login_files[2];
memfatal();
n = strlen(e_version);
if(e_version[n-1]=='$' && e_version[n-2]==' ')
@ -1450,7 +1450,6 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
shp->topscope = (Shscope_t*)shp->st.self;
sh_offstate(SH_INIT);
login_files[0] = (char*)e_profile;
login_files[1] = ".profile";
shp->gd->login_files = login_files;
shp->bltindata.version = SH_VERSION;
shp->bltindata.shp = shp;