mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Backspace not working in terminal (using ssh)
@ 2019-03-19  9:17 Dold, Wolfram
  2019-03-19 10:31 ` Roland Hieber
  2019-03-19 12:06 ` Ian Abbott
  0 siblings, 2 replies; 18+ messages in thread
From: Dold, Wolfram @ 2019-03-19  9:17 UTC (permalink / raw)
  To: ptxdist

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.
-- 
Regards,
Wolfram Dold

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-19  9:17 [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
@ 2019-03-19 10:31 ` Roland Hieber
  2019-03-19 10:57   ` Dold, Wolfram
  2019-03-19 12:06 ` Ian Abbott
  1 sibling, 1 reply; 18+ messages in thread
From: Roland Hieber @ 2019-03-19 10:31 UTC (permalink / raw)
  To: Dold, Wolfram; +Cc: ptxdist

Hi Wolfram,

there are historically different handlings of backspace, one is
Ctrl-H, as mentioned by you below. The exact setting depends on the
terminal emulator (some terminal emulators can also switch the
behaviour, e.g. in putty, look under Terminal -> Keyboard). If backspace
works for you without the stty line, then there is no harm in leaving it
out, but the backspace behaviour could be different when connecting to
the board with a different terminal emulator.

For reference, when I type `stty -a` on my xterm, it says :

    erase = ^?;

 - Roland

On Tue, Mar 19, 2019 at 09:17:13AM +0000, 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.
> -- 
> Regards,
> Wolfram Dold
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Roland Hieber                     | r.hieber@pengutronix.de     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-19 10:31 ` Roland Hieber
@ 2019-03-19 10:57   ` Dold, Wolfram
  0 siblings, 0 replies; 18+ messages in thread
From: Dold, Wolfram @ 2019-03-19 10:57 UTC (permalink / raw)
  To: Dold, Wolfram, rhi; +Cc: ptxdist

Hi Roland,
thank's for the quick reply.
On Tue, 2019-03-19 at 11:31 +0100, Roland Hieber wrote:
> Hi Wolfram,
> 
> there are historically different handlings of backspace, one is
> Ctrl-H, as mentioned by you below. The exact setting depends on the
> terminal emulator (some terminal emulators can also switch the
> behaviour, e.g. in putty, look under Terminal -> Keyboard). 
I saw that already. Our service technicians use putty under Windows.
The default setting on backspace for ssh connections in putty is '^?'.
Sure, we could tell them, change that setting, but from experience
some would overlook it or forget it or whatever.

The default setting for gnome-terminal is also '^?'.

So a working solution would be to delete the passage from the /etc/profile file.
What I don't like is that we then have a solution that differs from the ptxdist standard.
So the question is, is it imaginable that one of the next versions of ptxdist will 
no longer contain this passage?

Regards, Wolfram


> If backspace
> works for you without the stty line, then there is no harm in leaving it
> out, but the backspace behaviour could be different when connecting to
> the board with a different terminal emulator.
> 
> For reference, when I type `stty -a` on my xterm, it says :
> 
>     erase = ^?;
> 
>  - Roland
> 
> On Tue, Mar 19, 2019 at 09:17:13AM +0000, 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.
> > -- 
> > Regards,
> > Wolfram Dold
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> 
> 
-- 
Regards / Mit den besten Grüßen,
Wolfram Dold
 
Firmware Developer
Phone:  +49 (0)7464/382-340

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-19  9:17 [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
  2019-03-19 10:31 ` Roland Hieber
@ 2019-03-19 12:06 ` Ian Abbott
  2019-03-19 12:33   ` Dold, Wolfram
  1 sibling, 1 reply; 18+ messages in thread
From: Ian Abbott @ 2019-03-19 12:06 UTC (permalink / raw)
  To: ptxdist, Dold, Wolfram

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.

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.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-19 12:06 ` Ian Abbott
@ 2019-03-19 12:33   ` Dold, Wolfram
  2019-03-19 17:42     ` Ian Abbott
  0 siblings, 1 reply; 18+ messages in thread
From: Dold, Wolfram @ 2019-03-19 12:33 UTC (permalink / raw)
  To: ptxdist; +Cc: Dold, Wolfram, abbotti

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.


Regards,
Wolfram

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-19 12:33   ` Dold, Wolfram
@ 2019-03-19 17:42     ` Ian Abbott
  2019-03-20  9:15       ` Dold, Wolfram
  0 siblings, 1 reply; 18+ messages in thread
From: Ian Abbott @ 2019-03-19 17:42 UTC (permalink / raw)
  To: ptxdist, Dold, Wolfram

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.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-19 17:42     ` Ian Abbott
@ 2019-03-20  9:15       ` Dold, Wolfram
  2019-03-20 12:41         ` Ian Abbott
  0 siblings, 1 reply; 18+ messages in thread
From: Dold, Wolfram @ 2019-03-20  9:15 UTC (permalink / raw)
  To: ptxdist, abbotti; +Cc: Dold, Wolfram

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.
-- 
Regards, Wolfram
 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-20  9:15       ` Dold, Wolfram
@ 2019-03-20 12:41         ` Ian Abbott
  2019-03-20 15:41           ` Michael Olbrich
  2019-03-21 10:45           ` [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
  0 siblings, 2 replies; 18+ messages in thread
From: Ian Abbott @ 2019-03-20 12:41 UTC (permalink / raw)
  To: ptxdist, Dold, Wolfram

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 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:

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.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-20 12:41         ` Ian Abbott
@ 2019-03-20 15:41           ` Michael Olbrich
  2019-03-21 12:46             ` Ian Abbott
  2019-03-22 12:30             ` [ptxdist] [PATCH] projectroot: remove setting stty erase character to "^H" Dold, Wolfram
  2019-03-21 10:45           ` [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
  1 sibling, 2 replies; 18+ messages in thread
From: Michael Olbrich @ 2019-03-20 15:41 UTC (permalink / raw)
  To: ptxdist

On Wed, Mar 20, 2019 at 12:41:47PM +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 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.

This code was moved around some more. It was actually introduced in the
initial import from CVS in 2003 :-). Telnet works just fine without this,
so I guess this is no longer needed.

I'll be happy to apply a patch that removes this.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-20 12:41         ` Ian Abbott
  2019-03-20 15:41           ` Michael Olbrich
@ 2019-03-21 10:45           ` Dold, Wolfram
  2019-03-21 11:26             ` Michael Olbrich
  1 sibling, 1 reply; 18+ messages in thread
From: Dold, Wolfram @ 2019-03-21 10:45 UTC (permalink / raw)
  To: ptxdist, abbotti; +Cc: Dold, Wolfram

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
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-21 10:45           ` [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
@ 2019-03-21 11:26             ` Michael Olbrich
  0 siblings, 0 replies; 18+ messages in thread
From: Michael Olbrich @ 2019-03-21 11:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Dold, Wolfram

Hi,

On Thu, Mar 21, 2019 at 10:45:57AM +0000, Dold, Wolfram wrote:
> 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

See my other reply to this thread. Send Patches :-).

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-20 15:41           ` Michael Olbrich
@ 2019-03-21 12:46             ` Ian Abbott
  2019-03-21 13:33               ` Michael Olbrich
  2019-03-22 12:30             ` [ptxdist] [PATCH] projectroot: remove setting stty erase character to "^H" Dold, Wolfram
  1 sibling, 1 reply; 18+ messages in thread
From: Ian Abbott @ 2019-03-21 12:46 UTC (permalink / raw)
  To: ptxdist

On 20/03/2019 15:41, Michael Olbrich wrote:
> On Wed, Mar 20, 2019 at 12:41:47PM +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.
[snip because it's getting a bit long]

>> 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.
> 
> This code was moved around some more. It was actually introduced in the
> initial import from CVS in 2003 :-). Telnet works just fine without this,
> so I guess this is no longer needed.

Perhaps it was there for the Windows Telnet client which seems to send 
ASCII BS when the "Backspace" key is pressed and ASCII DEL when the 
(less conveniently placed) "Delete" key is pressed.  This mimics the 
codes sent by the VT-102 "Backspace" and "Delete" keys which were both 
conveniently placed.

The Windows telnet client has a -t option to set the terminal type to 
one of "vt100", "vt52", "ansi", or "vtnt", but it doesn't pass the 
selected terminal type to the server, and this doesn't seem to have any 
effect on the codes sent by the "Backspace" and "Delete" keys.  The TERM 
environment variable ends up getting set to "vt102" by default on my 
PTXdist systems if a terminal type hasn't been passed through by the 
Telnet client.  I don't know if that is configurable.

The Windows Telnet client isn't installed by default, but can still be 
installed as a "Windows Feature".  I guess most people who used it would 
have switched to something like PuTTY by now.

> I'll be happy to apply a patch that removes this.

I'm worried that doing so might annoy some people who expect the 
existing behavior.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-21 12:46             ` Ian Abbott
@ 2019-03-21 13:33               ` Michael Olbrich
  2019-03-21 14:47                 ` Ian Abbott
  2019-03-21 15:24                 ` Ian Abbott
  0 siblings, 2 replies; 18+ messages in thread
From: Michael Olbrich @ 2019-03-21 13:33 UTC (permalink / raw)
  To: ptxdist

On Thu, Mar 21, 2019 at 12:46:40PM +0000, Ian Abbott wrote:
> On 20/03/2019 15:41, Michael Olbrich wrote:
> > On Wed, Mar 20, 2019 at 12:41:47PM +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.
> [snip because it's getting a bit long]
> 
> > > 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.
> > 
> > This code was moved around some more. It was actually introduced in the
> > initial import from CVS in 2003 :-). Telnet works just fine without this,
> > so I guess this is no longer needed.
> 
> Perhaps it was there for the Windows Telnet client which seems to send ASCII
> BS when the "Backspace" key is pressed and ASCII DEL when the (less
> conveniently placed) "Delete" key is pressed.  This mimics the codes sent by
> the VT-102 "Backspace" and "Delete" keys which were both conveniently
> placed.
> 
> The Windows telnet client has a -t option to set the terminal type to one of
> "vt100", "vt52", "ansi", or "vtnt", but it doesn't pass the selected
> terminal type to the server, and this doesn't seem to have any effect on the
> codes sent by the "Backspace" and "Delete" keys.  The TERM environment
> variable ends up getting set to "vt102" by default on my PTXdist systems if
> a terminal type hasn't been passed through by the Telnet client.  I don't
> know if that is configurable.
> 
> The Windows Telnet client isn't installed by default, but can still be
> installed as a "Windows Feature".  I guess most people who used it would
> have switched to something like PuTTY by now.

I'm pretty sure it was a Linux issue. I remember having problems like this
a long time ago.

> > I'll be happy to apply a patch that removes this.
> 
> I'm worried that doing so might annoy some people who expect the existing
> behavior.

I'd rather fix a real problem. If it causes issues, then we'll try to find
a solution.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-21 13:33               ` Michael Olbrich
@ 2019-03-21 14:47                 ` Ian Abbott
  2019-03-21 15:24                 ` Ian Abbott
  1 sibling, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2019-03-21 14:47 UTC (permalink / raw)
  To: ptxdist

On 21/03/2019 13:33, Michael Olbrich wrote:
> On Thu, Mar 21, 2019 at 12:46:40PM +0000, Ian Abbott wrote:
>> On 20/03/2019 15:41, Michael Olbrich wrote:
>>> On Wed, Mar 20, 2019 at 12:41:47PM +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.
>> [snip because it's getting a bit long]
>>
>>>> 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.
>>>
>>> This code was moved around some more. It was actually introduced in the
>>> initial import from CVS in 2003 :-). Telnet works just fine without this,
>>> so I guess this is no longer needed.
>>
>> Perhaps it was there for the Windows Telnet client which seems to send ASCII
>> BS when the "Backspace" key is pressed and ASCII DEL when the (less
>> conveniently placed) "Delete" key is pressed.  This mimics the codes sent by
>> the VT-102 "Backspace" and "Delete" keys which were both conveniently
>> placed.
>>
>> The Windows telnet client has a -t option to set the terminal type to one of
>> "vt100", "vt52", "ansi", or "vtnt", but it doesn't pass the selected
>> terminal type to the server, and this doesn't seem to have any effect on the
>> codes sent by the "Backspace" and "Delete" keys.  The TERM environment
>> variable ends up getting set to "vt102" by default on my PTXdist systems if
>> a terminal type hasn't been passed through by the Telnet client.  I don't
>> know if that is configurable.
>>
>> The Windows Telnet client isn't installed by default, but can still be
>> installed as a "Windows Feature".  I guess most people who used it would
>> have switched to something like PuTTY by now.
> 
> I'm pretty sure it was a Linux issue. I remember having problems like this
> a long time ago.

I guess it used to do `stty erase ^H` always and an exception was added 
later for terminal type "linux".  The Linux vt console sends ASCII DEL 
for the Backspace key, and ASCII ESC [ 3 ~ for the Delete key, so that 
seems like it was a reasonably cautious change at the time.

>>> I'll be happy to apply a patch that removes this.
>>
>> I'm worried that doing so might annoy some people who expect the existing
>> behavior.
> 
> I'd rather fix a real problem. If it causes issues, then we'll try to find
> a solution.

I suppose using the GNU coreutils default value for the stty erase 
character ( ^? (ASCII DEL) by default) is likely to cause the least 
problems overall.  This also seems to be the default for FreeBSD 
(although FreeBSD stty also has an "erase2" option set to ^H (ASCII BS) 
by default).

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-21 13:33               ` Michael Olbrich
  2019-03-21 14:47                 ` Ian Abbott
@ 2019-03-21 15:24                 ` Ian Abbott
  2019-03-22  7:55                   ` Michael Olbrich
  1 sibling, 1 reply; 18+ messages in thread
From: Ian Abbott @ 2019-03-21 15:24 UTC (permalink / raw)
  To: ptxdist

On 21/03/2019 13:33, Michael Olbrich wrote:
> On Thu, Mar 21, 2019 at 12:46:40PM +0000, Ian Abbott wrote:
>> On 20/03/2019 15:41, Michael Olbrich wrote:
>>> On Wed, Mar 20, 2019 at 12:41:47PM +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.
>> [snip because it's getting a bit long]
>>
>>>> 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.
>>>
>>> This code was moved around some more. It was actually introduced in the
>>> initial import from CVS in 2003 :-). Telnet works just fine without this,
>>> so I guess this is no longer needed.
>>
>> Perhaps it was there for the Windows Telnet client which seems to send ASCII
>> BS when the "Backspace" key is pressed and ASCII DEL when the (less
>> conveniently placed) "Delete" key is pressed.  This mimics the codes sent by
>> the VT-102 "Backspace" and "Delete" keys which were both conveniently
>> placed.
>>
>> The Windows telnet client has a -t option to set the terminal type to one of
>> "vt100", "vt52", "ansi", or "vtnt", but it doesn't pass the selected
>> terminal type to the server, and this doesn't seem to have any effect on the
>> codes sent by the "Backspace" and "Delete" keys.  The TERM environment
>> variable ends up getting set to "vt102" by default on my PTXdist systems if
>> a terminal type hasn't been passed through by the Telnet client.  I don't
>> know if that is configurable.
>>
>> The Windows Telnet client isn't installed by default, but can still be
>> installed as a "Windows Feature".  I guess most people who used it would
>> have switched to something like PuTTY by now.
> 
> I'm pretty sure it was a Linux issue. I remember having problems like this
> a long time ago.
> 
>>> I'll be happy to apply a patch that removes this.
>>
>> I'm worried that doing so might annoy some people who expect the existing
>> behavior.
> 
> I'd rather fix a real problem. If it causes issues, then we'll try to find
> a solution.

Changing it would probably annoy gtkterm users, and annoy minicom users 
less so.  For both of those, the Backspace key sends BS by default. 
There is an option to change it to DEL in minicom, but no such option in 
gtkterm (or if it exists, it is well hidden!).  (Personally, I prefer 
minimalist, dumb serial terminal emulators such as picocom, nanocom, and 
microcom which just run inside a local terminal session.)

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-21 15:24                 ` Ian Abbott
@ 2019-03-22  7:55                   ` Michael Olbrich
  2019-03-22 10:16                     ` Ian Abbott
  0 siblings, 1 reply; 18+ messages in thread
From: Michael Olbrich @ 2019-03-22  7:55 UTC (permalink / raw)
  To: ptxdist

On Thu, Mar 21, 2019 at 03:24:48PM +0000, Ian Abbott wrote:
> On 21/03/2019 13:33, Michael Olbrich wrote:
> > On Thu, Mar 21, 2019 at 12:46:40PM +0000, Ian Abbott wrote:
> > > On 20/03/2019 15:41, Michael Olbrich wrote:
> > > > On Wed, Mar 20, 2019 at 12:41:47PM +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.
> > > [snip because it's getting a bit long]
> > > 
> > > > > 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.
> > > > 
> > > > This code was moved around some more. It was actually introduced in the
> > > > initial import from CVS in 2003 :-). Telnet works just fine without this,
> > > > so I guess this is no longer needed.
> > > 
> > > Perhaps it was there for the Windows Telnet client which seems to send ASCII
> > > BS when the "Backspace" key is pressed and ASCII DEL when the (less
> > > conveniently placed) "Delete" key is pressed.  This mimics the codes sent by
> > > the VT-102 "Backspace" and "Delete" keys which were both conveniently
> > > placed.
> > > 
> > > The Windows telnet client has a -t option to set the terminal type to one of
> > > "vt100", "vt52", "ansi", or "vtnt", but it doesn't pass the selected
> > > terminal type to the server, and this doesn't seem to have any effect on the
> > > codes sent by the "Backspace" and "Delete" keys.  The TERM environment
> > > variable ends up getting set to "vt102" by default on my PTXdist systems if
> > > a terminal type hasn't been passed through by the Telnet client.  I don't
> > > know if that is configurable.
> > > 
> > > The Windows Telnet client isn't installed by default, but can still be
> > > installed as a "Windows Feature".  I guess most people who used it would
> > > have switched to something like PuTTY by now.
> > 
> > I'm pretty sure it was a Linux issue. I remember having problems like this
> > a long time ago.
> > 
> > > > I'll be happy to apply a patch that removes this.
> > > 
> > > I'm worried that doing so might annoy some people who expect the existing
> > > behavior.
> > 
> > I'd rather fix a real problem. If it causes issues, then we'll try to find
> > a solution.
> 
> Changing it would probably annoy gtkterm users, and annoy minicom users less
> so.  For both of those, the Backspace key sends BS by default. There is an
> option to change it to DEL in minicom, but no such option in gtkterm (or if
> it exists, it is well hidden!).  (Personally, I prefer minimalist, dumb
> serial terminal emulators such as picocom, nanocom, and microcom which just
> run inside a local terminal session.)

Ok, I did some testing and now I'm rather confused. I tested minicom,
microcom and gtkterm on the serial port and putty (on Linux) via serial
port and telnet and a normal telnet.

In all cases backspace and delete work as expected with 'stty erase ^H' and
'stty erase ^?'.

Am I missing something here or is something magically doing the right thing
in the background?

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ptxdist] Backspace not working in terminal (using ssh)
  2019-03-22  7:55                   ` Michael Olbrich
@ 2019-03-22 10:16                     ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2019-03-22 10:16 UTC (permalink / raw)
  To: ptxdist

On 22/03/2019 07:55, Michael Olbrich wrote:
> Ok, I did some testing and now I'm rather confused. I tested minicom,
> microcom and gtkterm on the serial port and putty (on Linux) via serial
> port and telnet and a normal telnet.
> 
> In all cases backspace and delete work as expected with 'stty erase ^H' and
> 'stty erase ^?'.
> 
> Am I missing something here or is something magically doing the right thing
> in the background?

If BUSYBOX_FEATURE_EDITING is enabled, BusyBox's "ash" and "hush" shells 
are doing something magical (using BusyBox's read_line_input() function) 
when interactively editing a command line from a TTY.  The shell's 
built-in commands that use standard input (such as the 'read' command) 
do not use this magic line editing, and rely solely on the stty 
settings.  The same applies to most external commands that can read from 
standard input (including those implemented by busybox) unless they 
implement their own readline-like functionality.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ptxdist] [PATCH] projectroot: remove setting stty erase character to "^H"
  2019-03-20 15:41           ` Michael Olbrich
  2019-03-21 12:46             ` Ian Abbott
@ 2019-03-22 12:30             ` Dold, Wolfram
  1 sibling, 0 replies; 18+ messages in thread
From: Dold, Wolfram @ 2019-03-22 12:30 UTC (permalink / raw)
  To: ptxdist; +Cc: Dold, Wolfram

In popular console tools the default value for the stty erase character
is set to "^?".
BusyBox ash "read" built-in does not have line editing support.
If you now use "read" in an ash script and "^H" is set as stty erase
character on the target device, then correcting with the backspace
button does not work. Because the local console sends "^?"
and the target device expects "^H".

Signed-off-by: Wolfram Dold <wolfram.dold@allegion.com>
---
 projectroot/etc/profile | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/projectroot/etc/profile b/projectroot/etc/profile
index 259113d33..833791497 100644
--- a/projectroot/etc/profile
+++ b/projectroot/etc/profile
@@ -2,11 +2,6 @@
 #
 export HISTFILE=/tmp/.ash_history.$USER.$PPID
 
-# This fixes the backspace when telnetting in.
-if [ "$TERM" != "linux" ]; then
-        stty erase ^H
-fi
-
 # source this file for subsequent shells, too
 # (will also be sourced for init-shell)
 export ENV=/etc/profile.environment
-- 
2.17.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-03-22 12:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19  9:17 [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
2019-03-19 10:31 ` Roland Hieber
2019-03-19 10:57   ` Dold, Wolfram
2019-03-19 12:06 ` Ian Abbott
2019-03-19 12:33   ` Dold, Wolfram
2019-03-19 17:42     ` Ian Abbott
2019-03-20  9:15       ` Dold, Wolfram
2019-03-20 12:41         ` Ian Abbott
2019-03-20 15:41           ` Michael Olbrich
2019-03-21 12:46             ` Ian Abbott
2019-03-21 13:33               ` Michael Olbrich
2019-03-21 14:47                 ` Ian Abbott
2019-03-21 15:24                 ` Ian Abbott
2019-03-22  7:55                   ` Michael Olbrich
2019-03-22 10:16                     ` Ian Abbott
2019-03-22 12:30             ` [ptxdist] [PATCH] projectroot: remove setting stty erase character to "^H" Dold, Wolfram
2019-03-21 10:45           ` [ptxdist] Backspace not working in terminal (using ssh) Dold, Wolfram
2019-03-21 11:26             ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox