Skip to content

Commit

Permalink
sh_init(): rm directoryless '.profile' login file path
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
McDutchie committed Jan 8, 2021
1 parent 5d7e00a commit aa7713c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/cmd/ksh93/sh/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]==' ')
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit aa7713c

Please sign in to comment.