Bug 202740 - vi/ex string substitution problem when there is multiple occurrences in a line
Summary: vi/ex string substitution problem when there is multiple occurrences in a line
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.0-RC1
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2015-08-29 09:50 UTC by fehmi noyan isi
Modified: 2017-04-23 18:17 UTC (History)
1 user (show)

See Also:
koobs: mfc-stable9?
koobs: mfc-stable10?


Attachments
ex string substutition bug demonstration (341 bytes, text/plain)
2015-08-29 09:50 UTC, fehmi noyan isi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description fehmi noyan isi 2015-08-29 09:50:34 UTC
Created attachment 160478 [details]
ex string substutition bug demonstration

ex/vi implementations in 10.2-RELEASE, and 11.0-CURRENT have issues with string substitution when the phrase that would be replaced with a new one appears in a single line more than once.

This phenomena is visible when ex(1) is invoked with -s and -c options. Attached text file includes step by step demonstration of the problem. The last command in the attached file always fails.

Problem is most probably visible in older versions of FreeBSD as well, I have only tested on these two systems.
Comment 1 fehmi noyan isi 2015-09-01 09:28:12 UTC
Problem reproduced on Debian GNU/Linux 8.1.0-amd64, on which nvi can be installed via apt-get. "ve" command output for "ex"

Version nvi-1.81.6 (2007-11-18) The CSRG, University of California, Berkeley.

uname -a output for Debian GNU/Linux
Linux Debian 3.16.0-4-amd64 #1 Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
Comment 2 fehmi noyan isi 2016-10-16 07:57:47 UTC
Hi there,

Problem persists with nvi 2.1.3 that comes with FreeBSD 11.0-RELEASE

~% ex
/tmp/vi.4UCmUoap3c: new file: line 1
:ve
Version 2.1.3 (2015-04-08) The CSRG, University of California, Berkeley.
:q
~ % uname -a
FreeBSD fbsd 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64