Should we count a library as its procedural macro dependencies' derivation?

I see from Pest's history that it actually migrated from MPL2 to MIT/Apache, as the rust team found its license can be potentially problematic.

This makes me wonder if copyleft licenses of procedural macro libraries can be "infectious" in some situations.

Pest may not be a perfect example, as the generated parser actually refer to some runtime dependencies inside the pest project. However, let us assume that there is a library X generating purely standalone code fragments or token streams.

If needed, let us also assume that the library X explicitly claim what the generated content should be considered as a derivation of the input, rather than the library X itself.

I wonder if doing so will completely remove the concerns that the license of X might cause trouble in dependent crates.

To my understanding, procedural macro libraries are first compiled to a separate executable. With proper claims and separation, their code are not included in the outputs of dependents. However, the subtle problem is that they are usually listed as dependencies, where many common license scanning approaches may consider this as a problem.

I do not have much knowledge on licenses. I ask this question out of my personal curiosity. If there is any less rigurous wording used in the question, please understand in the way that conforms "the principle of charity"; or you can ask me to amend the words. :smiley: If there is any previous examples or discussions, I would appreciate it if you could offer me some pointers.

Thanks a lot.

I'm not an expert on license/copyright law, but I feel like code generated by a proc-macro would fall under the same category as output you get from something like an AI model or a compiler. Namely, that the generator itself (proc-macro, GPT-4, gcc, etc.) has its own license as usual, but anything it generates is yours to do what you want.

Otherwise we'd have a situation where a C program needs to be licensed as GPLv3 because it was compiled with GCC, and GCC is licensed under GPLv3.

In this case I'm not talking about the technicalities of whether something is compiled into its own binary or how it is listed in your Cargo.toml file, but the high-level flow of information/intellectual property and the overall intent.

3 Likes

The GNU Bison manual addresses a similar question.

1 Like

More-or-less.

Nope. That's not true. In both cases the answer is: if copyright owner of the code which you used haven't given you separate license then you would never know if the use is valid or not till you actually go to court and then, you would still only have approximation till case would reach SCOTUS and you would finally know the answer.

Not a problem for a C program since GLibC have different license. Very real problem for C++ because it's very explicit special exception is pretty limited.

And since you are not a lawyer you are speaking like a software engineer. It took me a long time to understand how lawyers think.

The clear answers to questions that topicstarter is asking don't really exist because the law doesn't work like that.

Law works on case-by-case basis and that means that if we don't have SCOTUS verdict then all we have are probabilities: sometimes they are higher, sometimes they are lower, but it's never 0 or 1. And even said verdict only clarifies the answer for one specific case, applicability to other cases is not 100%!

That's why the typical engineering approach of testing corner cases doesn't work: the fact that combination of some rules in some convoluted corner case give nonsensical answer doesn't mean that these rules are invalid or not in effect! This just means that said convoluted corner case lies beyond the boundary of their applicability and the goal of good layer is to give you verdict to practical questions without crossing these unwritten lines.

That's why discussions between lawyers and software engineers are so painful: both sides feel like the other side is just inventing crazy and stupid excuses when software engineers are pushing for clarification in these “interesting” corner cases and lawyers ask who, how and why would tests answers to these question in court.

4 Likes

I think this is correct in the general sense, but it sounds quite alarming for all of technology, if something as common as compiling a program is a convoluted corner case not unambiguously covered by law.

Our IP laws are failing at large, and annoyed lawyers and software engineers are really the symptom, not the cause. For now, the legal risk is pervasive, and developers have to accept that there is no practical way to legally future-proof their work (even those they've put countless work-hours into), but we definitely should not accept living with that.

1 Like

Note that it's compiling a program using compiler which doesn't disclaim copyright for the generated code, not just compiling the program, in general.

GPL explicitly disclaims these rights, e.g.:

GPLv2: The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program).

GPLv3: The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work.

And when GPLed program embeds significant chunks into output it's customary to add additional grant of rights, like with Bison (shown above) or Ragel: As an exception, you may use the parts of Ragel output copied from Ragel source without restriction. The remainder of Ragel output is derived from the input and inherits the copyright and license of the input file. Use of Ragel makes absolutely no requirement about the license of generated code.

That means that in practice compiling the program is almost never a problem, but not because that's clear-cut situation from the legal POV, but because correct disclaimers are included either in the license or the separate disclaimer.

How is it any different from any other human endeavour? Hostile takeovers existed before software have become a thing and it's unclear why software, specifically, should be exempt from the problems which are common in other human endeavours.

no, you still wouldn't know the final answer because different countries can decide copyright cases differently. (e.g. Australian courts can decide that some use is infringing even if the SCOTUS decided it's not.) Also, the SCOTUS and other countries' courts can reverse previous legal decisions (rare in the US, but it does happen), or new laws can be passed that affect the copyright (rare).

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.