8

In essence, I'm wondering how licenses affect the legality of using source code as data. By that I mean literally storing code in a database as strings and using it e.g. for some syntax highlighting experiments, or other such pursuits.

I can think of a couple of scenarios:

  • My project is closed-source, and I want to use open-source code as data. If I store code that is under GPL, does the GPL license apply to my project? What about other licenses?

  • My project is open-source, but licensed under e.g. MIT. Again, if I store GPL code, does that affect my project?

I was thinking about GPL specifically because of its viral nature, but if other licenses would have applicable effects, I'd be interested in hearing about them as well.

3 Answers 3

11

(Note: I'm not a lawyer.)

From the Free Software Foundation's GPL FAQ:

If a programming language interpreter has a license that is incompatible with the GPL, can I run GPL-covered programs on it?

When the interpreter just interprets a language, the answer is yes. The interpreted program, to the interpreter, is just data; the GPL doesn't restrict what tools you process the program with.

It would seem that the "it's just data" argument applies in your case as well. The GPL's copyleft provisions only apply when the GPL'd work and some other work form a derivative work, which doesn't appear to happen in your case.

Of course, any GPL work you distribute must stay under the GPL, but the GPL provisions will not apply to your project as a whole, because it doesn't combine with your existing work into a new derived work.

1
  • Ah, I hadn't looked at that section of the FAQ. Thank you! That seems to answer it.
    – voithos
    Commented Nov 13, 2013 at 16:39
3

The usual "I'm not a lawyer" disclaimer, but because...

  1. You're not actually linking to the code in an executable way, and
  2. You're program will work perfectly fine without the code (i.e. the code is not part of a derived work),

you are therefore not redistributing the code, in the GPL sense, and are therefore not bound by its terms.

You can further strengthen this proposition by only using part of the code for illustration purposes (in the "fair use" sense), and not the code in its entirety.

1
  • Good point, and, indeed, I will only be using small snippets of code.
    – voithos
    Commented Nov 13, 2013 at 16:40
2

This is really a question for the lawyers (and could be deemed off-topic for that reason), but my take on it is this:

As your code does not derive from or depend on the GPL-licensed code in any way, your code can't be seen as a derived work of the GPL-licensed code. Because of that, the GPL terms do not extent to your code.

When distributing the data that you use with your program, that is still covered by the GPL license and thus requires you to distribute the GPL-licensed 'text' in source code form as well. This is mostly relevant if you have your data in a database or something similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.