看板 FB_bugs 關於我們 聯絡資訊
>Number: 188535 >Category: bin >Synopsis: ed/red - incorrectly sets current address upon removing last line >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Apr 12 21:40:02 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Volodymyr Kostyrko >Release: ^/stable/10 >Organization: none >Environment: FreeBSD kohrah.xim.bz 10.0-RELEASE-p1 FreeBSD 10.0-RELEASE-p1 #1 r264316M: Thu Apr 10 16:38:26 EEST 2014 root@kohrah.xim.bz:/usr/obj/usr/src/sys/MINIMAL amd64 >Description: Let's have some file: echo xxx > some_file echo yyy >> some_file Now let's try to edit it with ed, lines starting from '>' are manual input: > ed some_file 8 > H > = 2 > g/yyy/d > = 2 > g/xxx/d > = 0 > g/zzz/d ? invalid address When last line is removed from file current address is changed from 1 to 0 making all subsequent range addressing to fail. This violates the man page: Since the g (global) command masks any errors from failed searches and substitutions, it can be used to perform conditional operations in scripts; -- What I mean is that actually using g (global) is not fully safe. Imagine I have a number of key fingerprints and I want to create a simple script to remove them from 'known_hosts' throughout all of my machines. There are a lot of fingerprints but each known_hosts file can contain only a few of them thus script may fail when file is running out of lines. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"