This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: dodgy chere (aka cygwin prompt here) feature

Am in the process of adding functionality.

I have a shiny new feature working locally:
Context Menu item checks /etc/passwd for the preferred shell of the current
user, and starts that as a login shell using the specified term.

At the moment it has some quite horrible quoting going on, and I'm trying to
shoehorn in another exec.

Does anyone think this is a useful feature? Or is this going to be a nightmare
to support across multiple platforms?

The essential command line ignoring (most) quoting issues would be something

[term cmd] /bin/sh -c "scmd=`sed -n \"s?$USERNAME:.*:\(.*\)?\1?gp\"
/etc/passwd`; exec \"$scmd -l -c \"cd '%1'; exec $scmd\"\"\""

Possible issues:
1. I'm guessing USERNAME is windows specific and may not be available on 9x.
Could use id -un at the expense of more quoting/variables. Is $USER available in
a non-login sh? 
2. When creating the key, I check /etc/passwd is present. But what if something
nasty happens to it? Will it always be readable?
3. Should we care if someones passwd says user:...:/bin/rm -f *; ?

Comments appreciated.


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]