From owner-freebsd-questions@FreeBSD.ORG Mon Jul 12 13:53:14 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FB8416A4CE for ; Mon, 12 Jul 2004 13:53:14 +0000 (GMT) Received: from mproxy.gmail.com (mproxy.gmail.com [216.239.56.242]) by mx1.FreeBSD.org (Postfix) with SMTP id 635D543D45 for ; Mon, 12 Jul 2004 13:53:14 +0000 (GMT) (envelope-from espinafre@gmail.com) Received: by mproxy.gmail.com with SMTP id r62so487648cwc for ; Mon, 12 Jul 2004 06:53:14 -0700 (PDT) Received: by 10.11.119.37 with SMTP id r37mr359244cwc; Mon, 12 Jul 2004 06:53:14 -0700 (PDT) Message-ID: <5ef8c2f00407120653b5ce881@mail.gmail.com> Date: Mon, 12 Jul 2004 10:53:14 -0300 From: =?ISO-8859-1?Q?Jos=E9_de_Paula?= To: freebsd-questions@freebsd.org In-Reply-To: <20040712130553.GC2863@cise.ufl.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <5ef8c2f004070819386673edbb@mail.gmail.com> <20040712130553.GC2863@cise.ufl.edu> Subject: Re: nvi and modelines X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2004 13:53:14 -0000 On Mon, 12 Jul 2004 09:05:53 -0400, N. Thomas wrote: > * Jos? de Paula [2004-07-08 23:38:22 -0300]: > > The nvi manual page says that modelines will never be implemented. > > Does anyone know the rationale behind this > > Probably because it's a *huge* security risk. Modelines will cause vi to > read commands from the file. Can you imagine what it could do in the > wrong hands? > Yes, I can imagine. The last thing we need is macro viruses in a text editor. However, I believe (please prove me wrong) that restricting the possible commands on a modeline only to arguments for :set (like vim does) doesn't pose a security risk. > Even Vim, preeminent among vi clones, uses only a "stripped down" > modeline. From the online Vim manual: > > No other commands than "set" are supported, for security reasons > (somebody might create a Trojan horse text file with modelines). > Yep, I saw that; I had this in mind when suggesting modelines for nvi. Actually I'm hacking a quick-and-dirty modeline implementation for nvi, `a la vim (i.e., only accept 'set ' arguments on the modeline). I will post it somewhere (probably on Usenet, comp.editors) when it is at least compilable. > Is there something that you want to do with modelines that you can't do > in nvi? > I can always use nvi -c 'commands', but I think it would be nice to have automatic ts/sw/whatever settings according to the individual file I am editing. Besides, this is more to increase nvi's compatibility with original vi than anything else. Think of it as "art for art's sake"; for the utility, we already have ${FAVORITE_EDITOR}.