【黑曜石】 各种常见开源协议理解说明和其背后的小故事

2020-09-20   833 次阅读


初衷

进一步了解历史,了解各种协议的法律效应。
不深究其法律或协议漏洞,只作为了解
追求科普的有趣和实用,不求专业的学术总结

此处书写的协议有

  1. MIT(Massachusetts Institute of Technology)
  2. BSD(Berkeley Software Distribution license)
  3. Apache Licence
  4. GPL(General Public License)
  5. LGPL(Lesser General Public License)

可参考目录来进行观看

1. MIT (Massachusetts Institute of Technology)

如题所示,源于麻省理工学院。

比较宽松的开源协议,作者只是保留了其版权,一概不做限制。
只要在发布的代码中使用了源代码或者由源代码更改过的代码时,在代码或者说明文档中发布MIT许可协议声明,就可以随意的使用。
使用的范围包括但不限于

  1. 商业用途
  2. 使用开源机构名字作为市场宣传
  3. 随意更改代码
  4. 发布由源代码更改过的代码的其他任意版权声明

以下是引进MIT开源协议的声明方法

Copyright (C) <2020> <Mofan Duan>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

2. BSD(Berkeley Software Distribution license)

想不到这个开源协议竟然是起源于加州大学伯克利分校

这个学校在真的创造了很多传奇。据我了解的有

  1. 曼哈顿计划-世界上第一颗原子弹
  2. NLPCC2018第一
  3. 开源协议

有机会真的想去那个学校上学

该协议也是比较宽松的开源协议,作者也只是想保留版权。Berkeley的这个协议也是允许商用,允许更改,允许在源代码更改的基础上发布新的个人版权声明,只要在所有跟进版本中带有该协议的声明就可以。但是不一样的是

  • 该协议不允许使用代码的人使用开源的机构或者个人的名字当作市场宣传

这样的协议更适合不想使用其名字当作市场宣传的人。在发布时在MIT和BSD中选取的方式估计就是愿不愿意代码使用者使用此发布者的名字当作宣传了。(也许在写的特别烂的代码中使用这个能避免被嘲笑哈啊哈哈哈)

附上引入BSD开源协议的声明

Copyright (c) 1998, Regents of the University of California All rights reserved.
Copyright (c) 1998 著作权由加州大学董事会所有,著作权人保留一切权利。

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
在符合以下条件的情况下,允许用户对源代码和二进制文件进行使用和再散播,无论源代码是否进行了修改:

  1.Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  对于源码的再散播,必须保留以上著作权声明、此条件列表、以及下述的免责声明.
  2.Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  以二进制可执行文件的散播,必须将以上著作权声明、此条件列表、以及下述的免责声明,添加到文档 以及/或 其他材料中.
  3.Neither the name of the University of California, Berkeley nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
  未事前获取书面许可,不得使用加州大学伯克利分校或本软件贡献者之名称,来为本软件之派生物做任何表示支持、认可或推广、促销之行为。

this software is provided by the regents and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. in no event shall the regents and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
免责声明:
本软件是由加州大学董事会及本软件之贡献者提供(本就如此),本软件包装不负任何明示或默示之担保责任,包括但不限于就适售性以及特定目的的适用性为默示性担保。加州大学董事会及本软件之贡献者,无论任何条件、无论成因或任何责任主义、无论此责任为因合约关系、无过失责任主义或因非违约之侵权(包括过失或其他原因等)而起,对于任何因使用本软件包装所产生的任何直接性、间接性、偶发性、特殊性、惩罚性或任何结果的损害(包括但不限于替代商品或劳务之购用、使用损失、资料损失、利益损失、业务中断等等),不负任何责任,即在该种使用已获事前告知可能会造成此类损害的情形下亦然。

3. Apache Licence

Apache是一个服务器代理的免费开源组织发布的开源协议。最开始美国NASA科学院建立起阿帕网(Arpanet)作为军用,后来衍生出因特网(internet)开放民用,但其服务器代码项目还是由NASA的NASAWWW来进行维护。而当NASAWWW停止维护后,使用NASAWWW的网民们就开始自发的分享他们对NASAWWW的补丁对其进行维护。而补丁越来越多,他们开始意识到成立一个组织性管理这些补丁的社区十分的有必要,于是便有了Apache开源组织。

Apache取自"a patchy server"同读音,意思是"充满了补丁的服务器"。算是对其自身的戏谑

缺点

  • Apache的服务器代理是阻塞式的,所以在应对高并发状况时表现的不如异步非阻塞的服务器代理(例如本网站使用的Nginx)性能高。
  • 而且相比较于现在的一些服务器代理,其因为历史原因会占用更多的资源。(Nginx就比apache轻量特别多)

优点

  • 超级超级稳定(Nginx挺多小bug)
  • 接口是市面上最全的,只有想不到没有他没有
  • URL跳转无敌稳定

Apache开源组织之所以发布这样的开源声明协议,是因为当时SCO告Linux抄了其UNIX的部分代码。因为Unix是商用的,而Linux完全免费开源,所以SCO认为Linux的开源侵犯了其利益。而SCO不愿意公布任何其Unix的代码
但SCO就是在无理取闹,Linux灵感来源于Unix但是其系统处理模式和系统理念完全与Unix不一样,而且完全免费开源。(我觉得UNix就是因为Liux发布后没人用Unix了活不下去了才这样。。。。)

而Apache也怕被人告说是侵权了谁谁谁的服务器代码系统,就发布了如此的开源协议。

Apache的协议相对来说严一点点,但主要表现为麻烦,也不对使用者造成任何限制。

  1. 需要给使用代码的用户拷贝一份Apache Licence
  2. 要在源代码中包含原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。
  3. 如果有说明文档,要在说明文档中包含Apache Licence。使用者可以发布新的个人声明但不可以表现为对Apache Licence的规定进行更改
  4. 不禁用商用

这个开源协议对使用其他人的代码开源发布自己的私人利益型开源协议进行了白纸黑字的禁止,但是也没有禁止商用。虽然麻烦一些但还是一个很友好的协议

附上引用Apache协议的声明

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

4. GPL(General Public License)

GPL是自由软件基金会(Free Software Foundation)的创建者理查德·斯托曼为GNU项目所撰写。GNU的意思GNU's Not UNIX(好针对商用的Unix哈哈哈当时Unix做的也确实是差)
理查德·斯托曼写到,GNU项目是想重现当年软件界合作互助的团结精神,而不是动不动就闭源商用还做的贼差。目的是创造一个真正好用的,真正自由的操作系统。

GNU项目是Free Software Foundation的主要项目,而自由软件基金会在早期是一个纯粹的高级黑客组织,个个都是大牛,开启和引领了计算机的自由软件运动。其实包括现在也有大量的斯坦福大学,麻省理工大学教授学生和厉害的黑客在贡献自己的力量,只是组织中多了挺多法律专业的人士。

自由软件基金会创造的范围十分的大,除了GNU项目之外,他还针对adobe写了真正自由的flash player - Gnash,真正自由的PDF Reader - GNU PDF,针对IBM写了真正自由的BIOS - coreboot,真正自由的食品编辑软件 - Kdenlive,真正自由的聊天软件 - GNU libffcall,针对MATLAB写了数学计算软件 - GNU Octave,还针对了google earth和Oracle Forms写了相同业务的软件,因为这些组织选择了提供闭源服务,不是自由的软件。在当时真是给商用软件创造恐惧的一个组织。但是可能是资本把他压倒了吧,大多数他写的软件没有得到特别好的推广。

但是当时FSF写的gcc以及众多众多代码编译器和管理器和小工具都被Linux之父,Linus Torvalds总结管理使用(Linux中使用的几乎所有软件都来自FSF的GNU项目),也就产生了世界上最完美自由的系统-Linux。之后Linux由来自全球的debian组织的小伙伴维护开发。

Linux在发布Linux后沿用了GNU的GPL协议,协议如下:

  1. 只要使用GPL协议的相关类库与代码,则该软件亦必须采用GPL协议,既必须开源与免费。
  2. 不允许修改后和衍生的代码做为闭源的商业软件发布和销售

应该说是不愧是黑客组织写的协议吗,这协议内容都满满的病毒式传播的味道。只要用过使用GPL协议开源的库和代码,就必须开源以及免费。也不允许修改和衍生的代码作为闭源的商业软件发布和销售。

所以现在我们的所有的Linux也是用的GPL协议,完全的开源,免费,自由。

FSF/GNU是一个很激进也很理想主义的组织。他甚至与Linux不同,他摒弃一切不开源,不免费的软件,积极的拒绝他们在他们写的软件中运行,甚至还会不停的在网上发言批评一些不开源不免费的大公司。而在Linux我们还可以使用python来写商用的代码,可以使用不开源的服务。

很有意思

那么接下来就附上如何引用这病毒式协议

Copyright (C) <year>  <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

5. LGPL(Lesser General Public License)

LGPL的原来的名字是GNU Library General Public License,表示对于他们的Library允许作为工具的给世界贡献力量。
但是后来又改名为Lesser General Public License,使用Lesser一词表示这应该是少量的。哈哈哈这个组织还是特别的有特色。

这个协议主要为GNU项目的一些类库设计,他与使用任何GPL代码的软件就要遵循GPL协议不同,

  • LGPL允许商业软件通过类库引用方式使用LGPL类库而不需要开源来进行开发商业软件的代码(很仁慈了,支持商业化了)
  • 但是如果对LGPL协议允许的类库中的代码进行任何修改和衍生,则所有修改的代码和衍生的代码都必须采用LGPL协议(还是病毒式那个味,但好很多了)

附上引用LGPL的方法:

Copyright (C) 2020  Mofan Duan

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

6. AGPL(Affero General Public License)

至于AGPL,就是最严的GPL系列协议。其实之前的GPL看起来是病毒式的协议,但是GPL生效的前提是“发布软件”。而到16年左右google使用了FSF组织用GPL协议开源的代码来进行了提供"网络服务式"的商用
因为google并没有发布软件,而只是提供代码的商用,也就是**“付钱的话就让我的代码为你提供服务,不付钱就不行”**,因为在这样的一个网络服务中并没有软件发布,所以GPL就不管用了。

所以FSF在2016年提出了AGPL,填补了网络服务收费商用的漏洞。以后再用AGPL发布的代码就业不能用于网络服务。

由这个学到了,原来GPL协议还有这样的漏洞。。。。

一如既往附上AGPL的引用

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year>  <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

结束

还是挺有意思的。

顺便一提这个博客使用的是

Copyright (C) <2020> <Mofan Duan>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

Q.E.D.

知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

无论在未来前做什么,未来都会普通的到来