This is the mail archive of the cygwin@cygwin.com 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]

RE: Various shell problems


> From: Dr.D.J.Picton

Hi :)

Thanks for the feedback,

> 1.  I downloaded the new version of base-files (2.0-2) today.  I
> note that the
> new config files now go into the /etc/defaults directory, which is a good
> idea!

Been that way for a while... but thanks for noticing :)

> Although it does have one disadvantage - if there are problems in
> the new files, many existing users won't see them.

Problems in the new files?  The only point of putting them in
/etc/defaults was so any customisations weren't overwritten.

> Unfortunately, I did notice problems with /etc/profile:
>
>    Firstly, it sets
>    stty erase ^?
>
>    In my view the correct setting is definitely ^h (backspace).

*GRIN* before we get into this discussion, I'd like to note
the "in my view" :)

To quote:

"Both keys essentially do the same thing, with one major
difference. The backspace key deletes to the left of the
cursor, and the delete key deletes to the right of the cursor.

For instance if I had the word "trick" on my screen, with
the cursor between the "i" and the "c" and pushed delete, I
would end up with "trik." Conversely, if I hit backspace,
the screen would read "trck.""

Which is the same functionality I get when I run a Windows
command prompt (w2k).

>    Setting the erase character to ^? (delete) causes problems
>    when 'normal' terminal i/o is used.

What's a 'normal' terminal?  Do you mean the one you start from
the cygwin shortcut?  If so, it works for me; what version of bash
are you running? (it only gets set for bash atm)  I'm using:

bash --version
GNU bash, version 2.05b.0(9)-release (i686-pc-cygwin)

>    The delete key doesn't seem to work in a Windows command
>    window,

"Doctor, doctor, it hurts when I do this..."
Sorry, bad joke.  In my view, cygwin shouldn't really be used in
a Windows command window, but, starting a cmd entering bash, again
all appears well here...

>    and a resource (deleteIsDel) has to be set to make it
>    work in an xterm window.

It works for my xterm.  To get this set, you need to talk to
the folks developing X, it's out of my control I believe.

>    Secondly, the section which checks whether the user's passwd entry has
>    been set up uses nonstandard operators (==) which aren't supported by
>    all sh-like shells.  This is what happens when profile is
> sourced by /bin/sh:
>    [: ==: unknown operand
>    I changed == to =, and now all is well.

Am changing this to a case statement, thanks for spotting.

> 2.  SHELL environment variable problem.
>    For some reason, the bash shell tends to drop the SHELL
>    variable from the
>    environment, causing a variety of problems.   I fixed this with a new
>    startup script (/etc/bash.bash_env) which issues 'export
>    SHELL', and by contriving  (via the BASH_ENV environment variable and
.bashrc
>    scripts) that all bash shells will use the script.

This one's already been commented on.

> 3. /bin/sh sources /etc/profile when called from ftp.exe
>    If SHELL isn't exported or is set to /bin/sh, ftp.exe uses the /bin/sh
>    shell for shell escapes.  Unfortunately the working directory
>    of the shell is then always set to the user's home directory.  Now I
know
>    why - for some reason, /bin/sh thinks it's a login shell and sources
the profile.>    This bug seems to be specific to ftp - I haven't seen it
with sftp.

<merged content="a reply containing a fix">

> Here is my fix to /etc/profile to circumvent the problem.  All the
> code is skipped if it detects that the profile has already been run,
> and argument zero is set to "-sh":

> At the start of the file:

> # fix for ftp problem ...
> if [ -z "$PROFILE_ALREADY_DONE" -o "$0" != "-sh" ]; then
> export PROFILE_ALREADY_DONE=1
>
> At the end of the file:
>
> fi

</merged>

I don't really want to do this, for a number of reasons;
1) it introduces shell variables soley to work around a bug.  This
   isn't so bad, until somebody writes something which relies on
   this for something else, then it gets removed because the
   original bug has been fixed.
2) not everyone uses ftp (personally, I use ncftp - lots better :)

inetutils (of which ftp is part) is at version 1.4.2 on GNU,
cygwin's ftp is (GNU inetutils) 1.3.2.  Could you try this version
and, if it fixes the bug, lobby to get cygwin updated?

But of cause, it's *your* /etc/profile now, feel free to hack it :)

Thanks again for taking the time,

J.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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