[Kernel/Drive] NCAR Command Language(NCL)输出错误 V20.9
Tofloor
poster avatar
deepin
2023-07-04 05:04
Author

我在NCL进行print("Hello World")操作时,总是会出现一个需要按q才能退出的输出模式,其他Linux发行版都没有这个bug,由于NCL只能用linux,希望能修复这个bug,deepin真的优化的很好,感谢!

Copyright (C) 1995-2019 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.6.2
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> print("HELLO WORLD")
(0)     HELLO WORLD










































(END)

按q之后

(ncl662) liu@liu-PC:~/Desktop$ ncl
 Copyright (C) 1995-2019 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.6.2
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> print("HELLO WORLD")
(0)     HELLO WORLD










































ncl 1> 

Reply Favorite View the author
All Replies
babyfengfjx
Super Moderator
CQA
2023-07-05 01:45
#1

这玩意有其他IDE没,这类第三方模块,估计没人能开展适配,只是操作上会多一个Q?会不会是设置问题? 如果提示有确实什么依赖包啥的,估计还有戏,这种操作行为应该是没人会去处理吧,可以看看这个情况是否可以通过设置来解决,或是有啥其他解决方案,其他发行版上,主要是哪些发行版,使用的版本都一样么?

Reply View the author
hotime
deepin
2023-07-05 03:09
#2

测试了AnolisOS7和Debian11,确实没有这个问题,经过与Deepin的对比,发现在ncl中使用print()输出内容时,按h唤出帮助界面可以看到,它与linux常用命令more的帮助界面是一致的。于是使用more命令查看超出终端显示范围的文本文件,对比三个系统的表现可以看出:当查看至文件内容的最后一行时,Debian11和AnolisOS7按Enter(向下n行,默认1行)可以直接退出more界面并返回到终端,而Deepin则会显示(END),要求按Q退出。(注:more命令中Enter可以查看下一行,并没有明确说明有退出的作用,退出要求按Q或Ctrl+C)

more -V查看版本,可以看到:它是在util-linux包中的,各版本如下:
AnolisOS7 util-linux 2.32.2
Debian11 util-linux 2.36.1
DeepinV20 util-linux 2.38.1

其中Deepin使用的util-linux版本较其他两个版本更新,或许util-linux的维护团队认为在最后一行Enter可以退出more界面是个BUG,然后修复了它?(这只是我的一点猜测,并没有去考证)

DeepinV20仓库中,可以找到util-linux较旧的版本2.33.1,你可以试着安装这个版本的util-linux以解决此问题。(亲测有效)

sudo apt install util-linux=2.33.1-0.1

图片.png


补充:

(注:Debian12使用的util-linux版本与DeepinV20一样是2.38.1,也会出现贴主遇到的问题)


补充:

util-linux v2.38-ReleaseNotes中,关于more指令的修改

more:

- Calling open without checking return value [coverity scan]  [Karel Zak]
- POSIX compliance patch preventing exit on EOF without -e  [Ian Jones]
- add __format__ attribute  [Karel Zak]
- clear SIGCHLD inherited setting  [Karel Zak]
- fix -e in non-interactive mode  [Karel Zak]
- fix null-pointer dereference  [Karel Zak]
- fix setuid/setgid order  [Karel Zak]
- improve zero size handling  [Tobias Stoeckmann]
- use snprintf() rather than sprintf()  [Karel Zak]

其中第二条:POSIX compliance patch preventing exit on EOF without -e [Ian Jones]修复了在不使用-e参数的情况下到文件末尾时可以异常退出文件的问题。

Reply View the author
hotime
deepin
2023-07-05 03:29
#3
babyfengfjx

这玩意有其他IDE没,这类第三方模块,估计没人能开展适配,只是操作上会多一个Q?会不会是设置问题? 如果提示有确实什么依赖包啥的,估计还有戏,这种操作行为应该是没人会去处理吧,可以看看这个情况是否可以通过设置来解决,或是有啥其他解决方案,其他发行版上,主要是哪些发行版,使用的版本都一样么?

应该是和more命令的版本有关,相较其他版本的Linux如AnolisOS7、Debian11,DeepinV20使用了较新版本的util-linux,这个版本中,使用more查看超过终端显示范围的多行文本文件时,在查看到最后一行后,再次按Enter会显示(END),必须按照要求按Q或Ctrl+C退出more界面,而不再是按Enter就直接退出了more界面(毕竟Enter的本意是向下n行,默认1行)。

Reply View the author
owen_337
deepin testing team
2023-07-05 17:10
#4
hotime

测试了AnolisOS7和Debian11,确实没有这个问题,经过与Deepin的对比,发现在ncl中使用print()输出内容时,按h唤出帮助界面可以看到,它与linux常用命令more的帮助界面是一致的。于是使用more命令查看超出终端显示范围的文本文件,对比三个系统的表现可以看出:当查看至文件内容的最后一行时,Debian11和AnolisOS7按Enter(向下n行,默认1行)可以直接退出more界面并返回到终端,而Deepin则会显示(END),要求按Q退出。(注:more命令中Enter可以查看下一行,并没有明确说明有退出的作用,退出要求按Q或Ctrl+C)

more -V查看版本,可以看到:它是在util-linux包中的,各版本如下:
AnolisOS7 util-linux 2.32.2
Debian11 util-linux 2.36.1
DeepinV20 util-linux 2.38.1

其中Deepin使用的util-linux版本较其他两个版本更新,或许util-linux的维护团队认为在最后一行Enter可以退出more界面是个BUG,然后修复了它?(这只是我的一点猜测,并没有去考证)

DeepinV20仓库中,可以找到util-linux较旧的版本2.33.1,你可以试着安装这个版本的util-linux以解决此问题。(亲测有效)

sudo apt install util-linux=2.33.1-0.1

图片.png


补充:

(注:Debian12使用的util-linux版本与DeepinV20一样是2.38.1,也会出现贴主遇到的问题)


补充:

util-linux v2.38-ReleaseNotes中,关于more指令的修改

more:

- Calling open without checking return value [coverity scan]  [Karel Zak]
- POSIX compliance patch preventing exit on EOF without -e  [Ian Jones]
- add __format__ attribute  [Karel Zak]
- clear SIGCHLD inherited setting  [Karel Zak]
- fix -e in non-interactive mode  [Karel Zak]
- fix null-pointer dereference  [Karel Zak]
- fix setuid/setgid order  [Karel Zak]
- improve zero size handling  [Tobias Stoeckmann]
- use snprintf() rather than sprintf()  [Karel Zak]

其中第二条:POSIX compliance patch preventing exit on EOF without -e [Ian Jones]修复了在不使用-e参数的情况下到文件末尾时可以异常退出文件的问题。

嗯,应该是版本不同,带来的特性吧

Reply View the author
hotime
deepin
2023-07-06 20:19
#5
owen_337

嗯,应该是版本不同,带来的特性吧

是的,util-linux v2.38修复了不使用-e参数的情况下仍然可以在文件末尾退出的BUG

util-linux v2.38-ReleaseNotes

more:

- POSIX compliance patch preventing exit on EOF without -e  [Ian Jones]
Reply View the author
owen_337
deepin testing team
2023-07-06 21:18
#6
hotime

是的,util-linux v2.38修复了不使用-e参数的情况下仍然可以在文件末尾退出的BUG

util-linux v2.38-ReleaseNotes

more:

- POSIX compliance patch preventing exit on EOF without -e  [Ian Jones]

艾特楼主看一下哈,@刘

Reply View the author
owen_337
deepin testing team
2023-07-06 21:18
#7
Reply View the author
deepin
2023-09-21 22:35
#8
owen_337

感谢您们的努力!您的测试的速度真是令人惊叹,最后我尝试着解决了这个问题,我是用了如下语句:

vi ~/.bashrc
export PAGER="cat"

看起来就是新版本默认使用 ‘linux more‘ 命令的原因。在debian12中同样可以解决这个问题kissing_heart

Reply View the author