Sourcerer's Apprentice and the Study of Code Snippet Migration

Sourcerer's Apprentice and the Study of Code Snippet Migration

Sourcerer’s Apprentice and the study of code snippet migration Stephen Romansky, Abram Hindle Cheng Chen, Baljeet Malhotra Department of Computing Science, University of Alberta BlackDuck Edmonton, Canada Burnaby, Canada romansky, [email protected] cchen, [email protected] Abstract—On the worldwide web, not only are webpages A common open source license violation is the lack of connected but source code is too. Software development is attribution, most Free/Libre Open Source Software (F/LOSS) becoming more accessible to everyone and the licensing for licenses require that the authors who wrote the code are software remains complicated. We need to know if software licenses are being maintained properly throughout their reuse attributed in documentation, in the source code, or in startup and evolution. This motivated the development of the Sourcerer’s messages. Not attributing the opensource copyright holder Apprentice, a webservice that helps track clone relicensing, violates the opensource license. Thus using the wrong license because software typically employ software licenses to describe or misattributing code can be costly because: how their software may be used and adapted. But most developers do not have the legal expertise to sort out license conflicts. In this • a developer or company can lose the rights to use, reuse, paper we put the Apprentice to work on empirical studies that and distribute source code and software they rely on; demonstrate there is much sharing between StackOverflow code • a developer or company a developer may be required to and Python modules and Python documentation that violates the licensing of the original Python modules and documentation: distribute their proprietary source code unexpectedly, if a software snippets shared through StackOverflow are often being copy-left license was included; relicensed improperly to CC-BY-SA 3.0 without maintaining • or, the developer or company may be sued for copyright the appropriate attribution. We show that many snippets on infringement [3]–[6]. StackOverflow are inappropriately relicensed by StackOverflow users, jeopardizing the status of the software built by companies We investigate the code clones created between StackOver- and developers who reuse StackOverflow snippets. 1,2 flow and Python modules as well as StackOverflow and Python documentation to determine if developers are copying common I. INTRODUCTION reference material without proper relicensing or attribution onto StackOverflow. We find the relationship between the When software is written it is covered by copyright granting source of code clones like Open Source Software and Stack- the author exclusive rights to the distribution of their software. Overflow is bi-directional, rather than uni-directional [7], and Software typically must be licensed to other parties for it to fraught with license inconsistencies. For instance, copying be used, distributed, and sold. Software can be licensed by code to ask a question or share an answer on StackOverflow developers to impose or alleviate restrictions on how it may relicenses the shared code to the CC-BY-SA 3.0 license [8], be reused. Open-source software licenses typically seek to [9]. For instance, GPLv3 code cannot be posted on Stack- enable the free reuse and distribution of software provided Overflow due to incompatible relicensing. It is important to that attribution to the authors is given. Code reuse results in understand how developers interact with community-driven arXiv:1808.00106v1 [cs.SE] 31 Jul 2018 numerous “code clones”: exact or near-exact code snippets tools like StackOverflow where 66% of software developers or files occurring within multiple software projects that are who use the StackOverflow service are unaware of the license still licensed. Large programming sites like StackOverflow it imposes on their posted code [10]. In this paper we highlight shares source code in answers and questions [1] as well as a severe problem that code posted to StackOverflow often sites like GitHub that share code in publicly hosted software has incompatible licenses, but also that license terms are repositories [2]. Code on StackOverflow is typically claimed breached by the lack of attribution—this imperils the reuse to be opensource by StackOverflow’s terms of service, but the of StackOverflow code as end-user developers could be liable code might have come from elsewhere and someone else. We for copyright infringement. raise the question, “Can we trust the license of code shared Our work also discusses our extension of SourcererCC to on StackOverflow to be accurate?” create the Sourcerer’s Apprentice: that detects code clones with possible relicensing issues. The Sourcerer’s Apprentice 1 We would like to thank Vaibhav Saini for help to get SCC running. can be used by any developer interested in checking if 2Get our code and data at the following URL: https://github.com/ SRomansky/SourcererCC.git (TODO curate and publish everything for camera their code base has copied artifacts with candidate license- ready) inconsistencies from open source repositories. We demonstrate this web service by: detecting if students have submitted Conventional, and accepted, literature defines 4 types of homework solutions plagiarized from StackOverflow; to detect code clones: Type-1 are identical code segments ignoring if students have copied home work from each other; and to white space and comments; Type-2 are type-1 clones with perform clone detection on non-source based repositories of the additional exceptions that the segments can have modified code blocks like StackOverflow and software documentation identifiers, literals, and types from one another; similarly, (Python 2.7) to find the relicensing conflicts from copying Type-3 clones are type-2 clones with the additional exceptions reference material. With the help of the Sourcerer’s Apprentice that the segments can have added or removed lines; while, our contributions are: Type-4 clones are code segments that perform the same • We show relicensing conflicts between Python Modules actions, but are syntactically different [12], [21]. In prior work, and Python Documentation and StackOverflow; code segments are often referred to as code blocks and are • We show that the flow of code between StackOverflow extracted from whole functions or whole files; but, we are and Open Source Software is bi-directional; interested in the license of any segment of code, even if these • Implementation of a web service for clone detection are incomplete software components [11], [21]. and detailed reproducibility performance improvements Code similarity, or code clones, play an active role in the to existing tools; development life cycle. Kasper et al. shows some clones cause more technical debt than they resolve, while others simplify II. BACKGROUND prototyping in feature development [22], [23]. We cover preliminary material in this section that introduces It is also possible to use code clones to study projects that code clones, software license detection, and subsets of rele- we do not own [24]. We can view how much code is duplicate, vant web protocols used to build our web service. We also or what is frequently reproduced in software projects, and we provide short descriptions of state-of-the-art code detection can try to help developers by making generalizations based on tools and license detection tools such as SourcererCC [11] our observations to create new conventions or functions based and Ninka [12] that are used in our work. on our analysis. Software licenses: are applied by developers to constrain Software communities and code sharing: It is possible to and enable future reuse. By default the software creator is the study software communities to understand code clone growth copyright owner. As exclusive copyright holders, developers and evolution, to see where license conflicts can be created, use licenses to distribute software to clients under various and to view clones and licenses together. Developers can terms. Developer license their work with licenses from two write alone, or with others. The internet makes it easier for popular categories of licenses: F/LOSS and proprietary. Open developers to work together and to share code with one source focuses on having shareable and editable code, while another. However, code sharing requires licensing. GitHub proprietary licensing restricts who may access the code, run provides developers with a place to share their projects under the binaries, and whether users may alter it. Researchers have the constraint of the terms of service [25], but developers also investigated when, and how, license changes occur in soft- are free to license their software projects however desired. ware projects through revision history and issue trackers [13]. StackOverflow provides developers with a place to share their License conflicts: License conflicts occur when two or development questions under the constraint that any posted more licenses impose restrictions on each other that cannot be code will be licensed under the CC-BY-SA 3.0 license [8]. met. This can happen between any two licenses, regardless of GitHub and StackOverflow can help developers further their their categories, based on their requirements. For instance, the project goals with social interactions. GPLv2+ license is compatible with the GPLv3 but GPLv3 is Another service that developers have used in the past, and not compatible with GPLv2 [14]. Licenses are hard to interpret still use, to share questions and projects were mailing

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us