How to mark code lines licensed on MIT?

When I am using some code licensed with the MIT license, but it’s not in seperate files, is it OK mark it like this?

/* Here starts code licensed under the MIT License (../MIT.txt) */
// code
/* Here is the end of code licensed under the MIT License (../MIT.txt) */

Where in ../MIT.txt file, it would contain the MIT License text and the original author’s copyright notices.

Also, when most of code is MIT licensed and I’m only changing some sections of the functions can I mark those parts with the same method as above but with my own license? Yes, it’s going to be a lot of kilobytes of comments.

When you use MIT-licensed code in a non-MIT-licensed project, simply marking the MIT-licensed parts of the source code is not a good strategy. The license allows you to do just about anything with the code – including sublicensing the code –, under this one restriction:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Note that the MIT license should also be displayed to the end user of your software. Where you display your copyright to the user, you should also add something like

This program includes code from the FooBar library, used under the following license:

The "FooBar" library  
Copyright (c) <year> <copyright holders>

<license body>

In addition, you might want to explicitly mark the sections in the code that were taken from an MIT-licensed source. From my understanding, this is not required, but it would be ethical.

When you modify an MIT-licensed source, you should not mark your contributions with a separate license, because this requires an user of the source to follow both the original license and your license. Instead, choose one of the following options:

  • License your contributions under the same license as the rest of the code. You can edit the copyright notice to reflect that you contributed to the source, without marking what exactly you changed.
  • Re-license the MIT-licensed source under your license, in a manner permitted by the MIT license. See above.

Notes:

  • I’m a programmer, not a lawyer.
  • The term “MIT license” is fairly ambiguous. This answer assumes the Expat License, but is also applicable to the X11 License.

2

That’s insane. DON’T DO THAT.

If you are working in some one else’s code that has an MIT license, then your changes should have the MIT license. If you can’t for some reason use the same license as the rest of the project, then you shouldn’t be fooling with it. If you have an ethical or whatever disagreement with the licensing of a project, then DON’T WORK ON THAT PROJECT.

It is TOTALLY unreasonable for you to place a veritable copyright compliance minefield throughout each source file. It’s NOT reasonable for you to expect users of the code to review every line of every source file in order to determine what the licensing of the thing is.

If you simply MUST do things differently, then pull your code out to separate files, so that someone evaluating the code for their use would have a CHANCE of knowing what license the code was under.

Also: If it came down to a courtroom, I’m unclear how your shenanigans would fare. An unobservant person could legitimately claim to have not noticed your bits being licensed differently, and an unscrupulous one could potentially use the confusion to do things you didn’t intend.

If you wanted to do this (and you didn’t care about the possible backlash) you should at the very least:

  • Add a license file, as you suggest.
  • Point out in the readme file very clearly that the code is licensed as “foo” (whatever the original license is) except where bracketed by “some special start string” and “some special end string” which is MIT licensed. These strings must be unique and never misspelled, so that users could conceivably remove them using a simple script if they don’t want your code.

To avoid excessive backlash, you should probably also do this:

  • Provide the user with a link or script to get the code without your differently licensed changes.
  • Make sure the code works (or, at least, all tests pass) if your code is removed.
  • Put your code in separate files or wrap the original project (using for example a Git submodule) to guarantee that you’re not modifying the original code.

The biggest issue with this is probably how your code would mesh with the rest of it. You can’t modify even a single line of the original code and re-license it, so how are you going to do sane changes? For example, you can’t statically link GPL code without changing your license to GPL. There are probably hosts of other issues with specific licenses, and you’re very likely just creating problems for yourself and others. If you care about other users enough (assuming you’re not selling the compiled project) to release your changes, why do you not care enough to use the original license?

A much simpler solution which has no guarantee of success is to calmly and reasonably explain to the original author(s) why you would like the software to use the MIT license, and whether they would be willing to dual license it.

5

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật