[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Loop in vi



>>>>> Dale Scheetz writes:

 DS> Linking /usr to / is a broken idea.

I'm not going to waste much time arguing for or against the relative
brokenness of this idea.  Likewise, I'm not going to waste much time
arguing for or against the relative brokenness of having a wrapper
script that incurs a performance impact on my non-symlinked system
every time I run vi just because /bin appears in my PATH before
/usr/bin.

I believe that the /bin/vi wrapper is useful because it saves users
who accidentally break their vi installation (or are installing their
system), and don't have an emacs, so I'm willing to accept the cost.
I believe that the /usr to / link is useful because it saves me having
to type 4 characters once in a while, and so I'm willing to accept the
cost.

Assuming that you are determined to have a vi wrapper script that is
located /bin, and assuming that I am determined to symlink /usr to /,
I've attached a solution that should make us all relatively happy.

I'm not entirely happy with the performance of my fix, though.  You
can judge for yourself by my profiling (after changing every `exec' to
`: exec' in both scripts):

trick:~$ time perl -e 'for ($i = 0; $i < 100; $i ++) { 1; }'

real	0m0.022s
user	0m0.020s
sys	0m0.010s
trick:~$ time perl -e 'for ($i = 0; $i < 100; $i ++) { system "./vi.orig"; }'

real	0m2.543s
user	0m1.600s
sys	0m0.950s
trick:~$ time perl -e 'for ($i = 0; $i < 100; $i ++) { system "./vi"; }'

real	0m8.163s
user	0m4.980s
sys	0m3.080s
trick:~$

By my count, that's 0.02521 seconds for the original, and 0.08141
seconds for my solution.  Would my changes make /bin/vi a bottleneck?
;)

Anyway, if any other aspect of my solution doesn't make you happy,
please let me know.

 DS> In addition, /bin/vi is a script, installed in the root.bin of
 DS> the rescue floppy so that the vi command will provide an editor
 DS> during base installation. As soon as one of the "real" vi's gets
 DS> installed (on a system with /usr linked to /) the script will be
 DS> overwritten by the new symlink for update-alternatives that the
 DS> various vi use.

Exactly... the problem is limited in scope, and so I don't want to
spend much more time working on it.  It was a tiny problem for me,
I've attached a tiny fix for it, and now I'm asking you to graciously
consider spending a tiny bit of time incorporating my fix into your
package.

If you do, I will be a tiny bit happier, and there will be a tiny bit
more peace among fellow Debian developers. :)

Thanks Dale,

-- 
 Gordon Matzigkeit <gord@fig.org>  //\ I'm a FIG (http://www.fig.org/)
Committed to freedom and diversity \// I use GNU (http://www.gnu.org/)

Attachment: vi
Description: Binary data


Reply to: