ソフトウェア再利用時における ライセンス違反検出技術に関する研究 コンピュータサイエンス専攻 井上研究室 博士後期課程3年 真鍋雄貴 2011/7/6-公聴会 1 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ソフトウェアの再利用 • 既存のソフトウェアに含まれるソフトウェア部品を新たな ソフトウェアの開発に利用すること – ソフトウェア部品:ソースファイル,クラス,関数など • オープンソースソフトウェアがソフトウェア部品の大きな 供給源 • ソフトウェア部品検索システムにより,オープンソースソ フトウェアのソースファイルの取得が容易になっている – Google Code Search, Koders, SPARS オープンソースソフトウェアを用いた ソースファイル単位のソフトウェアの再利用に着目 2011/7/6-公聴会 Yuki Manabe 2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 著作権 • 著作物の利用に関して,著作者に与えられる独占 的権利 – 知的財産であるソフトウェアを法的に保護する仕 組みの一つ – 利用:複製,改変,再配布 • ソフトウェアの再利用を行うためにはそのソフトウェ アの著作者から許諾を得る必要がある 2011/7/6-公聴会 Yuki Manabe 3 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ソフトウェアライセンス • 著作者が定めた,利用に関する許諾と許諾を得るため の要求や義務 • オープンソースソフトウェアの場合,指定されているライ センスに従えば利用することができる – 再利用する対象のライセンスを調べないといけない • オープンソースライセンス – Open Source Initiativeが承認(66種) (例)GNU General Public license version 3(GPLv3), BSD4項ライセンス(BSD4)など 2011/7/6-公聴会 Yuki Manabe 4 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス違反 • 再利用されたソースファイルのライセンスと再利用先の ソフトウェアのライセンス間で不整合が生じていること • ソースコードの公開や,販売停止に追い込まれるかもし れない • ライセンスを正しく確認せずに再利用を行うと発生 ライセンス違反を防止したい 開発中のソフトウェアで発生している ライセンス違反を検出する 2011/7/6-公聴会 Yuki Manabe 5 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス違反検出問題 各ソフトウェアについて,各ソフトウェアのライセンスと,再利用して いるソフトウェアから到達できるライセンス集合を比較し,矛盾の有 無を判定する問題 第2章,第3章 ソフトウェア 特定 ライセンス GPL LGPL 第4章 再利用 EPL BSD3 … 2011/7/6-公聴会 UNKNOWN Yuki Manabe 6 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 論文構成 • 第1章 はじめに ライセンス特定 • 第2章 階層的ライセンス知識を用いたライセンス特定ツー ルの開発[1-1][1-2] • 第3章 オープンソースソフトウェアにおけるライセンス分布 の調査[1-3][1-4] ソフトウェア再利用検出 • 第4章 コードクローンメトリクスに基づくソースコード再利用 判定閾値の決定手法[1-5] • 第5章 むすびに 2011/7/6-公聴会 Yuki Manabe 7 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 第2章 階層的ライセンス知識を用いたライ センス特定ツールの開発 2011/7/6-公聴会 Yuki Manabe 8 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 概要 • 問題点 ライセンス記述の表記ゆれなどのため,既知のライ センス記述とコメントとの簡単な照合では特定でき ない • 研究内容 – ライセンス特定での課題を調査した – 階層的ライセンス知識を用いたライセンス特定手 法の提案 – 提案手法の実装Ninkaと他のライセンス特定ツー ルと精度の点で比較 2011/7/6-公聴会 Yuki Manabe 9 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス特定 • ソースファイルからそのソースファイルのライセンスを 決定する作業 • ソースファイルのライセンスはコメント中で指定される – ライセンスを指定する記述をライセンス記述と呼ぶ • ソースファイル中のライセンス記述と既知のライセン ス記述と照合することにより,ライセンスを特定する 2011/7/6-公聴会 Yuki Manabe 10 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス記述の例 Copyright (c) 2005, 2006 Taras Puchko AllCopyright rights reserved. (c) 2003, the JUNG Project and the Regents of the University of California Redistribution and use in source and binary forms, with or without All rights reserved. modification, are permitted provided that the following conditions areThis met: software is open-source under the BSD license; see either 1. Redistributions "license.txt" or of source code must retain the above copyright notice, this list of conditions and the following disclaimer. http://jung.sourceforge.net/license.txt for a description. 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 holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. ... 2011/7/6-公聴会 Yuki Manabe 11 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス記述の表記ゆれ • 綴り間違いや単語の同義語への変更などの表記揺れ – (例) "license" → "licence" • ソースファイルにより変化する著者名や組織名 – (例) “Neither the name of the <ORGANIZATION> nor the names of its contributors…” – ソースコード中のライセンスの記述と既知のライセン ス記述を単純に照合するだけでは特定することは困 難 • どのような要因が照合を困難にするかよくわかっ ていない 2011/7/6-公聴会 Yuki Manabe 12 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス特定の課題調査 Linux, Eclipse JDT, OpenBSD, Mozilla などに含まれるソー スファイル30000ファイルを対象に調査 得られた課題 – ライセンス記述の表記揺れ • 綴り間違い,著者名や団体名への記述,文法や つづりの変更 – 著作者による既存のライセンスの修正 • 条項の追加,削除 – ソースファイルとは異なるファイルへの参照がある – 複数のライセンスが含まれる 2011/7/6-公聴会 Yuki Manabe 13 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス特定ツールに 求められる要件 • 多くの表記ゆれを考慮してライセンスを特定できる ⇒OSSを多数調査する • 新しいライセンス記述への適合が容易 ⇒短いルールとしてライセンスルールを定義できる こと • 高速に処理できる ⇒スケーラビリティの高い,高速な処理 2011/7/6-公聴会 Yuki Manabe 14 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 提案手法 ソースファイル 凡例 (1)コメント抽出 処理 コメント データ (2)コメントの文への分割 文 キーワード (3)ライセンスに関係ない文の除去 ライセンスに関する文 ライセンス知識 (4)メタライセンス文とのマッチング メタライセンス文 メタライセンス文の列 (5) ライセンスルールとのマッチング 2011/7/6-公聴会 ライセンス名 ライセンスルール OSS Corpus (30000 files) • Linux • Eclipse JDT • OpenBSD • Mozilla etc... Yuki Manabe 15 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 コメント抽出 /* /* Copyright(c) (c)2001 2001foo [email protected] [email protected] Allrights rightsreserved. reserved. **Copyright ** Redistributionand anduse useininsource sourceand andbinary binaryforms, forms,with withor orwithout without **Redistribution modification,are arepermitted permittedprovided providedthat thatthe thefollowing followingconditions conditions **modification, aremet: met: **are Redistributionsof ofsource sourcecode codemust mustretain retainthe theabove abovecopyright copyright **1.1.Redistributions ...... Redistributionsininbinary binaryform formmust mustreproduce reproducethe theabove abovecopyright copyright **2.2.Redistributions ...... ** THISSOFTWARE SOFTWAREISISPROVIDED PROVIDEDBY BYTHE THEAUTHOR AUTHORAND ANDCONTRIBUTORS CONTRIBUTORS...... **THIS INNO NOEVENT EVENTSHALL SHALLTHE THEAUTHOR AUTHOROR ORCONTRIBUTORS CONTRIBUTORS...... **IN */ */ #include <sys/cdefs.h> #include <sys/types.h> #include <sys/types.h> … 2011/7/6-公聴会 先頭にあるコ メントをライセ ンス記述とし て抽出 Yuki Manabe 16 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2 コメントの文への分割 /* [Copyright (c) 2001 foo [email protected] All rights reserved. ] *[Redistribution Copyright (c) 2001 foo in [email protected] rightsforms, reserved. and use source andAll binary with or without *modification, are permitted provided that the following conditions are *met:] Redistribution and use in source and binary forms, with or without *[1.] modification, are permitted provided that the following conditions *[Redistributions are met: of source code must retain the above copyright notice...] [3]に基づくアル ゴリズムといくつ *[2.] 1. Redistributions of source code must retain the above copyright かのヒューリス ... [Redistributions in binary form must reproduce the above copyright ...] ティックにより分 *[THIS 2. Redistributions binary form mustAUTHOR reproduce theCONTRIBUTORS above copyright SOFTWARE ISin PROVIDED BY THE AND 割 ... "AS IS"...] *[IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS ...] * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ... * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS ... */ [3] P. Claugh. A Perl program for sentence splitting using rules. http://ir.shef.ac.uk/cloughie/software.html, April 2001. 2011/7/6-公聴会 Yuki Manabe 17 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 3 ライセンスに関係ない文の除去 [Copyright foo [email protected] [email protected] All [Copyright (c) (c) 2001 2001 foo All rights rights reserved. reserved. ]] [Redistribution use in [Redistribution and and use in source source and and binary binary forms, forms, with with or or without without modification, modification, are are permitted permitted provided provided that that the the following following conditions conditions are are ライセンスに関係 met<colon>] met:] met:] のない文を除去 [1.] [1.] [Redistributions [Redistributions of of source source code code must must retain retain the the above above copyright copyright notice...] notice...] [2.] [2.] [Redistributions binary form form must must reproduce [Redistributions in in binary reproduce the the above above copyright copyright ...] ...] [THIS [THIS SOFTWARE SOFTWARE IS IS PROVIDED PROVIDED BY BY THE THE AUTHOR AUTHOR AND AND CONTRIBUTORS CONTRIBUTORS <quotes>AS “AS IS”...] IS<quotes>...] “AS IS”...] [IN EVENT SHALL ...] DAMAGES ...] [IN NO NO EVENT SHALL THE THE AUTHOR AUTHOR OR OR CONTRIBUTORS CONTRIBUTORS ... ...DAMAGES…] 文が残っていない ⇒"NONE” キーワード ライセンスに関係ある文に よく含まれる語句 all rights, conditions, distributions, reproduce, damages, as is 2011/7/6-公聴会 Yuki Manabe 18 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 4 メタライセンス文とのマッチング [Copyright (c) 2001 foo [email protected] All rights reserved. ] [AllRights] and use in source and binary forms, with or without [Redistribution modification, [BSDPre] are permitted provided that the following conditions are BSDcondSource met:] [BSDcondSource] [Redistributions of source code must retain the above copyright notice...] [BSDcondBinary] [Redistributions in binary form must reproduce the above copyright ...] [THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS [BSDasIs] “AS IS”...] [BSDWarr] [IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS ...] マッチング メタライセンス文 2011/7/6-公聴会 BSDcondSource:Redistributions? of source code must retain the (above )?copyright notice, this list of conditions(,)? and the following disclaimer(, without modification)?: Yuki Manabe … 19 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 5 ライセンスルールとのマッチング [AllRights][BSDPre][BSDcondSource][BSDcondBinary][BSDasIs][BSDWarr] マッチング BSD2 (BSD 2-clauses license) ライセンスルール 一致するライセンスルールなし → "UNKNOWN" BSD2:BSDPre, BSDcondSource, BSDcondBinary, BSDasIs, BSDWarr ライセンスルールはライセンス名とメタライセンス文名の列との 関係を表現する Yuki Manabe 2011/7/6-公聴会 20 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 評価実験 • 目的: Ninkaがほかのツールより優れていることを示す • 手法: 手で特定した結果とツールが出力した結果を比較する • 使用したツール: Ninka(提案手法の実装), FOSSology 1.0.0, ohcount version 3.90rc, OSLC 3.0 • 使用したソースファイル: Debian5.0.2に含まれるソースファイル250個 – Debian 5.0.2のパッケージのうち,250個をランダムに選択 – 各パッケージから1ファイルランダムに選択 2011/7/6-公聴会 Yuki Manabe 21 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 結果 Ninka 回答率[%] 正答率 [%] 正答率(名前 のみ) [%] 実行時間[s] FOSSology ohcount OSLC 82.8 96.6 97.1 99.6 55.0 88.7 100 33.2 88.0 100 22.8 26.0 22 923 27 372 回答率:どれだけの実験対象に対して,回答を出 力できたか 正答率:出力された回答が手で特定された結果と どれだけ一致しているか 2011/7/6-公聴会 Yuki Manabe 22 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 第2章のまとめ • 複数の大規模オープンソースソフトウェアからライセンス 特定の課題を調査 • ライセンス特定ツールの要件を満たすライセンス特定手 法を提案 – より柔軟にライセンス知識を記述できる – 従来手法と比べ,正答率,実行時間の点で優れてい た • ライセンス違反検出で重要なライセンスの特定を精度よ く,高速にできるようになった • Ninkaは以下のサイトにて公開中 http://ninka.turingmachine.org/ 2011/7/6-公聴会 Yuki Manabe 23 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 第3章 オープンソースソフトウェアにおける ライセンス分布の調査 2011/7/6-公聴会 Yuki Manabe 24 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 概要 • 問題 ライセンスが変更されるのか,またその頻度はどの くらいあるのかが分からないため,どの程度ライセ ンス特定を行う必要があるか不明 • 研究内容: Ninkaを用いていくつかの大規模なFOSSについて, 複数のリリースのライセンスを解析し,リリースごと にどのようにライセンス分布が変わるかを調査 2011/7/6-公聴会 Yuki Manabe 25 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 解析対象 Type Release Version FreeBSD OpenBSD Eclipse ArgoUML OS kernels OS kernels SDE platform UML Design Tools 2.2-8.0 2.0-4.7 2.03.5.2 0.8.10.31.1 1994/112009/11 1996/102010/5 2002/62009/9 2000/102010/6 28 45 25 79 #Files (oldest-latest) 6273490 9873314 1141935880 6862208 Version Control System CVS CVS CVS Subversion Release Date # release 2011/7/6-公聴会 Yuki Manabe 26 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University FreeBSDにおける ライセンス分布 4000 3500 3000 #files 2500 2000 1500 1000 500 0 Release Version BSD4 BSD3 BSD2 InterACPILic CDDLic Others NONE UNKNOWN 2011/7/6-公聴会 Yuki Manabe 27 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Eclipseにおけるライセンス分布 45000 40000 35000 25000 20000 15000 10000 5000 CPLv0.5→CPLv1.0 3.5.2 3.5.1 3.5 Release Version CPLv1.0→EPLv1.0 EPLv1 CPLv0.5 CPLv1 MPLv1_1 BSD3 Others NONE UNKNOWN 2011/7/6-公聴会 3.4.2 3.4.1 3.4 3.3 3.3.2 3.3.1.1 3.3.1 3.2.2 3.2.1 3.2 3.1.2 3.1.1 3.1 3.0.2 3.0.1 3.0 2.1.3 2.1.2 2.1.1 2.1 2.0.1 0 2.0 #files 30000 Yuki Manabe 28 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 第3章のまとめ • 複数のFOSSについて,リリースごとにどのようにライセ ンス分布が変わるかを調査 – FreeBSDやOpenBSDにおいて,大規模なライセンス の変化がある – ArgoUMLやEclipseについても類似した変化がある • FreeBSD やOpenBSD と比べてさらに劇的に変化 する場合がある • 少数のライセンスがシステムの大半をカバーして いる • 各ソースファイルのバージョン毎にライセンス特定を行う 必要があることを示した 2011/7/6-公聴会 Yuki Manabe 29 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 第4章 コードクローンメトリクスに基づく ソースコード再利用判定閾値の決 定手法 2011/7/6-公聴会 Yuki Manabe 30 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 概要 • 問題点 – ソフトウェア間で再利用が行われているかを判定 する明確な基準が存在しない • 研究内容 – コードクローンに基づく再利用検出手法のための 閾値を実験的に決定する手法の提案 – 提案手法により決定された閾値を用いて,大半 のソフトウェア再利用の有無を判定できた 2011/7/6-公聴会 Yuki Manabe 31 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University コードクローン • 他のコード片と類似または一致するコード片 • 再利用された部分がコードクローンとして検出できる可 能性がある – 再利用の方法のひとつがコピーアンドペースト – コードクローンもコピーアンドペーストで生成されうる • コードクローンメトリクス – コードクローンから算出できる尺度 コードクローン 2011/7/6-公聴会 Yuki Manabe 32 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 想定する再利用検出手法 判定対象の ソフトウェアの組 1.コードク ローンメトリク ス値の算出 コードクローン メトリクス値 再利用が行わ れているとみ なす閾値 2011/7/6-公聴会 再利用が行わ れていないと みなす閾値 判定結果 2.判定 再利用あり or 再利用なし or 不明 Yuki Manabe 33 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ソフトウェアの間では 再利用が行われている 不明 290 270 250 230 210 190 170 150 再利用が行われている とみなせる閾値 130 110 90 70 50 1.0 0.9 ソフトウェアの間では 0.8 再利用は行われていない 0.7 0.6 0.5 0.4 0.3 0.2 再利用が行われていない 0.1 とみなす閾値 0.0 30 割合 判定方法 コードクローンメトリクスの大きさ (例:最大コードクローン長) 2011/7/6-公聴会 Yuki Manabe 34 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 閾値決定手法 ソフトウェアの組の集合 再利用がある場合の 正解集合 3.閾値の 算出 1.正解集合 の作成 3.閾値の 算出 再利用がない場合の 正解集合 2.コードクローン メトリクス値の算 出 2011/7/6-公聴会 再利用 ありと みなす 閾値 再利用 なしと みなす 閾値 コードクロー ンメトリクス 値 Yuki Manabe 35 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 閾値の算出 • 各正解集合と各ソフトウェアの組のクローンメトリクス値から,適合率を算 出する – 適合率:検出した組のうち,正解集合に含まれる組が占める割合 • 適合率が1になる定義域から閾値を決定する 閾値を超えた組を再利用あり とみなした場合の適合率 1.0 適 合 率 閾値を下回る組を再利用なし とみなした場合の適合率 0 コードクローンメトリクス値 再利用なしとみ なせる閾値 2011/7/6-公聴会 再利用ありとみ なせる閾値 Yuki Manabe 36 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 実験 • 目的 – 提案した手法により,閾値が決定でき,求めた閾 値を用いてソースコード再利用を検出できるか確 認する • 実験内容 – 各クローンメトリクスに対する閾値決定 – 複数のクローンメトリクスを用いた再利用検出 – ロジスティック回帰モデルを用いた場合の閾値決 定 2011/7/6-公聴会 Yuki Manabe 37 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 実験環境 • 再利用検出対象:オープンソースソフトウェア50個 – Free Software Directoryで配布されている – 様々なドメインから取得 – C言語もしくはC++で開発されている • コードクローン検出ツールCCFinderX – 最小トークン数 30 • 使用するコードクローンメトリクス – コードクローン検出数 – 最大コードクローン長 • 2つのソフトウェア間で検出されるコードクローンの中で最大 のコードクローン長を持つコードクローンのトークン数 – 部分類似度 2011/7/6-公聴会 Yuki Manabe 38 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 実験手順 • オープンソースソフトウェア50個から正解集合を作 成する – 再利用が行われている組:121組 – 再利用が行われていない組:1104組 • 提案した手法と作成した正解集合,オープンソース ソフトウェア50個から2つを選んでできる組1225組を 用いて閾値を求める • 求めた閾値を用いて,各オープンソースソフトウェア の組が再利用が行われているか,行われていない か判定した 2011/7/6-公聴会 Yuki Manabe 39 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 閾値と検出結果 再利用あり 閾値 検出できた組数 再利用なし 270 50 91/121 (75%) 877/1104 (79%) 再利用が行われている組,再利用が行われていない 組をそれぞれ75%以上検出できている 2011/7/6-公聴会 Yuki Manabe 40 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 第4章のまとめ • 再利用検出手法のための閾値を実験的に決定する 手法を提案 – 手作業により判別されたソフトウェアの組の集合 を正解集合として利用 – 閾値と適合率の関係から再利用が行われている 場合,行われていない場合の閾値を決定 • 決定した閾値を用いて,大半の再利用が行われて いない組,再利用が行われている組を検出できた • 根拠に基づいて再利用の有無を判定することがで きるようになった 2011/7/6-公聴会 Yuki Manabe 41 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University むすび ライセンス違反検出問題を解くために以下の研究を行った • 階層的ライセンス知識を用いたライセンス特定ツールの開発 – ライセンス違反検出で重要なライセンスの特定を精度よ く,高速にできるようになった • オープンソースソフトウェアにおけるライセンス分布の調査 – ライセンスは変化するため,ライセンス違反検出において は各ソースファイルの各バージョンでライセンス特定を行 う必要がある • コードクローンメトリクスに基づくソースコード再利用判定閾 値の決定手法 – 根拠をもって再利用の有無を判定することができるように なった 2011/7/6-公聴会 Yuki Manabe 42 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2011/7/6-公聴会 Yuki Manabe 43 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 参考資料 2011/7/6-公聴会 Yuki Manabe 44 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1章 2011/7/6-公聴会 Yuki Manabe 45 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 代表的なOSSライセンス • 3-clause BSD License(BSD3) – 派生物は著作権の告知,条項のリスト,保障の 放棄を含めなければならない • Apache License Version 2(Apachev2) – 派生物は著作権,特許,商標,帰属の告知を含 めなければならない • GNU General Public License Version 3(GPLv3) – 派生物はGPLv3のもとで配布されなければならな い 2011/7/6-公聴会 Yuki Manabe 46 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2章 2011/7/6-公聴会 Yuki Manabe 47 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス特定の既存手法 • FOSSology, OSLC – 既知のライセンス記述と,コメントとの一致部分の多さか らライセンスを特定 • ALSA, Ohcount – 既知のライセンス記述に対応する正規表現とコメントとの マッチングからライセンスを特定 • 問題点 – ライセンスの版(バージョン)を答えない – 複数回答を報告する – ライセンスを特定する際に使用する知識の管理が容易で ない 2011/7/6-公聴会 Yuki Manabe 48 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンス知識の規模 • メタライセンス文:427文 • ライセンスルール:126個(112種のライセンスに対 応) • キーワード:82語 2011/7/6-公聴会 Yuki Manabe 49 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 3章 2011/7/6-公聴会 Yuki Manabe 50 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ライセンスの進化 • ソフトウェアライセンスは環境に適合する • ソフトウェアライセンスが進化する理由[2-2] – 作者の要求 – ユーザーの要求 – 外部からの圧力 [2-2] M. Di Penta, D. M. German, Y.-G. Gueheneuc, and G. Antoniol. "An exploratory study of the evolution of software licensing" , ICSE2010. 2011/7/6-公聴会 Yuki Manabe 51 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University FreeBSDにおける ライセンス比率の変化 300 200 #Files 100 0 -100 -200 -300 Release Version BSD2 2011/7/6-公聴会 BSD3 BSD4 InterACPILic CDDLic Yuki Manabe 52 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University FreeBSD5.2.1から5.3の間での変化 5.3 存在 しな い BSD2 BSD3 BSD4 InterA CDDL CPILic 存在 しな い - 97 24 13 0 0 BSD2 31 689 0 0 0 0 5.2.1 BSD3 18 2 235 0 0 0 BSD4 23 0 233 229 0 0 InterA 0 CPILic 0 0 0 141 0 CDDL 0 0 0 0 0 6 2011/7/6-公聴会 Yuki Manabe 53 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 4章 2011/7/6-公聴会 Yuki Manabe 54 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 閾値を用いた検出結果 再利用あり コードクローン検出数 再利用が行われて いるとみなせる下 限値 検出できた組数 部分類似度 590 270 0.30 1/121 91/121 72/121 コードクローン検出数 再利用なし 最大コードクローン長 最大コードクローン長 部分類似度 再利用が行われて いないとみなせる 上限値 - 50 - 検出できた組数 - 877/1104 - 2011/7/6-公聴会 Yuki Manabe 55 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University コードクローンメトリクス詳細 • コードクローン検出数 – 2つのソフトウェア間で検出されるコードクローンの組 • 最大コードクローン長 – 2つのソフトウェア間で検出されるコードクローンの中 で最大のコードクローン長を持つコードクローンの トークン数 • 部分類似度 – 最大コードクローン長を持つコードクローンの組が, それらのコードクローンを含むソースファイルに占め る割合 2011/7/6-公聴会 Yuki Manabe 56 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 閾値が決定できなかった例 (部分類似度・再利用なし) 1 0.9 0.8 0.7 割合 0.6 0.5 適合率 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 部分類似度 2011/7/6-公聴会 Yuki Manabe 57 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ロジスティック回帰モデル 𝑃= 1 1 + 𝑒 {−(𝑏0 +𝑏1 𝑋1+𝑏2𝑋2 +⋯+𝑏𝑛 𝑋𝑛 )} • P: 事象が起こる確率 • b_n: 偏回帰係数 • X_n: 説明変数 2011/7/6-公聴会 Yuki Manabe 58 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Leave-one out cross validation 10個のデータセットを作成 Data1 Test Data2 Test Data3 Data4 Data5 Fit Data6 Fit ・・・・・・ Fit Data7 Data8 Data9 Data10 Test 精度1 精度2 精度10 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University その他の結果 • 複数のコードクローンメトリクスを併用 – 再利用あり: 102/121 • 最大コードクローン長⇒部分類似度の順で判定 – 再利用なし: 一つしか閾値がないので結果なし • ロジスティック回帰 – 再利用あり:65/121(閾値1.0) – 再利用なし:1026/1104(閾値0.02) 2011/7/6-公聴会 Yuki Manabe 60 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2011/7/6-公聴会 Yuki Manabe 61 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2011/7/6-公聴会 Yuki Manabe 62 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
© Copyright 2024 ExpyDoc