Recent

Author Topic: Open Source code copying/borrowing Etiquette?  (Read 804 times)

Tony Stone

  • Jr. Member
  • **
  • Posts: 52
Open Source code copying/borrowing Etiquette?
« on: May 11, 2021, 01:48:11 am »
This really isn't Lazarus specific but I thought I would bring it up here... as I don't really talk to any other programmers anywhere else.

I am Learning to program in Lazarus and trying to learn my way around GitHub.

I found some code in an opensource project called PascalCoin that I want to use in my open source program (both on GitHub).  Now they have some functions and procedures I would like to have included in my project.  Is copying and pasting acceptable if I leave credit with a comment for the code?  I notice in the .pas files that have the MIT license and it says header must not be removed.  Should I just copy the entire .pas file and "merge" it into mine?  Or keep it as a separate file to use its functions?  I know this may be a ridiculous question for most of you but I am trying to keep my project code and files clean and organized and I am looking for ways to do this without stealing anyone elses work.

dbannon

  • Hero Member
  • *****
  • Posts: 1495
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Open Source code copying/borrowing Etiquette?
« Reply #1 on: May 11, 2021, 02:24:14 am »
Tony, the MIT license allows modification, thats what you do when you take some part and use ii in your project.  if its more than  a handful of lines you should probably copy the license header and note the parts copied, especially if copied intact.  Your own license header can sit before or after the pasted in bits assuming its not wildly incompatible. If you plan to make your project available via a license sensitive body such as Debian very important you have good records of what was obtained from where.

Often, people post code here or on the wiki without defining a license and that can be an issue occasionally.

On the other hand, very, very few projects don't have code 'inspired' from other projects.  Concepts and approaches to a problem are not really license-able, and common sense says snippits of code are intended to be copied. The application of the term "derivative work" is a much discussed thing.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

Tony Stone

  • Jr. Member
  • **
  • Posts: 52
Re: Open Source code copying/borrowing Etiquette?
« Reply #2 on: May 11, 2021, 04:43:32 am »
After reading the license I came to the conclusion I can use and modify the code.  I however found while Googling this topic many people saying not to copy and paste and keep it in tact... either way I am a reasonable person... I will leave notes for any code I can re use.  I have nothing worthy of trying to be distributed in any Debian or other distros repositories right now.  Maybe some day.  I will cross that bridge if i get there but since you mentioned it I will try to keep a good habbit of tracking this info just in case!

The more I play around in Lazarus the more these types of issues pop into my head.  Thanks for the reply!

lucamar

  • Hero Member
  • *****
  • Posts: 4164
Re: Open Source code copying/borrowing Etiquette?
« Reply #3 on: May 11, 2021, 08:17:15 am »
With MIT, BSD and similarly permissive licenses it's usually enough that you add something like:
Code: [Select]
Portions from (X project) version x.x. by [somebody] used under a [MIT, BSD or whatever] license
to your own copyright and license statement and, if you distribute also the source and can be done easily, you add that note on the header comment of the unit and mark each function/procedure with a comment like:
Code: Pascal  [Select][+][-]
  1. {This routine taken from "X project" version x.x, under a [MIT, BSD or whatever] license}

The whole point is that, if possible, you identify which portions of the code you took from whom and based on which license, or at least tell the world that you took some parts from someone based on some license.

Read the about box of any browser and you'll see what I mean ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2875
Re: Open Source code copying/borrowing Etiquette?
« Reply #4 on: May 11, 2021, 09:49:18 am »
The whole point is that, if possible, you identify which portions of the code you took from whom and based on which license, or at least tell the world that you took some parts from someone based on some license.

Although /if/ /possible/ I think it would be nicer to use complete files. I don't know what the more vocally-debated licenses say about transclusion etc.

I was looking at something a few months ago and found that the reference material I was using had a CC license but cited code by Torvalds, Torvalds cited something which was GPL3, the GPL3 code cited the CC reference material I was using. Torvalds doesn't like GPL3 and other files in his repository had an explicit GPL2 license without "or later version", but the one I was using had no license text... in the end I uploaded what I'd done to Github with GPL3 and with an explanation of why I'd chosen it. In the unlikely event that my code becomes the centrepiece of a billion-dollar court case I'll let somebody else's lawyers sort it out.

I think that over the last few weeks I've seen an example of an agreed "one-liner" that can be used to insert the abbreviated name of an open-source licence without having to insert the entire text... presumably that means that the community has agreed that there's some central repository of the licence terms that will be there "in perpetuity".

Later: https://en.wikipedia.org/wiki/SPDX

MarkMLl
« Last Edit: May 11, 2021, 10:23:37 am by MarkMLl »
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018