Skip to content

Software licences

Exercise software-licences-annex.pdf · PDF

This year you will write a small game. A classmate copies your folder and sells it online for 2 €. You never signed anything. You never wrote "do not copy". Is he allowed?

No. And the reason is the fourth question from Comparing operating systems: what am I allowed to do with this software? As a future developer you will answer it twice — for the software you use, and for the software you write. On the OS architecture page, modinfo printed license: GPL. Today you find out what those three letters mean.

What you will learn

  • Explain that software is protected by copyright by default and that a licence is the author's permission
  • State the four freedoms of free software and say which ones need the source code
  • Tell free software from open source, and "free" from "free of charge"
  • Compare copyleft (GPL) and permissive (MIT, BSD, Apache) licences
  • Describe how proprietary systems are sold: OEM, retail, volume, subscription, freeware
  • Find the licence of any program installed on Ubuntu

Copyright gives the author of a program all the rights over it, automatically, from the moment it is written. Nobody else may copy it, change it or share it.

A licence is the author's written permission: what others may do with the program, and on what conditions.

No licence means no permission. That is why your classmate cannot sell your game — and why you cannot paste code you found on a random web page into your app, even if it is "public". No licence = all rights reserved.

It also means that when you "buy Windows", you do not buy Windows. You buy a licence: permission to use it, with limits.

The recipe and the dish

Programmers write source code: text that a person can read. The computer runs a translation of it, the binary, which no person can read.

Recipe and dish (we keep it all page)

The source code is the recipe. The binary is the dish. With the dish you can eat. Only with the recipe can you see what is in it — or change it.

flowchart LR
    SRC["<b>Source code</b><br>the recipe:<br>text a person reads"] -->|"compiled<br>(translated)"| BIN["<b>Binary</b><br>the dish:<br>what the CPU runs"]
    BIN -->|"you can run it,<br>but not read it"| YOU["<b>You</b>"]
    SRC -.->|"only with the recipe<br>can you study or change it"| YOU

The printer nobody was allowed to fix

1980, the Artificial Intelligence Lab at MIT. The lab gets a new laser printer, a Xerox 9700. It jams all the time. A programmer of the lab, Richard Stallman, had solved that on the old printer: he changed its program so it warned everybody when the paper got stuck. For the new one he asks for the source code. The answer is no: it is secret, and the colleague who has it signed a promise not to share it. A machine in his own lab, and he is not allowed to repair it.

  • 27 September 1983 — Stallman announces the GNU project: a complete operating system that everybody may study, change and share.
  • October 1985 — he founds the Free Software Foundation (FSF).
  • 1989 — the first GNU General Public License (GPL).
  • 1991 — GNU has almost everything except a kernel. A student in Helsinki publishes one. You know his name.

Free software and the four freedoms

A program is free software when its licence gives every user these four freedoms.

The FSF numbers them from zero — programmers count from zero:

Freedom You may... Needs the recipe?
0 run the program for any purpose No
1 study how it works and change it Yes
2 give copies to others No
3 give others your changed version Yes

Freedoms 1 and 3 are impossible without the source code. That is why free software always comes with its recipe.

Careful: free is not “free of charge”

Free as in freedom, not as in price. Catalan and Spanish have two words where English has one: free software is lliure / libre, not necessarily gratis. Free software may even be sold. And the opposite also happens: WhatsApp costs nothing and is not free software — you get the dish but never the recipe. Price and freedom are different columns.

Open source

In business, "free software" sounded like "software with no price". On 3 February 1998, in a meeting in Palo Alto — shortly after Netscape announced it would publish the source of its browser — Christine Peterson proposed a new name: open source. That same month Eric Raymond and Bruce Perens founded the Open Source Initiative (OSI).

Free software (FSF) Open source (OSI)
The emphasis The user's freedom A better way to build software
The licences Almost the same list Almost the same list

You will see both names used for the same programs. In practice: same recipes, different speeches.

Copyleft and permissive

All free licences give the four freedoms. They differ on one point: when you pass on a changed version, what must you do?

Copyleft Permissive
Condition Share alike: your changed version must carry the same licence, with its source code Almost none: keep the author's name and the licence text
May you make a closed product from it? No Yes
Examples GPL (the Linux kernel, bash), LGPL MIT, BSD, Apache 2.0 (most of Android)

With copyleft, the recipe must travel with every dish you hand out. With a permissive licence, you may serve the dish and keep your improved recipe to yourself.

Careful: GPL software can be used in a company

Using a program is freedom 0, for any purpose. The GPL's conditions start only when you distribute a changed version. And every free licence has conditions — "open source" never means "anybody can do anything".

The blue router

2003: one of the most popular home routers is the blue Linksys WRT54G. Some users look inside its software and find Linux, under the GPL. But Linksys has published no source code: the dish without the recipe. After public pressure, the company publishes it. In 2004 volunteers use that code to start OpenWrt, a free system for routers that is still developed today.

Copyleft is not a wish; it is a condition. Linksys could use Linux for nothing. What it could not do was keep the recipe for itself.

Android shows the other side. Its kernel is Linux (GPL), but most of the rest is under Apache 2.0 — permissive — so each phone maker may add its own closed parts on top.

How proprietary software is sold

Proprietary software keeps the recipe secret and gives you a permission with limits.

The text you accept when you click "I agree" is the EULA (End-User Licence Agreement). Microsoft's licence terms for Windows say it plainly: "The software is licensed, not sold." Among the things they forbid: to reverse engineer, decompile or disassemble the software — that is, trying to get the recipe back from the dish.

The same Windows 11 is sold in several ways:

Licence How it works Typical case
OEM Installed by the maker of the computer. Cheaper, and tied to that one device: it cannot be moved to another computer The laptop you buy in a shop
Retail Bought on its own. Can be moved to another computer, one at a time You build your own PC
Volume One agreement for many computers in an organisation, activated together A company or a school with 200 PCs
Subscription You pay every month or year. Stop paying, stop using Microsoft 365, Adobe
Freeware No price, closed recipe WhatsApp

OEM stands for Original Equipment Manufacturer: the company that made the computer.

Careful: “I bought it, so it is mine”

You bought a permission. What you may do is what the licence says, and nothing more. The Windows that came with your laptop lives and dies with that laptop.

And nobody makes money with free software? Wrong too: companies like Red Hat and Canonical sell support and services for it, and selling copies is allowed as well.

The licence hunt: find it on your PC

Every program on Ubuntu comes with its licence in a text file. Open a terminal (Ctrl+Alt+T). The Tab key completes file names — use it to avoid typos.

The full text of the most used licences lives in one folder:

ls /usr/share/common-licenses/

You will see names like GPL-2, GPL-3, LGPL-3, Apache-2.0, BSD, MPL-2.0. Look at the start of one:

head -3 /usr/share/common-licenses/GPL-3
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

Every installed package keeps its own licence in /usr/share/doc/<package>/copyright. To read just the first licence line:

grep -m1 "^License:" /usr/share/doc/bash/copyright
License: GPL-3+

The + means "this version or any later one". Repeat it changing bash for apt, libc6, dash and zlib1g — the Exercise sheet has a box for each. You will find at least four different licences on one PC. And the kernel's drivers carry one too:

modinfo usbhid | grep license

The Linux kernel is under GPL version 2.

Then compare with the other side: open microsoft.com/useterms, choose Windows 11, and search (Ctrl+F) for not sold.

Choosing a licence for your own code

When you publish your first app, choosealicense.com (a site kept by GitHub) helps you pick. Its first page asks what you care about: sharing improvements points you to a copyleft licence; keeping it simple and permissive points you to a permissive one.

Key takeaways

  • Software is protected by copyright by default; a licence is the author's permission. No licence = no permission.
  • Source code is the recipe; the binary is the dish. Studying or changing a program needs the recipe.
  • Free software gives the four freedoms (run, study and change, copy, share changes). Free means freedom, not price. Open source is almost the same set of licences, with a different emphasis.
  • Copyleft (GPL) obliges changed versions you distribute to stay free; permissive (MIT, BSD, Apache) allows closed products.
  • Proprietary software is sold as OEM (tied to the device), retail (movable), volume, subscription or freeware, under a EULA: "licensed, not sold".
  • On Ubuntu, /usr/share/doc/<package>/copyright tells you the licence of any package.

Quick check

1. What makes a program free software?
  • Its licence gives every user the four freedoms
  • Its price is zero for every user
  • It has no author who owns its copyright
  • It is published with no licence at all

Free software is about freedom, not price: run it, study and change it, copy it, share your changes. It may even be sold. WhatsApp costs nothing and is still proprietary.

2. Which freedom needs the source code?
  • To study and change the program
  • To run the program for any purpose
  • To give copies to others
  • To use the program at work

You cannot study or change a dish without its recipe. Freedoms 1 (study and change) and 3 (share your changed version) need the source code; running and copying do not.

3. Which of these is a copyleft licence?
  • GPL
  • MIT
  • BSD
  • The Windows 11 licence

The GPL is copyleft: changed versions you distribute must keep the GPL and come with their source. MIT and BSD are permissive; the Windows licence is proprietary.

4. What is special about an OEM licence of Windows?
  • It is tied to the device it came with
  • It can be installed on five PCs at once
  • It must be paid again every year
  • It includes the source code of Windows

An OEM licence is installed by the computer's maker and lives and dies with that device. A retail licence can be moved to another PC, one at a time.

5. You find useful code on a web page with no licence anywhere. What may you do with it?
  • Nothing without the author's permission
  • Anything, because it is public on the Internet
  • Use it freely if you are a student
  • Use it under the GPL by default

Copyright protects code automatically. With no licence, all rights are reserved: ask the author, or look for code that comes with a licence.

6. A company takes a GPL program, improves it and sells the new version without its source code. What is wrong?
  • The GPL requires changed versions that are distributed to carry the GPL and their source
  • Free software may never be sold, with or without its source
  • Companies may not use GPL programs for any purpose
  • Improving a GPL program needs a paid retail licence first

Selling is allowed; closing is not. Copyleft is a condition: the recipe must travel with every copy of the dish — exactly what Linksys had to accept with the WRT54G router.

7. Your company wants to build a paid, closed app using a library. Pick the two licences that allow it.
  • MIT
  • Apache 2.0
  • GPL
  • No licence, found on a forum

Permissive licences such as MIT and Apache 2.0 allow closed products: keep the copyright notice and the licence text. The GPL would force you to share your source, and code with no licence cannot be used at all.

Next: you will write a lab report for every practical this year — learn the format once — Markdown lab reports.