apache使用,逐句深扒 Apache 許可協議原文,一文看懂!

 2023-10-22 阅读 24 评论 0

摘要:作者 | 衛劍釩來源 | 微月人話(ID:man-mind)我們知道,朋友之間或者有一定信任的人之間發生經濟往來時(比如借貸或租房之類),雖然也會寫借據或合同,但大多比較簡單,一頁紙就完事了,因為通常不會出事,寫

作者 | 衛劍釩

來源 | 微月人話(ID:man-mind)

我們知道,朋友之間或者有一定信任的人之間發生經濟往來時(比如借貸或租房之類),雖然也會寫借據或合同,但大多比較簡單,一頁紙就完事了,因為通常不會出事,寫多了見外。但如果是機構行為,就會嚴謹和正式很多,洋洋灑灑好幾頁,各種通常不會發生的情況都會考慮進去,因為說不準會遇到什么人呢!

MIT許可證就是那種一頁紙的協議,一共就三段話,非常寬松,看樣子基本上不會去打官司。

Apache許可證也很寬松,但行文上就嚴謹很多,篇幅也變長很多(大約是MIT的10倍!),設計者在撰寫時,顯然考慮了種種復雜情況,并隨時準備對簿公堂(雖然極少發生)。

不過許可證稍微一長,大家就沒有耐心看了。更不要說還是法律語言寫成的。

Apache 2.0許可證是ASF(Apache Software Foundation,Apache軟件基金會)在2004年發布的,以幫助ASF實現其目標:“通過開源軟件開發協作,提供可靠且長久不衰的軟件產品”。ASF出品的軟件一般都采用Apache 2.0許可證。當然,非ASF的項目也可以使用,Apache許可證設計出來是供所有人使用的。

有人專門做過分析1,Github上使用率最高的許可證,前5名是MIT、Apache 2.0、GPL 2.0、GPL 3.0和bsd-3-clause。本公眾號已經在前面專門介紹過MIT。

apache使用。本文的目的,是從淺入深弄懂Apache許可證,并完全忠于原文。

文章較長,我將以“步進式”方式解讀,最精華的放在最前面,以便于你在不能讀完的情況下,也能get到精華。

不過,越往后看,會有越多的料。強烈建議讀完。

如果對全文翻譯不感興趣,可以迅速拉過第五節。

注:本文不區分“Apache 2.0許可證”、“Apache許可證”、“Apache協議”,視作完全等同。

Apache一句話要旨

apache端口,Apache許可證全文讀下來,需要一點功夫。

如果你只想記一句話,那就是“要留我的名,改哪了你得說!”


Apache協議精要

從最精簡的角度講,Apache協議想說的是這些:

你可以隨便用!不會因版權和專利找你麻煩的!

不能用我的商標!

apache 2.0協議 可以商用嗎,你分發本作品或衍生作品時,可以不再提供源碼!

你在分發時,必須做到:

1、帶上本許可證!

2、保留本軟件的所有版權、專利等說明!

3、你改過的文件,你得說改了哪!

apache協議可以商用嗎?4、NOTICE文件中的信息得保留!

5、在遵循本許可證的條件下,你可以再許可!

本作品就這樣了,我不會負任何責任的!你想負責你可以負,但別拉上我!


能稍微詳細一點嗎?

下面是一個人話精簡版(對應Apache許可證的第1到9節)。

1、本軟件又叫本“作品”,可以是源碼,也可以是編譯或轉換后的其他形式。“衍生作品”是在本作品的基礎上修改后的有原創性的工作成果。本作品的“貢獻者”包括許可人和其他提交了貢獻的人,以下統稱“我”。

apache2.0開源協議可以商業用途嗎。2.我授予你權利:你可以免費復制、使用、修改、再許可、分發本作品及衍生作品(可以不用公開源碼)。

3. 如果本軟件涉及我的專利(或潛在專利),我在此授予你專利許可,你可以永久性地免費使用此專利,用于制作、使用、出售、轉讓本作品。如果你哪天居然告本作品侵權,你的專利許可在你告我那天被收回。

4.你在復制和分發本作品或衍生作品時,要滿足以下條件。

* 帶一份本許可證;

* 如果你修改了什么,要在改動的文件中有明顯的修改聲明。

* 如果你以源碼形式分發,你必須保留本作品的版權、專利、商標和歸屬聲明。

* 如果本作品帶了“NOTICE”文件,你就得帶上NOTICE文件中包含的歸屬聲明。即便你的發布是不帶源碼的,你也得帶上此文件,并在作品某處予以展示。

* 你可以對自己的修改添加版權說明。對于你的修改或者整個衍生作品,你可以使用不同的許可,但你對本作品的使用、復制和分發等,必須符合本許可證規定。

5. 你提交貢獻就表明你默認遵守本許可的條款和條件。當然,你可以和我簽訂另外的專門的條款。

6. 你不許使用我的商品名、商標、服務標志或產品名。

7. 本作品是“按原樣”(AS IS)提供的,沒有任何保證啊,你懂的。

8. 我可不負任何責任。除非我書面同意,或者法律有這樣的要求(例如對故意和重大過失行為負責)。

9. 你可以向別人提供保證,你可以向別人收費,但那都是你的事,別給我惹麻煩。

注意以上的“我”,既包含了許可人,也包含了每位貢獻者。

上面提到的歸屬聲明,英文是attribution notices,attribution在這里的含義是“歸功于”,或者說是一種credit,表明一個作品歸功于誰。除了歸功于自己之外,歸屬聲明主要強調的是歸功自己用到的其他作品(即第三方作品)。

比如chrome瀏覽器使用了非常多的其他開源作品,在其“關于”中,可以看到:

打開“開源軟件”后,就能看到長長的credit列表。


Asim質疑go-chassis事件

2018年1月,發生了這么一件事,go-micro項目的作者Asim質疑go-chassis項目不合理地使用了其代碼2。

這兩個項目都是使用Apache許可證的。

當時,go-chassis項目在其README中是這么寫的:

意思是說“本項目受go-micro啟發, 但并不是基于它的改善,我們做了更多”。

項目在third-party目錄下放了go-micro的5個源代碼文件,也帶了go-micro的LICENSE文件(內含版權信息),但沒有很明顯地予以歸功(比如在NOTICE文件中)。

1月27日,go-micro的作者Asim,在go-chassis的倉庫下發貼(issue#28)提出異議。

標題是“This is not inspired by go-micro”:

大意是說,“你這哪里是受啟發,你這分明就是基于我代碼的改進,我哪哪都能看到我的代碼。與其直接拿走我的代碼,不如討論一下你能怎么回饋go-micro”。(有81個吃瓜群眾點了贊。)

Asim咄咄逼人的氣勢搞的go-chassis非常窘迫。

很快,go-chassis項目的主要維護人tianxiaoliang承認了錯誤:

1月31日,go-chassis完成了整改,在LICENSE文件和NOTICE文件中都對go-micro給予了credit,并把所有用到的go-micro的文件都放入了third-party目錄下。

2月1日,項目在README中也明確做了說明,承認項目是“基于go-micro”(based on)的。

此事才算暫告一段落。

感興趣的去看看這個issue:

https://github.com/go-chassis/go-chassis/issues/28




下面對Apache協議進行全文翻譯,如果你沒有時間,可以快進到第六節,閱讀后續情況。


全文翻譯!

看到這里,有人會說,上面這些是不是就夠用了?

nonono,那當然是不夠的,如果真遇到事,還是得看原文,一切以原文為準。

而且是以英文為準!在ASF官網上關于Apache許可證的FAQ里,明確指出,翻譯只是便于理解,只有英文版本才有法律效力。

英文全文的官方網址在:https://www.apache.org/licenses/LICENSE-2.0.html

里面的難句都會有分析,可以順便學學英語!

注意:本譯文無意逐字逐詞對照,目的是說清楚,以通達為首要原則。

下面開始:

Apache License

Version 2.0, January 2004

http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION)

Apache許可證

版本2.0,2004年1月

http://www.apache.org/licenses/

使用、復制和分發的條款與條件

1.Definitions.

”License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.

”Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.

1.定義

“許可證”就是有關使用、復制、分發的條款和條件,具體在本文的第1到9節定義。

“許可人”就是使用本許可證進行許可的版權所有人(或版權所有人授權的實體)。

“Licensor”這句的結構是:“Licensor" shall mean the copyright owner( or entity ( authorized by the copyright owner ) )that is granting the License.

”Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.

“法人實體”是指行為實體以及所有控制它的實體、它控制的實體、或和它處于共同控制之下的實體。

“控制”是指:

(i)通過合同或其他方式,直接或間接地,指導或管理該實體的權力。

或(ii)占流通股百分之五十(50%)及以上的所有權。

或(iii)對該實體擁有受益所有權。

注意第一句比較難,其結構是:LE mean the union of the acting entity and all other entities ( that ( control ) , ( are controlled by ) , or ( are under common control with ) that entity. ) ), 最后這個"that entity"就是前面的acting entity。

分解開來就是,LE mean the union of A and entities that control A, entities that controlled by A, entities that are under common control with A.

舉個例子:A是行為實體

A控制了B、C

D、E控制了A

F、G和A都受H控制

那么這個法人實體就是A、B、C、D、E、F、G、H的聯合。

然后是對“控制”的定義,從文字上看,control就是power、就是所有權。這是對的,因為有權的人才能控制。里面的beneficial ownership是“受益所有權”,擁有“受益所有權”的人即最終控制人和最終受益方,也就是我們常說的“實際控制人”。

“法人實體”可簡稱為“法人”。(注意法人不是人,法人是一個組織。)

”You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.

“你”(或“你們”),就是那個正被授予權利的人或者法人。

"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.

“源碼”形式是指便于人類修改的形式,包括但不限于軟件源代碼、源文檔和配置文件。

”Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.

“目標”形式是指“源碼”經過機器轉換或翻譯后的結果,包括但不限于編譯后的目標代碼、生成的文檔以及轉換成的其他媒體類型。

目標代碼(object code)是源碼經編譯后的產物(所謂“目標”),通常是機器代碼(或稱二進制代碼)。這里所說的目標形式,除了目標代碼,還包含將其進一步轉換而成的可執行文件和庫文件。

生成的文檔(generated documentation)通常是指從源碼中自動產生的文檔,如Doxygen之類的工具就可以干這種事。

什么是媒體類型(media type)?像文本、音頻、視頻、圖片等等這些都是媒體形式,可以想象一下這些類型:pdf格式的源碼、視頻形式的源碼,圖片格式的源碼,甚至是音頻形式的源碼(有點意思!),不過,這些類型都不便于人類修改,還是純文本的源碼最好!!

”Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).

“作品”是指可通過本許可證獲取的作者的工作成果,它以源碼形式或目標形式存在,作品含有或附有版權提示。(本許可證附錄部分有樣例)

”Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.

“衍生作品”是指基于(或源于)某“作品”的原創性工作成果,其所做的編輯修訂、注釋、深化或其他修改等等,從整體而言,有原創性。就本許可而言,衍生作品不應包括這些作品:可與本衍生作品分離的作品、僅僅通過接口鏈接(或綁定)起來的作品。

上面這段第一句這樣讀:”Derivative Works" shall mean any work, ( whether in Source or Object form, )?that is based on?( or derived from )?the Work and?( for which ) the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, )?an original work of authorship.

and for which那個從句,可以看成是:and the editorial revisions…… for the Work, as a whole, is an original work of authorship.

"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."

“貢獻”包括作品的原始版本以及對該作品或衍生作品的任何修改或增補,這些內容是版權人(或是被版權人授權的個人或法人)有意“提交”給許可人以將其包含在作品中的。“提交”可以通過電子、口頭或書面形式,包括但不限于電子郵件列表,源碼控制系統、問題跟蹤系統等(這些系統通常是許可人用來討論和改進作品的),但是那些被顯著標識了“并非貢獻”的內容,不能視為被提交的內容。

注意這里有許可人(Licensor)和版權人(copyright owner )的區別,許可人在上面有定義,就是發布許可的人,版權人不僅包括主作者,也包括提交修改的作者;同樣的,貢獻不僅包括那些修修補補,也包括主作品本身。

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.

“貢獻者”是指許可人以及那些做出貢獻的個人或法人。許可人從這些人手中接收貢獻并將其納入到作品中。

這句這樣讀:”Contributor" shall mean Licensor and any individual or Legal Entity?( on behalf of whom ( a Contribution has been received by Licensor ( and subsequently incorporated within the Work. ) )

比較難懂的是on behalf of whom這塊,是誰代表了誰?

是“Contribution”代表了前面的“any individual or Legal Entity”,這個句子的后半部分其實就是:on behalf of an individual or a Legal Entity, a Contribution has been received and incorporated by Licensor .

2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.

2. 版權許可。在遵守本許可的條款和條件的前提下,每位貢獻者特此授予你永久的、全球性的、非排他性的、免費的、免版稅的、不可撤銷的版權許可,以復制、準備衍生作品、公開展示、公開使用、再許可、分發本作品和其衍生作品(無論是以“源碼”還是“目標”形式)。

非排他性是指不限定只給某人、某團體、某地區等等,而是給所有人都一樣的權利。

不可撤銷是指一旦授予,將不能再收回。

關于再許可(sublicense)的理解:你是本許可的被許可人(licensee),所謂再許可,就是你分發作品時,可以再次向你的licensee進行許可。至于具體有什么要求,要看許可證第4節第5款。

3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this p) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.

3.專利許可。在遵守本許可的條款和條件的前提下,每位貢獻者特此授予你永久性的,全球性的,非排他性的,免費的,免版稅的,不可撤銷的(本節列出的例外除外)專利許可,用于制作、委托制作、使用、要約出售、出售、進口、轉讓本作品,你獲得的專利許可,僅僅是有權利向你許可的貢獻者授予你的,該貢獻者的貢獻或者其貢獻和本作品結合起來后,不可避免地造成了對該貢獻者專利的侵權。如果你針對任何實體(包括訴訟中的交叉索賠或反索賠)提起專利訴訟,指稱本作品或貢獻直接或間接構成侵權,則本許可授予你的任何專利許可在訴訟提起之日終止。

這段比較難理解,也容易被誤解3、4。

where引導的這個從句比較復雜:where such license applies only to those patent claims?( licensable by such Contributor )?that are necessarily infringed?( by their Contribution(s) alone or by combination of their Contribution(s) with the Work ( to which such Contribution(s) was submitted. ) )

上面這段文字可以說的再明白一些:如果作品涉及了某位貢獻者的專利(他可能已經擁有專利了,或者以后會擁有專利5),那么,貢獻者在此授權你可以實施該專利,(注意你并不是擁有專利,而是獲得了專利的實施權),使得你可以制作、使用、……銷售作品。(如果不給你專利授權,你是沒有權利做這些事的)

如果你提起訴訟說本作品侵犯了什么專利,那么我們立即撤回已經授予你的專利許可。我總不能讓你用了我的專利,然后你又反過來告我吧!(比如你將其修改后,申請了新的專利,然后說我侵權。)

make是自己制作,have made是讓別人制作

contributory infringement可以翻譯為共同侵權或間接侵權,本文譯作間接侵權。比如曾有電影公司狀告BT造成間接侵權(共同侵權)。

4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:

4.重新分發。你可以復制和分發本作品或衍生作品,可通過任意媒介,可以修改或者保持原樣,可以是源碼形式或目標形式,但前提是滿足以下所有條件。

* You must give any other recipients of the Work or Derivative Works a copy of this License; and

* 你必須給接收者一份本許可證的拷貝;

* You must cause any modified files to carry prominent notices stating that You changed the files; and

* 你必須在任何修改過的文件中,帶有明顯的聲明,表明你已更改文件;

* You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work,excluding those notices that do not pertain to any part of the Derivative Works; and

* 在你分發的衍生作品的源代碼中,你必須保留本作品源碼中的所有版權、專利、商標和歸屬聲明,但與衍生作品無關的除外;

上面這段要求了在源碼中“留名”。注意那個excluding,對于那些在你衍生作品中已經不存在的部分,就不用再留名了。

* If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.

* 如果本作品在分發時包含了一個“NOTICE”文本文件,則你分發的任何衍生作品都必須要有該NOTICE文件所包含的歸屬聲明(與衍生作品無關的聲明除外),該歸功應位于以下至少一個位置中:衍生作品分發時所帶的NOTICE文件;衍生作品所帶的源碼或文檔;衍生作品生成的展示頁面中(如果能正常顯示這些第三方聲明,不管在什么地方都行)。NOTICE文件的內容僅僅是信息性的,不可以修改其中的許可證。你可以在衍生作品中附加自己的歸功,在NOTICE文本里面直接添加或者以附錄形式出現,前提是附加的歸功不能造成對許可證的更改。

上面這段濃墨重彩地強調了對“留名”的要求,包括對第三方作品的留名。

尤其是,即便不帶源碼,也要留名。

third-party notices是指第三方作品的聲明,比如你在A的基礎上發布衍生作品B,你和用戶是第一、二方,你用到的A以及其他作品就是第三方了。后面章節會有實例說明這點。

值得注意的是,很多使用Apache許可證的項目,并沒有帶NOTICE文件,而是會有類似CREDITS這樣的文件,原則上應該把這類文件等同于NOTICE文件對待。(ASF的項目通常都很規范,都會帶一個NOTICE文件)

“if and wherever such third-party notices normally appear. ”這句不太好理解,他的意思是,首先你要能展示(if),才有此要求,有的軟件根本沒有任何地方可以顯示信息(比如一個完全沒有顯示屏的硬件中),那就不做這個要求。如果能展示,那就不限定在哪里(wherever)展示。

* You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise?complies with the conditions stated in this License.

* 在你自己的修改中,你可以添加你的版權聲明,并可提供附加的或不同的許可條款和條件,以供他人使用,復制或分發你的修改或整個衍生作品,前提是你對本作品的使用、復制和分發等符合本許可規定的條件。

這段主要說的是“再許可”(sublicense),一個作品A被人拿來做了修改產生了作品B,他在分發B時,可以加上其他許可條款,也可以使用完全不同的許可條款,但他在使用A、修改A、生成B、分發B時,都必須遵循本許可證。

其中的otherwise在這里并非“否則”的意思,而是“其他”、“等等”的意思,指的是A、B、C and otherwise。

5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.

5.提交貢獻。除非你另有明確說明,否則你有意提交給許可人的任何貢獻(用于包含在作品中)都默認遵守本許可的條款和條件,并且再沒有任何其他的條款或條件了。盡管是上面這么說,本文中的任何內容都不能取代或修改你和許可人之間(可能)另外簽訂的有關此貢獻的其他任何條款。

6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.

6.商標。本許可不授權使用許可人的商品名、商標、服務標志或產品名,除非在描述本作品來源時和復制NOTICE文件時,有必要合理地、符合常規地引用。

7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.

7.沒有保證。除非適用法律要求或以書面形式同意,否則許可人是“按原樣”提供本作品的(每個貢獻者也如是提供其貢獻),沒有任何類型保證或條件(無論明示或暗示的),包括但不限于任何權利擔保、非侵權保證,適銷性保證、適用性保證或條件。你自行負責確定使用或重新分發本作品的適當性,并承擔和你行使權利(本許可授予你的)有關的任何風險。

WARRANTY OF TITLE即“權利擔保”,是指賣方應保證其出售的貨物享有合法的權利,沒有侵犯任何第三人的權利,并且沒有任何第三人就該貨物向買方主張任何權利。

8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.

8.責任范圍。不論是任何情況或任何法理依據,任何貢獻者均不會對你的損失承擔責任,無論其產生于侵權(包括過失)、合同還是其他情形,除非適用法律要求(例如故意和重大過失行為)或書面同意。這些損失包括由于本許可產生的、或由于使用或不能使用本作品而引起的、任何直接的、間接的、特殊的、偶然的、或伴隨結果而產生的任何性質的損失(包括但不限于因商譽受損、停工、計算機故障或失效、以及任何其他商業性損壞而帶來的損失),即使貢獻者已經被告知此類損失的可能性。

9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License.However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.

9.承擔保證或其他責任。在重新分發本作品或其衍生作品時,你可以提供支持、保證、擔保以及其他責任、義務及權利,并因此收費,但必須滿足以下前提:符合本許可證的條款條件;在承擔這些責任時,你只能代表你自己(也只能單獨承擔責任),不能代表任何其他貢獻者;如果因你承擔這些保證和責任導致任何貢獻者產生任何損失或被追責,你同意擔保、保護每位貢獻者不受損失和免于責任。

END OF TERMS AND CONDITIONS

條款和條件結束

第9節However后面那句比較長,看起來容易犯暈。其結構是這樣的:in accepting such obligations,?You may act only on Your own behalf and on Your sole responsibility, ( not on behalf of any other Contributor, and )?only if You agree to indemnify( , defend, and hold each Contributor harmless )?for any liability( incurred by ( , or claims asserted against, ) such Contributor )?by reason of your accepting any such warranty or additional liability.

indemnify主要指“擔保不受到損失或損害,即便受到損失也同意予以補償”,hold harmless是指“自己承擔責任而免去對方的責任”。

APPENDIX: HOW TO APPLY THE APACHE LICENSE TO YOUR WORK

附錄:如何在你的作品中使用APACHE許可證

You should include a copy of the Apache License, typically in a file called LICENSE, in your work, and consider also including a NOTICE file.

你應該在作品有一個LICENSE文件,里面是Apache許可證的拷貝,你還應考慮放一個NOTICE文件。

To apply the Apache License to specific files in your work, attach the following boilerplate declaration, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.

將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 athttp://www.apache.org/licenses/LICENSE-2.0Unless 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.

上面這段不翻譯了,原樣放上去就是了。


go-chassis事件后續

還記得上面說的go-chassis事件嗎。

我以前對此并不了解,研究Apache許可證之后才發現還有過這事。

我當然要去求證一下。

于是便去github倉庫上看,令我非常驚訝的是,在其third-party目錄下,已經沒有了go-micro。

仔細翻了翻history,才發現,2018年3月28日, third_party/forked/go-micro目錄被移除干凈。

同日,PR#151以標題“adjust license&notice”出現,提議在LICENSE、NOTICE和README中,刪掉go-micro。該PR得到了項目維護人tianxiaoliang的approve。

asim在issue#28里再次表達了他的不滿:

并在PR#151的對話中寫道:

大意是說,“你的作品是基于go-micro的,即便你修改和清除了go-micro的代碼,你也是基于我而來的,你不能刪掉我的版權和許可。我仍然可以指出你的哪部分代碼像我的。”

不過這次抗議并沒有得到回應。

2018年9月17日,README中刪除了“本項目基于go-micro”這句。

2019年10月22日,NOTICE中的歸功被刪掉,licenses/LICENSE-go-micro文件被刪掉。

至此,go-chassis和go-micro不再有關系了。

asim也沒有再說什么。

我又去看看了go-micro,發現asim雖然維權意識很強,但在版權聲明上做的還不夠,go-micro項目沒有NOTICE文件(這個還好,這不是必須的,尤其是沒有第三方可以歸功的時候);在所有的源文件中,都沒有版權和許可信息,只是在LICENSE文件中Apache許可證的附錄部分,聲明了一下版權(這種做法也不常見,通常是不動Apache許可證整個內容的):

另外一點讓我感覺意外的是,go-chassis雖然說已經和go-micro無關了,但刪的并不干凈,在其代碼中還是能找到go-micro的字樣!

下面是在go-chassis中搜索go-micro的結果(2020年5月10日):

我只能認為,這可能是個疏忽。


我該怎么歸功?

從Apache許可證和一些糾紛看,大家是很重視“留名”的。

畢竟,做開源的人,如果連“名”都圖不上,那可就差點意思了。

如何留下作者和貢獻者的名?

常見的做法是源代碼里面留名。源碼的首部應該放上版權信息和許可信息。但我在github上翻了翻,發現很多項目并沒有做到這點,有的完全沒有版權和許可信息,有的則是只寫許可不寫版權。

究其原因,估計作者一是太懶,二是沒有這個意識。

做得比較好的項目,不僅在源碼中有聲明,還會專門在根目錄下放上諸如AUTHORS、CONTRIBUTORS、OWNERS、CREDITS這類文件,對作者和貢獻者予以明確的歸功。(這些不是必須的,但是推薦的。)

關于版權那行,有一種寫法是很講究的6,值得欣賞和學習:

Copyright <year> <primary authors> and contributors

比如下面這個例子:

這并不是必須的,因為即便不這么寫,貢獻者也是自動擁有其版權的。只不過這樣寫,顯得格外尊重貢獻者。

如何留下作品的名?

如果你使用(或依賴)了第三方作品,要在NOTICE和LICENSE中說明。

NOTICE文件是專門干這事的。

對于ASF的項目,一般都會有NOTICE文件,但非ASF項目,用的就不太多,即便是使用Apache許可證的。

下面是Kafka項目的NOTICE文件,屬于比較標準的ASF項目寫法。除了致敬所用到的ASF作品外,Kafka特意對jersey做了歸功(以下為NOTICE全文)。

在下面這個非ASF項目Hangfire7中,其NOTICE文件也很規范,文字表述非常詳盡,值得學習(以下為文件首部)。

關于LICENSE文件,除了放本項目的許可證,還應放上所用其他項目的許可證。下面以Apache Kylin項目為例看一下,Kylin使用了一些其他作品(它稱為子部件,subcomponent),這些作品使用的許可證在LICENSE文件中作了說明:

注意上面的截圖,是從207行開始的,上面的200多行,就是Apache許可證全文,然后是他所用到子部件的許可證。

如果用到的作品比較多,也可以專門建一個licenses目錄做這件事,go-chassis就是這樣做的。

為了很好地對貢獻者和第三方作品致敬,有的項目還會在網站上予以展示:

比如selenium項目8就密密麻麻地列出了貢獻者的名字和頭像,看上去頗為壯觀。

以下僅僅為部分節選,有興趣的話可以去其網站觀摩一下。

總之,盡可能尊重貢獻者和你用到的作品,充分地給予他們榮譽。這是開源人應有的禮儀。


關于“再許可”的迷思

為了更好理解Apache許可證,現在看一個我虛構出來的測試案例。

Alice有一個作品A,用Apache許可證發布,里面只有一個foo.c,文件的內容可概括為:

版權 年份 Alice

Apache許可信息

源碼

作品還帶了一個LICENSE和NOTICE。LICENSE里面就是Apache許可證全文。NOTICE里聲明了Alice對A的版權所有(也即對自己歸功)。

現在Bob復制了作品A,把foo.c略微修改了一下,改為:

版權 年份 Alice

“各位注意:我修改了許可信息,從Apache改為了MIT”

MIT許可信息

源碼(未做實質性改動)

Bob原樣保留NOTICE,在LICENSE中放了兩個許可證:MIT許可證、Apache許可證。

Bob將這個作品命名為B,然后開始分發B。

這樣,Bob從實質上把A從Apache許可證轉成了MIT許可證。這意味著用B的人無需遵守Apache協議了,我們知道,MIT協議比Apache更寬松,現在,用B的人連修改哪了都不用說了。?

Alice發現這個情況,說,“你這算什么啊,還有你這種騷操作?”

Bob說,“我怎么了,我違反哪一條了?”

從行為上看,B保留了A的版權信息,保留了許可證信息,聲明了修改,保留了歸屬信息。這一切都遵循了Apach許可證的條款和條件。

Alice翻遍許可證,犀利地指出:

“根據第4節第5條,你只能對你修改的部分修改許可。”

Bob說:“那條還說了,我可以對整個衍生作品修改許可!”

Alice又翻了翻許可證,再次犀利地指出:

“根據第1節對衍生作品的定義,你這不是衍生作品!因為你沒有原創性!”

Bob:“……”

Bob翻了翻許可證,說:“好吧,我這不是衍生作品,但我確實有權利修改這個文件,而且我對我修改的部分做了聲明,我還保留了你的版權和歸屬,我的所有操作都沒有違反Apache許可證要求。”

Alice:“……”

你怎么看呢。

也許ASF是允許這種情況的,具體要看ASF如何解釋Apache許可證了。

為了遏制這種情況,A應該將自己的版權、倉庫地址、License都放在NOTICE文件中。

這樣,即便一個人拿到B,他也會知道B其實就是A,A的原License是什么,源代碼在哪里。這個人可能會更傾向于直接使用A,畢竟A更正宗。

本文版權屬于衛sir,采用CC-BY許可。(轉載請保留此行)

  1. https://www.kaggle.com/mrisdal/safely-analyzing-github-projects-popular-licenses?

  2. https://mp.weixin.qq.com/s/ipvkZYp_z8173-Q0SPCmDQ?

  3. Jeffrey Robert Kaufman:?https://opensource.com/article/18/2/how-make-sense-apache-2-patent-license?

  4. 薛亮:如何理解Apache 2.0許可證中的專利許可條款?https://linux.cn/article-9402-1.html

  5. http://www.apache.org/foundation/license-faq.html#PatentScope?

  6. https://opensource.stackexchange.com/questions/5508/what-does-and-contributors-in-the-copyright-byline-imply?

  7. https://www.hangfire.io/licensing/third-party.html?

  8. https://www.selenium.dev/documentation/en/front_matter/copyright_and_attributions/?

更多精彩推薦
?一文濃縮 60 年,程序員不可不知的開源秘史!
?CSDN總部落戶長沙,共建中國開發者產業中心城市!
?AI 修復 100 年前晚清影像喜提熱搜,有穿越內味兒了!
?CycleGan人臉轉為漫畫臉,牛掰的知識又增加了!| 附代碼
?觸發死鎖怎么辦?MySQL 的死鎖系列:鎖的類型以及加鎖原理了解一下!
?帶血的戰士| 吳忌寒傳
你點的每個“在看”,我都認真當成了喜歡

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/161789.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息