Re: will it break the system files?

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

 



On Mon, Jan 05, 2009 at 04:24:00PM -0500, Chris Snook wrote:
> cjzjm100 wrote:
> > Hi,all,i seted the encoding of vim in order to display chinese
> > well.Because when i opened source files programed by myslfe,the chinese
> > can't display well.My locale is zh_CN.UTF-8,here is the contents of .vimrc:
> > let &termencoding=&encoding
> > set fileencodings=utf-8,gbk,ucs-bom,cp936
> > After this ,will it break the system files when i edit the system files
> > by vim?
> > 
> 
> I have no idea, though I suspect the answer is no.  Regardless, this is a
> classic example of why it's good to have separate root and non-root users.  Root
> should never need to be editing program source.
> 

If you are very cautious, it will in itself not break systems files BUT
it will enable you do break them in ways that are all but impossible for
us to help you fix.

Since chinese is a multi byte character set (and a rich one at that) you will
find that it is all to easy to insert multi byte characters in lines that
then no longer cleanly parse with cut, sed, tr, awk, grep, perl, python, 
make, bash and other text tools used in system scripts.

One issue with multi byte character set documents is that there is a
need to know the character set the document is encoded with.   In most
html and xml documents (and email, see email headers and MIME encoding)
it is possible to insert hints or specifications for the character set.
This is not the case for system configuration files where the assumption
is that they are 'ascii' or perhaps a single byte encoded character set.

As others indicated there is great value in keeping a clear separation of
'root' and user activity.

To this end /etc/profile.d/vim.sh and /etc/profile.d/vim.csh test to
see if the user id is in the range of system users or normal users and
set the alias for vi to vim if and only if you are a normal user.

What this does is let a user invoke 'vi' at most any time and the vim
extensions are not under the fingers of root where they might cause
problems. (Note Well: compare and contrast "su" with "su -").

The fact that these tests are made is a clear hint that multi-byte character
sets are problematic for system files.   This includes Apache, squid and 
all processes that run with an effective UID less than or equal to 100.

Perhaps using 'vi' in contrast to 'vim' and taking advantage of the
standard system aliases is all the care you need except that it seems
that is not sufficient for what you expect.



-- 
	T o m  M i t c h e l l 
	Found me a new hat, now what?

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux