On Wed, 2019-03-20 at 12:41 +0000, Ian Abbott wrote:
> On 20/03/2019 09:15, Dold, Wolfram wrote:
> > On Tue, 2019-03-19 at 17:42 +0000, Ian Abbott wrote:
> > > On 19/03/2019 12:33, Dold, Wolfram wrote:
> > > > Hi Ian,
> > > > On Tue, 2019-03-19 at 12:06 +0000, Ian Abbott wrote:
> > > > > On 19/03/2019 09:17, Dold, Wolfram wrote:
> > > > > > Hi there,
> > > > > > when we connect via ssh to our embedded device, the backspace key 
> > > > > > does not work.
> > > > > > During the analysis we found out that the passage
> > > > > > 
> > > > > > # This fixes the backspace when telnetting in.
> > > > > > if [ "$TERM" != "linux" ]; then
> > > > > >            stty erase ^H
> > > > > > fi
> > > > > > 
> > > > > > from the file '/etc/profile' contained in ptxdist.
> > > > > > 
> > > > > > Now I want to ask, how best to fix this behavior?
> > > > > > Can the passage simply be omitted? (At least the comment lets me 
> > > > > > assume that, because there 'telnet' is
> > > > > > mentioned
> > > > > > and
> > > > > > that is no longer necessarily state of the art).
> > > > > > Or does omitting it lead to other unwanted side effects?
> > > > > > 
> > > > > > Any help would be appreciated.
> > > > > > 
> > > > > 
> > > > > Code can interpret input characters in various ways independently of 
> > > > > the
> > > > > stty settings.  For example, if the "Command Line Editing" feature is
> > > > > enabled in the Busybox configuration, the Busybox "ash" and "hush"
> > > > > shells' interactive line editing will handle both ASCII DEL and ASCII 
> > > > > BS
> > > > >     as a "backspace" operation.  This can be enabled in the PTXdist
> > > > > menuconfig via:
> > > > > 
> > > > > Shell & Console Tools --->
> > > > >      -*- busybox --->
> > > > >          Settings --->
> > > > >            [*] Command Line Editing
> > > > > 
> > > > > This sets "PTXCONF_BUSYBOX_FEATURE_EDITING=y" in the ptxconfig file.
> > > > > 
> > > > 
> > > > The feature is already enabled.
> > > > But it does not work for me. It only works when I delete the stty 
> > > > command from /etc/profile,
> > > > 
> > > > > If you are using Bash or some other other program with READLINE 
> > > > > support,
> > > > > I think it handles ASCII BS and ASCII DEL similarly to Busybox's 
> > > > > command
> > > > > line editing feature.
> > > > 
> > > > We do not use bash, we use the busybox shell.
> > > 
> > > Just for comparison, I'm using the busybox "ash" shell.  (There are two
> > > shells in Busybox - "ash" and "hush".)
> > > 
> > > My SSH client is set to send ASCII DEL when the backspace is pressed,
> > > and sets TERM="xterm" or TERM="xterm-256color".  The stty command on my
> > > target system shows "erase ^H".
> > > 
> > > Both the backspace key (which sends ASCII DEL) and the CTRL-H sequence
> > > (which sends ASCII BS) result in a backspace operation on the ash
> > > command line.
> > > 
> > > If I run a command that doesn't do any fancy line editing, such as:
> > > 
> > >     od -c
> > > 
> > > then the ASCII DEL characters get passed through to standard input and
> > > the ASCII BS characters erase the previous characters (as per the stty
> > > erase ^H setting).
> > > 
> > > If I change the stty setting:
> > > 
> > >     stty erase '^?'
> > > 
> > > then both ASCII DEL and ASCII BS result in a backspace operation on the
> > > ash command line, but for commands that do not do any fancy line
> > > editing, the ASCII BS is passed through to standard input and the ASCII
> > > DEL erases the previous character as per the stty erase '^?' setting.
> > > 
> > > So in summary, the PTXCONF_BUSYBOX_FEATURE_EDITING option seems to work
> > > for me, at least in the "ash" shell.  (I haven't tried the "hush" shell.)
> > > 
> > > I am using BusyBox 1.29.3 from PTXdist 2019.03.0.
> > > 
> > 
> > Sorry, I didn't describe the problem detailed enough:
> > When I type in the shell, everything works as you described it.
> > The problem that the backspace key doesn't work occurs when we
> > use the busybox-read function from a shell script.
> > 
> > We are using ash from busybox.
> > We are using BusyBox v1.29.3 from ptxdist 2019.03.1
> > 
> > Sorry again for the miscommunication.
> 
> I understand your problem now, the BusyBox ash "read" built-in does not 
> have line editing support, so only the kernel-level, n_tty 
> line-discipline editing features can be used.  (Bash's "read" built-in 
> supports the "-e" option to allow line-editing when the input is from a 
> tty.)
> 
I've already read that bash's read supports the option '-e'.
But 'bash' is not an option for us at the moment.

> I've no idea why that bit of the /etc/profile file is there, but I guess 
> it must have suited one of the PTXdist developers at the time.  A "git 
> blame" only revealed that the whole file was added in 2006, so I don't 
> know how relevant that part of it is today.
> 
> Still, it's easy enough to replace the default file with a modified one 
> in your project since it uses PTXdist's "install_alternative" to install 
> it in the root file system.  See:
> 
That's the way I solved the problem right now.
> https://www.ptxdist.org/doc/ref_manual.html#install-alternative
> 
> This does mean you might need to keep track of future changes to the 
> default copy of the file in future PTXdist releases and modify your 
> local copy if relevant.
> 
Yes, I know and I actually wanted to avoid that.
But maybe, when the ptxdist developers read this thread,
they take a closer look at that and maybe it was really

Thank you for your detailed explanations and for the time to discuss
this topic with me.

-- 
Regards,
Wolfram
 

only necessary for telnet and is therefore no longer needed nowadays.
_______________________________________________
ptxdist mailing list
[email protected]

Reply via email to