WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: busybox vi command ":s/x/y/" searches not in the current line only  (Read 2971 times)

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Hi, staff!
Usually in vim command ":s/x/y/" applies only to current line. But in TC busybox vi this command continues search in next lines, until it finds pattern "x". It makes absolutely unusable substitutes with ranges, like "1,5s/x/y/", "/aaa/,/bbb/s/x/y/" and others. Is it bug or feature?
I loaded busybox sources 1.27.2 in case TC 9.0 and compiled them with "make defconfig". The resulting busybox vi command ":s"works as in traditional vim, but executable is twice greater, than "/bin/busybox".
Sorry, but I can't found which features are enabled in distribution busybox binary. Where can i find them?
The reason for me to use busybox vi is that I use TC 6.4.1 on one anscient laptop with 64M and have a nomadic flash drive with TC 9.0 for use everywhere.
Busybox vi is so tiny and usefull, I like it very much! As TinyCore too! It's wonderfull, OS of my dreams ) Thanks a lot!

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: busybox vi command ":s/x/y/" searches not in the current line only
« Reply #2 on: November 24, 2018, 08:35:40 AM »
Hi Juanito
I think you misread something in the question. Truth is I misread it too the first time. He probably wants the 32 bit version:
http://tinycorelinux.net/8.x/x86/release/src/busybox/

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: busybox vi command ":s/x/y/" searches not in the current line only
« Reply #3 on: November 24, 2018, 08:37:35 AM »
Busybox "s" command is broken. Try it in other distros, you'll get the same results. Use sed or vim instead.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: busybox vi command ":s/x/y/" searches not in the current line only
« Reply #4 on: November 25, 2018, 03:02:33 PM »
Thanks, guys, this is really busybox vi bug. It crawls out when busybox is compiled with FEATURE_VI_REGEX_SEARCH, as it is compiled in TinyCore.
Maybe not many people on this planet use busybox vi, seems only me ) ,because problem affected versions since 1.23 at least, and nobody was aware.
Patch for busybox 1.27.2 is tremendous:
Code: [Select]
1912a1913,1914
> if (range == LIMITED)
> q = next_line(p); // range is to next line
and must be applied to "editors/vi.c" in busybox source directory.
I don't know would it be useful for us? This variable check falled out of source long, long ago, and nobody cares (
I've sent this patch and 1.29.3 patch to busybox@busybox.net, maybe TC9.1 will make use of it )

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: busybox vi command ":s/x/y/" searches not in the current line only
« Reply #5 on: November 29, 2018, 11:22:08 AM »
Denys Vlasenko made the commit to master branch of busybox, eliminating this bug. So substitution in vi will work correctly  for versions next to 1.29.3.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: busybox vi command ":s/x/y/" searches not in the current line only
« Reply #6 on: November 29, 2018, 12:06:02 PM »
Do you have a link to the commit?

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934