那些事儿 (一))
大概10年多前国内有几家公司做Linux的发行版包括红旗蓝点冲浪等等一时间兴起了Linux热潮加上一个叫做方东兴的人写了好多 起来挑战微软和Linux的书好像找到振兴中国软件之路。我也不免俗跟风加入了这一风潮中开始接触Linux。开始玩Linux算是我和开源的第一次亲密接触。开源给我的初步印象是技术狂人的杰作免费但没有商业软件好用。想到Linux就想到Linus Torvalds在我看来Linus就是世界顶尖编程高手三两下就做了一个操作系统出来这个系统甚至可以和Windows一较高下。其二是免费当时我想的免费就是可以使用很低廉的价钱甚至不需要付费就能得到当时我使用56k的modem从网上下载Linux是不可能的所以我需要购买红旗和蓝点等Linux的发行版但是这些发行版和Windows比便宜很多很多基本就是光盘的价格使用开源Linux终于摆脱了盗版问题。但是免费是需要付出代价的初步感觉Linux没有Windows好用这里其实指UI不管GNOME还是KDE都远远没有当时的Windows 98好用由于当时不懂Shell想法保留在开源尽管免费都是不好用的层面上。其实当时很多观念都是错误的Linux不是一个技术牛人就能做出来的而是需要一队人参与而且不断的推广才有今天的Linux这个下面讲到如果做开源。而且开源不一定就是免费免费只是某些开源license的形式。开源不一定比商业软件难用软件的易用性和软件的license没有直接关系。如何使用开源开源就是免费有了第一次接触慢慢我也开始使用一些开源产品做项目主要使用LinuxPHPMySQL等开源产品开始的时候也没有注意太多反正开源就是“免费”嘛我不知道到现在还有多少人坚信“开源就是免费”这一观点但是根据GNU的 The Free Software Definition (Free软件定义)这个Free是指自由(liberty)而不是价格上的免费(no charge)。这些自由包含下面几大方面The freedom to run the program, for any purpose (freedom 0). The freedom to study how the program works, and change it to make it do what you wish (freedom 1). Access to the source code is a precondition for this. The freedom to redistribute copies so you can help your neighbor (freedom 2). The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this. 不论目的为何有使用该软件的自由自由之零。 有研究该软件如何运作的自由并且得以改写该软件来符合使用者自身的需求自由之一。取得该软件之源码为达成此目的之前提。 有重新散布该软件的自由所以每个人都可以藉由散布自由软件来敦亲睦邻自由之二。 有改善再利用该软件的自由并且可以发表改写版供公众使用如此一来整个社群都可以受惠。 如前项取得该软件之源码为达成此目的之前提自由之三。同时开源可以做商业项目再次引用上述文章。Free software does not mean noncommercial. A free program must be available for commercial use, commercial development, and commercial distribution. Commercial development of free software is no longer unusual; such free commercial software is very important. You may have paid money to get copies of free software, or you may have obtained copies at no charge. But regardless of how you got your copies, you always have the freedom to copy and change the software, even to sell copies. 自由软件因此并不是「非商业软件」。自由软件必须适用於商业用途。自由软件的商业开发模式已很常见这样的自由商业软件相当重要。 使用者可以付费取得 GNU 的软件或者使用者也可以免费取得这些软件 但是不管使用者是如何取得这些软件的她他们必须永远有权利复制或是改写这些软件甚至 贩售 这些软件。开源不等于免费请下面的定义。When talking about free software, it is best to avoid using terms like give away or for free, because those terms imply that the issue is about price, not freedom. Some common terms such as piracy embody opinions we hope you wont endorse. See Confusing Words and Phrases that are Worth Avoiding for a discussion of these terms. We also have a list of proper translations of free software into various languages. 当谈到自由软件时最好避免使用「给」或是「免费」这类的措辞因为这些措辞会给人给人「free」是指「价格上的免费」的误导 而忽略了使用软件自由的真义。有些词语像 「盗版」就有类似的涵义我们希望自由软件的使用者不会想被这样指称。 有关讨论这些措辞的用法详见 「容易混淆的词语请尽量避免」 一文我们也有 「自由软件一词的翻译」 的多种语言版本。开源的代码随便用如果仅仅是使用开源软件不使用里面的源代码或者更改该开源软件一般来说可以免费使用例如使用FireFox。但是免费使用不是开源的专利很多商业软件也可以免费使用例如SQL Server Express, Visual Studio Express等等都可以免费使用。可是使用开源的代码呢开始我也以为天下代码一大抄谁拿到代码就是谁的。是这样吗开源授予了使用者自由的权利同时使用者承担了对社区的义务权利和义务并存。最常见的是当使用者修改了源码是否需要回馈给社区的问题在Free Software Definition (Free软件定义)中有这样的描述。However, rules about how to package a modified version are acceptable, if they dont substantively limit your freedom to release modified versions, or your freedom to make and use modified versions privately. Rules that if you make your version available in this way, you must make it available in that way also can be acceptable too, on the same condition. (Note that such a rule still leaves you the choice of whether to publish your version at all.) Rules that require release of source code to the users for versions that you put into public use are also acceptable. It is also acceptable for the license to require that you identify your modifications as yours, or that, if you have distributed a modified version and a previous developer asks for a copy of it, you must send one.重点看最后一句如果你发布了你的修改版本之前的开发者需要你拿一份更新的源码你必须给他/她。修改后是否需要提交到社区其实和具体的license有关不同的license有不同的规定。一些常用Open Source的license请参考下面链接 http://www.gnu.org/licenses/license-list.html常见的开源license介绍下面介绍几个我们常常碰到的license我不是学法律的我没有仔细研究各个license的法律含义下面的描述只是我个人对这些license的理解一切最终以该license的法律文件为准。GNU General Public License (GPL)GPL是很多开源软件使用的license包括大名鼎鼎的Linux。GPL一个特征是开发者做任何的更改都需要回馈社区所以商业开发不能基于GPL的基础上进行修改除非你把你的软件也作为GPL来发布。GPL分三个版本分别为GPLGPLv2和GPLv3。GPLv3的制定一定程度是为了限制微软。Richard Stallman在 Why Upgrade to GPLv3 写到其中一个好处就是限制微软。Another threat that GPLv3 resists is that of patent deals like the Novell-Microsoft pact. Microsoft wants to use its thousands of patents to make users pay Microsoft for the privilege of running GNU/Linux, and made this pact to try to achieve that. The deal offers rather limited protection from Microsoft patents to Novells customers. Microsoft made a few mistakes in the Novell-Microsoft deal, and GPLv3 is designed to turn them against Microsoft, extending that limited patent protection to the whole community. In order to take advantage of this protection, programs need to use GPLv3. Microsofts lawyers are not stupid, and next time they may manage to avoid those mistakes. GPLv3 therefore says they dont get a “next time”. Releasing a program under GPL version 3 protects it from Microsofts future attempts to make redistributors collect Microsoft royalties from the programs users.由于GPLv2和GPLv3不兼容连Linux的老大Linus也不喜欢GPLv3一直使用GPLv2作为Linux内核的license。GNU Lesser General Public License (LGPL)由于GPL不能用于商业开发但是商业软件公司想在Linux上做产品例如Oracle需要做Linux版本那怎么办Oracle肯定不愿意公开自己的关系数据库管理系统的核心代码。一个折中方案LGPL就此产生。一些系统库如CRuntime库可以可以使用LGPL授权商业软件可以调用这些系统库只要商业软件不更改这些系统库的源代码商业软件可以不公开自身的源代码。最新的QT使用了LGPL和商业两个license。如果使用QT的LGPL版本只要不更改QT可以免费使用QT做开发。LGPL一定程度的带动使用者的热情如果做库开发使用LGPL好处挺大一方