# 开源协议

开源软件最重要的就是开源协议,在选择开源轮子的时候为了规避后续的法务问题,选择一个合适的开源协议下的软件尤为重要。

# 常用的商业友好协议

转载阮一峰的开源协议图:https://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html
开源协议

从图中可以看到,如果未来你打算基于开源软件开发配套的闭源软件(甚至为此需要修改开源软件的代码),可以使用的协议主要有 MITApacheBSD

# MIT 协议(最宽松的协议)

https://opensource.org/license/mit/

Copyright <YEAR> <COPYRIGHT HOLDER>

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.

# BSD 协议

https://opensource.org/license/bsd-3-clause/

Copyright <YEAR> <COPYRIGHT HOLDER>

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 copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR 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.

# Apache V2 协议

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

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. 

使用以上的开源协议发布的软件将不会影响到你自己的配套闭源软件。然而当今开源社区部分软件有一些反向操作值得注意⚠️(虽然他们是为了更好的保证自己的权益)—— 在理想的情况下,开源软件如果更改协议通常认为是往更宽松的协议方向改变,这是正常的方向。然而,很多软件确实反向缩紧协议,例如曾经的 React、现在的 Minio,协议的改变将会影响后续的版本更新和维护,对一些商业公司产生重大影响,在选择这类软件时需要非常谨慎。

# 协议曾经有过或者现在仍缩紧的软件

对于这些有缩紧过协议的公司及其相关软件使用的时候需要注意,特别的是如果你自己的个人软件或者企业的商业软件需要盈利的时候。

  1. React

    • 初始 2013 Apache License 2.0
    • 缩紧 2014 BSD + PATENTS License (后进入 Apache 黑名单!)
    • 放松 2017 MIT License

    https://github.com/facebook/react/

  2. Minio

    • 初始 2014 Apache License 2.0
      • 最后一个发行版本:https://github.com/minio/minio/tree/RELEASE.2021-04-22T15-44-28Z,该版本发行在 Apache2.0
    • 缩紧 2021 GUN AGPLv3 License

待补充

# 注意事项

  1. 在使用这些软件的时候还需要注意的是其使用的相关库,例如 react 在改为 MIT 的初期阶段,相关库 react-native 仍然是在 BSD+PATENTS 下发布的。

  2. 如何快速甄别一个软件是否修改过 License 呢?
    如果该软件是使用 git 作为版本控制且发布于开源仓库例如 github (gayhub)、 gitee , gitlab 等时,由于 git appendOnly 的特性,查看其 License 的 commit 记录即可。(当然这种方法无法查看开源者直接重写整颗 git 树删除所有协议再强制更新的情况)

# 总结

拥抱开源软件,尊重开源协议,在参与开发的同时也要时刻注意开源软件协议可使用场景,避免后续的踩坑。

更新于 阅读次数