Re: Changes in Common Line Editor

2023-03-10 Thread Huang Qi
> There are bandaid fixes going in that try to recover from the primary bad 
> fix.  That is not > good.  That is only making things worse.  We need to fix 
> the root cause of the problem
> no just change the behavior of individual apps to hide the problem.  The root 
> cause is
> that the serial driver is echoing things it should not and is not smart 
> enough to know
> what it should not echo.

In fact, cle has its own issue, it will send a query cursor first, and wait for 
the reply from serial port.

If you power up your device first and attach it to PC by serial port later (the 
PC will miss the cursor query command), the cle will hang in here unless you 
press any key ten more times.

And in this process, no any info will inform user.

This patch in thread fixed this behavior, and also fix the issue similar with 
above (but due to driver instead of outside reason).


Re: Changes in Common Line Editor

2023-03-10 Thread Gregory Nutt

On 3/10/2023 4:55 AM, Sebastien Lorquet wrote:

Well, there it is

https://github.com/apache/nuttx-apps/issues/1653

Note that I dont get this behaviour with readline.

We can continue to discuss this in the issue.

Sebastien 
There are bandaid fixes going in that try to recover from the primary 
bad fix.  That is not good.  That is only making things worse.  We need 
to fix the root cause of the problem no just change the behavior of 
individual apps to hide the problem.  The root cause is that the serial 
driver is echoing things it should not and is not smart enough to know 
what it should not echo.


Re: Changes in Common Line Editor

2023-03-10 Thread Sebastien Lorquet

Well, there it is

https://github.com/apache/nuttx-apps/issues/1653

Note that I dont get this behaviour with readline.

We can continue to discuss this in the issue.

Sebastien


Le 10/03/2023 à 11:47, Sebastien Lorquet a écrit :

Hi,

I have tested CLE and noticed this side effect.

My system has background tasks at boot. these tasks write messages on 
the console. At boot, a DHCP thread gets an IP after a delay.


When I typed the help command, the first h appeared twice: at first 
position of the line, and also at the correct expected place because 
of the prompt length.


This happens because the prompt is "hidden".

It looks like this:

dhcp thread done
h    help
help usage:  help [-v] []

Notice the h, 4 spaces, help.

This is not very important, but since you are working on it, maybe you 
want to have a look at this.


I dont know if that is a regression, I did not use CLE before.


I wanted a simple test to reproduce the issue.

I tried:

nsh> echo "abcd" &

I think this produces a strange behaviour that requires control-C to 
recover and then writes:


nsh: nsh_session: cle failed: 22

This may be another bug? what do you think? Do you want me to send a 
new github issue to work on this?


Sebastien


Le 10/03/2023 à 10:38, Qi3 Huang 黄齐 a écrit :

Hi all:

 I've submitted a new patch to GitHub 
(https://github.com/apache/nuttx-apps/pull/1650), in this is to 
maintain the cursor position in cle's internal instead of query from 
terminal, this avoid the query operation before each line read 
operation.


 Then the cle's behavior is much more like readline, and also 
avoid some potential issues if the connection between nuttx and PC is 
not so stable (serial driver? or cable link?).


 But, this patch assume that the nsh prompt is always shown at 
line start (ensure it by clear line command in vt100), is there any 
side effect for you?


BR,
Huang Qi

#/**本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! 
This e-mail and its attachments contain confidential information from 
XIAOMI, which is intended only for the person or entity whose address 
is listed above. Any use of the information contained herein in any 
way (including, but not limited to, total or partial disclosure, 
reproduction, or dissemination) by persons other than the intended 
recipient(s) is prohibited. If you receive this e-mail in error, 
please notify the sender by phone or email immediately and delete 
it!**/#


Re: Changes in Common Line Editor

2023-03-10 Thread Sebastien Lorquet

Hi,

I have tested CLE and noticed this side effect.

My system has background tasks at boot. these tasks write messages on 
the console. At boot, a DHCP thread gets an IP after a delay.


When I typed the help command, the first h appeared twice: at first 
position of the line, and also at the correct expected place because of 
the prompt length.


This happens because the prompt is "hidden".

It looks like this:

dhcp thread done
h    help
help usage:  help [-v] []

Notice the h, 4 spaces, help.

This is not very important, but since you are working on it, maybe you 
want to have a look at this.


I dont know if that is a regression, I did not use CLE before.


I wanted a simple test to reproduce the issue.

I tried:

nsh> echo "abcd" &

I think this produces a strange behaviour that requires control-C to 
recover and then writes:


nsh: nsh_session: cle failed: 22

This may be another bug? what do you think? Do you want me to send a new 
github issue to work on this?


Sebastien


Le 10/03/2023 à 10:38, Qi3 Huang 黄齐 a écrit :

Hi all:

 I've submitted a new patch to GitHub 
(https://github.com/apache/nuttx-apps/pull/1650), in this is to maintain the 
cursor position in cle's internal instead of query from terminal, this avoid 
the query operation before each line read operation.

 Then the cle's behavior is much more like readline, and also avoid some 
potential issues if the connection between nuttx and PC is not so stable 
(serial driver? or cable link?).

 But, this patch assume that the nsh prompt is always shown at line start 
(ensure it by clear line command in vt100), is there any side effect for you?

BR,
Huang Qi

#/**本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
 This e-mail and its attachments contain confidential information from XIAOMI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!**/#


Changes in Common Line Editor

2023-03-10 Thread Qi3 Huang 黄齐
Hi all:

I've submitted a new patch to GitHub 
(https://github.com/apache/nuttx-apps/pull/1650), in this is to maintain the 
cursor position in cle's internal instead of query from terminal, this avoid 
the query operation before each line read operation.

Then the cle's behavior is much more like readline, and also avoid some 
potential issues if the connection between nuttx and PC is not so stable 
(serial driver? or cable link?).

But, this patch assume that the nsh prompt is always shown at line start 
(ensure it by clear line command in vt100), is there any side effect for you?

BR,
Huang Qi

#/**本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
 This e-mail and its attachments contain confidential information from XIAOMI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!**/#