<<

Understanding Darcs

en.wikibooks.org March 15, 2015

On the 28th of April 2012 the contents of the English as well as German Wikibooks and Wikipedia projects were licensed under Creative Commons Attribution-ShareAlike 3.0 Unported license. A URI to this license is given in the list of figures on page 63. If this document is a derived work from the contents of one of these projects and the content was still licensed by the project under this license at the time of derivation this document has to be licensed under the same, a similar or a compatible license, as stated in section 4b of the license. The list of contributors is included in chapter Contributors on page 61. The licenses GPL, LGPL and GFDL are included in chapter Licenses on page 67, since this book and/or parts of it may or may not be licensed under one or more of these licenses, and thus require inclusion of these licenses. The licenses of the figures are given in the list of figures on page 63. This PDF was generated by the LATEX typesetting software. The LATEX source code is included as an attachment (source.7z.txt) in this PDF file. To extract the source from the PDF file, you can use the pdfdetach tool including in the poppler suite, or the http://www. pdflabs.com/tools/pdftk-the-pdf-toolkit/ utility. Some PDF viewers may also let you save the attachment to a file. After extracting it from the PDF file you have to rename it to source.7z. To uncompress the resulting archive we recommend the use of http://www.7-zip.org/ . The LATEX source itself was generated by a program written by Dirk Hünniger, which is freely available under an open source license from http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/wb2pdf. Contents

1 Getting Started 3 1.1 Anatomy of a darcs repository ...... 3 1.2 Essential commands ...... 4

2 Making Changes 9 2.1 Editing files ...... 9 2.2 Playing with files ...... 10

3 Working With Others 13 3.1 The commands ...... 13 3.2 Dealing with conflicts ...... 16

4 Reviewing Your Work 17

5 Undoing Mistakes 21 5.1 The big three ...... 21 5.2 Other ways to get rid of things ...... 24 5.3 Questions and objections ...... 25

6 Dealing With Conflicts 27 6.1 Handle your conflicts at home ...... 27 6.2 Resolving conflicts ...... 27

7 Introduction to Patch Theory 29 7.1 Math and computer science nerds only ...... 29 7.2 What is the theory of patches? ...... 29 7.3 Why all this math? ...... 29 7.4 Context, patches and changes ...... 30 7.5 Sequential patches ...... 32 7.6 Inverses ...... 33 7.7 Commutation ...... 35 7.8 Merging ...... 41 7.9 Definitions and properties ...... 49

8 Intermediary Patch Theory 51 8.1 It’s all patches ...... 51 8.2 Merging a sequence of patches ...... 51 8.3 Sequences of patches ...... 52 8.4 Permutivity ...... 52

III Contents

9 Patch Theory and Conflicts 53 9.1 Conflicts ...... 53 9.2 Forced commutation ...... 56 9.3 Forced commutation in merging ...... 56 9.4 Darcs 2 ...... 59 9.5 Current research ...... 59

10 Contributors 61

List of Figures 63

11 Licenses 67 11.1 GNU GENERAL PUBLIC LICENSE ...... 67 11.2 GNU Free Documentation License ...... 68 11.3 GNU Lesser General Public License ...... 69

1

1 Getting Started

1.1 Anatomy of a darcs repository

Understanding how to use the darcs commands can be a lot easier if you have a rough idea how things work. We’re not asking you to learn about patch commutation algebra (yet), but one thing you should at least be comfortable with is the anatomy of a darcs repository.

Figure 1 Anatomy of a darcs repository

The idea of the diagram is as follows: the stuff on the left in yellow is you. That’s what darcs calls the working directory . The stuff in grey, on the other hand, is part of that mysterious _darcs directory if you’ve played around with darcs before. This can be broken down some more. The pristine tree (middle) is exactly like your working directory, except only representing the last saved state. It’s not essential to darcs’s operations, but it makes things run more efficiently, and is perhaps useful for understanding how things work. Finally, the right-most portion is the set of patches . Patches are what makes darcs... well... darcs. Darcs thinks in patches. Almost every darcs operation somehow involves (darcs) juggling some patches around behind the scenes. Enthusiastic darcs users find that this makes life easier in a number of ways. For example, accepting patches to your code

3 Getting Started becomes an extremely natural thing to do - you just let darcs apply them and in they go. But before we get to that, let’s tackle a small set of essential commands.

1.2 Essential commands

1.2.1 init

Say you have a directory with some files in it. When you run darcs init to initialise the repository, you get an empty new darcs repository. Your working directory might contain files, but darcs does not know about them yet.

Figure 2 After a darcs init - an empty repository

1.2.2 add darcs add tells darcs to keep track of a file or directory that was only in your working directory. It creates or adds to a special temporary patch which we call the pending patch (will be represented in blue). Note that it does not affect your pristine tree whatsover! The

4 Essential commands idea is that we haven’t saved your work (which is what the pristine tree is for). We’ve only told darcs that we might conceivably want to save it later on.

Figure 3 during darcs add

Note that the pending patch is different from all the other patches. It is really a represen- tation of (some) things you have not yet converted into a real darcs patch.

1.2.3 whatsnew

The darcs whatsnew compares the working directory against the pristine tree (theoretically, against the set of patches) and displays what has changed between them. If there is anything in the pending patch, it also displays the contents of that.

5 Getting Started

Figure 4 Darcs whatsnew

1.2.4 record

The darcs record command is how you save your work. It copies your chosen changes from the working directory to the pristine tree, and more importantly, creates a new patch representing those changes. Changes can also come from the pending patch, and these changes will also be propagated into the pristine tree.

6 Essential commands

Figure 5 during darcs record

1

1 http://en.wikibooks.org/wiki/Category%3A

7

2 Making Changes

2.1 Editing files

2.1.1 record makes new stuff old

The record command takes the changes which only exist in your working directory (or the pending patch) and updates the pristine tree. The result of a record operation is a new patch.

Figure 6 The darcs record command

9 Making Changes

2.1.2 replace for renaming tokens

The replace command is useful for explictly telling darcs to replace one word with another (for example, a variable name, if you are a programmer). Note that because of the underlying patch theory, replace only works if the new word doesn’t already exist in the file. Darcs will helpfully let you know if you try to replace something you cannot. Also, there is a switch for forcing the replacement, but the resulting patch is not a clean darcs-replace patch, but a combination of that, and what you would have gotten if you had edited the file in a text editor. In short, forcing darcs to replace when it really doesn’t want to can lead to counter-intuitive results.

2.2 Playing with files

We saw add in the last chapter. What about the other file-related commands?

2.2.1 add tells darcs to pay attention add , unsuprisingly, adds a file or directory to the list of files that darcs is paying attention to.

10 Playing with files

Figure 7 The darcs add command

2.2.2 mv for moving or renaming mv lets you rename a file or put it in a different directory. This command updates the pending patch with a move command.

2.2.3 you don’t need remove

You might think that remove gets rid of a file, but actually all it does is to remove it from the list of files that darcs is paying attention to. You probably just want to delete the file instead (eg: with rm ). Darcs will notice and record the change next time you darcs record that file. So what’s the remove command good for? It might be handy if you want to just remove the file from darcs, without actually getting rid of your physical copy. This is most useful when you’ve accidentally used darcs add on a file you don’t want darcs to pay attention to.

11 Making Changes

1

1 http://en.wikibooks.org/wiki/Category%3A

12 3 Working With Others

3.1 The commands

3.1.1 get darcs get makes a copy of an entire darcs repository. Note that we only get the recorded patches (and pristine tree), not any of the pending stuff.

13 Working With Others

Figure 8 during darcs get

3.1.2 pull/push darcs pull copies from some other repository patches that you do not have. The patches are applied to your pristine tree and working directory. This may cause changes to be merged. Note that darcs push does the same thing, but in the other direction.

14 The commands

Figure 9 during darcs pull

3.1.3 send

Darcs send is sort of like push , only it doesn’t actually apply the patches anywhere. Instead it generates a handy email to the person or people who own the repository. If it can’t figure out who owns the repository, it will let you send to any email address you want. Note that you can also pass the -o command to ”send” into a file, rather than a mail.

15 Working With Others

3.1.4 apply

Apply is what you do to a patch that somebody darcs send s to you. You can also use it for the files you generated via send -o . Note: push is actually just apply in disguise, but with all the boring work of copying files over being done for you.

3.1.5 put

Put enables to copy a local repository to remote location (for instance, via ssh). Think of put as the opposite of get .

3.2 Dealing with conflicts

So you pulled a patch and you got a conflict. What do you do? See the chapter ../Dealing with conflicts/1 2

1 Chapter 6 on page 27 2 http://en.wikibooks.org/wiki/Category%3A

16 4 Reviewing Your Work

4.0.1 whatsnew

The whatsnew command allows you to get an overview of what unrecorded changes you have made on your working copy. This way you can get an idea of what needs to be saved.

17 Reviewing Your Work

Figure 10 Darcs whatsnew

4.0.2 changes

Changes gives a changelog-style summary of the repo history

18 Dealing with conflicts

Figure 11 Darcs changes

4.0.3

Using this command you can get an output like that produced by the diff command. Allowing you to save changes in a plain old (yet very common) format. Note that darcs does not depend on the diff binary. 1

1 http://en.wikibooks.org/wiki/Category%3A

19

5 Undoing Mistakes

There are many ways to get rid of things: remove, rollback, revert, obliterate, unpull, unrecord... One would almost think too many. Only three of these are very important. In order of gravity, they are revert , unrecord , obliterate . You can also see them as being part of this table of symmetries:

recency task anti-task more recent whatsnew revert (i.e: add, remove, mv, editing a file) recent record unrecord less recent pull unpull (aka obliterate)

Don’t worry too much about this table. Surely it will make sense later on. Anyway, here is a brief comparison of all the different ways you can get rid of stuff. Each one has its place, even the weird ones, like rollback .

5.1 The big three

5.1.1 revert only removes what’s new

Note: revert ed something by mistake? Try unrevert

The simplest of these commands is revert . All reverting does is to get rid of stuff you have not recorded yet. You can think of revert as being the ”opposite” of whatsnew. Revert gets rid of stuff that is new.

21 Undoing Mistakes

Figure 12 The darcs revert command

5.1.2 unrecord makes things new again

Unrecord does something quite different from revert. Whereas revert gets rid of stuff that is new, unrecord removes a patch, but here’s the important part, makes the stuff in it new again so that you can choose to re-record or revert it at your leisure. Unrecord should only be used if you recorded something, realised you made a mistake, and want to record it differently (note also amend-record). Note: only use unrecord if you are sure that your repository is the only one that has that patch in it!

22 The big three

Figure 13 The darcs unrecord command

Note that the picture above gives a somewhat more accurate depiction of what unrecord does - it removes a patch and the corresponding modifications from the pristine tree. The fact that something is new again is just a natural consequence of this fact.

5.1.3 obliterate is unrecord + revert

Obliterate was deliberately named to be scary. Obliterate can be seen as unrecording a patch (thus making its stuff new again) and then reverting it. In other words, obliterate totally wipes a patch out! Typically: you would use obliterate to go really far back in time. Say, ”hmm, all that stuff I’ve been working on for the past three months was pretty stupid”. Obliterate is the answer there.

23 Undoing Mistakes

Figure 14 The darcs obliterate command

i Information It is probably a good idea to darcs get a backup copy of your repository before obliterating things. This way, if you accidentally remove something by mistake, you can pull it back in

5.2 Other ways to get rid of things

5.2.1 unpull is obliterate

Unpull and obliterate are exactly the same command and is only named this way to reflect its usefulness for undoing a pull.

24 Questions and objections

5.2.2 rollback

Rollback is not a command that you can expect to use very often. The situation is this. You’ve got a patch you want to get rid of, but people have been telling you that you shouldn’t obliterate or unrecord patches that are already in other people’s repositories. So what do you do? One solution is to fire up your text editor and make exact opposite changes as the ones in the patch (and then record, etc). Another solution is to generate a rollback patch, which does the same thing. It creates a patch that does exactly the opposite of another patch. Some users just find it easier to go the text-editor route.

5.2.3 remove doesn’t belong here

Despite its getting-rid-of-things style name, remove is not really an undo kind of command. Its job is the opposite of add ’s: it tells darcs not to pay attention to a file any longer. But as we mentioned in the previous chapter, most of the time you don’t even need darcs remove . Simply telling your computer to get rid of the file in your working directory is good enough for darcs to notice it is gone.

5.3 Questions and objections

• But... but... I just want to go back to the state of my repository from two weeks ago! • obliterate is probably what you want. See above. 1

1 http://en.wikibooks.org/wiki/Category%3A

25

6 Dealing With Conflicts

6.1 Handle your conflicts at home

6.2 Resolving conflicts

For the moment, the best place to go for dealing with conflicts is the conflicts FAQ on darcs wiki1. 2

1 http://darcs.net/FAQ/Conflicts 2 http://en.wikibooks.org/wiki/Category%3A

27

7 Introduction to Patch Theory

7.1 Math and computer science nerds only

(The occasional physicist will be tolerated) Casual users be warned, the stuff you’re about to read is not for the faint of heart! If you’re a day-to-day darcs user, you probably do not need to read anything from this page on. However, if you are interested in learning how darcs really works, we invite you to roll up your sleeves, and follow us in this guided tour of the growing Theory of Patches.

7.2 What is the theory of patches?

The darcs patch formalism is the underlying ”math” which helps us understand how darcs should behave when exchanging patches between repositories. It is implemented in the darcs engine as data structures for representing sequences of patches and Haskell functions equivalent to the operations in the formalism. This section is addressed at two audiences: curious onlookers and people wanting to participate in the development of the darcs core. My aim is to help you understand the intuitions behind all this math, so that you can get up to speed with current conflictors research as fast as possible and start making contributions. You should note that I myself1 am only starting to learn about patch theory and conflictors, so there may be mistakes ahead.

7.3 Why all this math?

One difference between centralized and distributed systems is that ”merging” is something that we do practically all the time, so it is doubly important that we get merging right . Turning the problem of version control into a math problem has two effects: it lets us abstract all of the irrelevant implementation details away, and it forces us to make sure that whatever techniques we come up with are fundamentally sound, that they do not fall apart when things get increasingly complicated. Unfortunately, math can be difficult for people who do not make use of it on a regular basis, so what we attempt to do in this manual is to ease you into the math through the use of concrete, illustrated examples. A word of caution though, ”getting merging right” does not necessarily consist of having clever behaviour with respect to conflicts. We will begin by focusing on successful, non- conflicting merges and move on to the darcs approach to handling conflicts.

1 http://en.wikibooks.org/wiki/User%3AKowey

29 Introduction to Patch Theory

B Warning Note that the notation we use follows that from FOSDEM 2006, and not the darcs patch theory appendix. Namely, patch composition is written left to right. AB means that B is applied after A

7.4 Context, patches and changes

Let us begin with a little shopping. Arjan is working to build a shopping list for the upcoming darcs hackathon. As we speak, his repository contains a single file s_list with the contents

1 apples 2 bananas 3 cookies 4 rice

Note:the numbers you see are just line numbers; they are not part of the file contents As we will see in this and other examples in this book, we will often need to assign a name to the state of the repository. We call this name a context . For example, we can say that Arjan’s repository is a context o, defined by there being a file s_list with the contents mentioned above.

30 Context, patches and changes

Figure 15 the initial context

Arjan makes a modification which consists of adding a line in s_list . His new file looks like this:

1 apples 2 bananas 3 beer 4 cookies 5 rice

When Arjan records this change (adding beer), we produce a patch which tells us not only what contents Arjan added (”beer”) but where he added them, namely to line 3 of s_list .

31 Introduction to Patch Theory

We can say that in his repository, we have moved from context o to context a via a patch A. We can write this using a compact notation like oAa or using the graphical representation below:

Figure 16 patch A

7.5 Sequential patches

Starting from this context, Arjan might decide to make further changes. His new changes would be patches that apply to the context of the previous patches. So if Arjan makes a new patch B on top of this, it would take us from context a to some new context b. The

32 Inverses next patch would take us from this context to yet another new context c, and so on and so forth. Patches which apply on top of each other like this are called sequential patches . We write them in left to right order as in the table below, either representing the contexts explicitly or leaving them out for brevity:

with context sans context (shorthand) oAa A oAaBb AB oAaBbCc ABC

All darcs repositories are simply sequences of patches as above; however, when performing a complex operation such as an undo or exchanging patches with another user, it becomes absolutely essential that we have some mechanism for rearranging patches and putting them in different orders. Darcs patch theory is essentially about giving a precise definition to the ways in which patches and patch-trees can be manipulated and transformed while maintaining the coherency of the repository.

7.6 Inverses

Let’s return to the example from the beginning of this module. Arjan has just added beer to our hackathon shopping list, but in a sudden fit of indecisiveness, he reconsiders that thought and wants to undo his change. In our example, this might consist of firing up his text editor and remove the offending line from the shopping list. But what if his changes were complex and hard to keep track of? The better thing to do would be to let darcs figure it out by itself. Darcs does this by computing an inverse patch, that is, a patch which makes the exact opposite change of some other patch:

Definition The inverse of patch P is P −1, which is the patch for which the composition PP −1 makes no changes to the context and for which the inverse of the inverse is the original patch.

So above, we said that Arjan has created a patch A which adds beer to the shopping list, passing from context o to a, or more compactly, oAa. Now we are going to create the inverse patch A−1, which removes beer from the shopping list and brings us back to context o. In the compact context-patch notation, we would write this as oAaA−1o. Graphically, we would represent the situation like this:

33 Introduction to Patch Theory

Figure 17 An inverse patch makes the opposite change of another patch

Patch inverses may seem trivial, but as we will see later on in this module, they are a fun- damental operation and absolutely crucial to make some of the fancier stuff -- like merging -- work correctly. One of the rules we impose in darcs is that every patch must have an inverse. These rules are what we call patch properties . A patch property tells us things which must be true about a patch in order for darcs to work. People often like to dream up new kinds of patches to extend darcs’s functionality, and defining these patch properties is how we know that their new patch types will behave properly under darcs. The first of these properties is dead simple:

34 Commutation

Patch property: Every patch must have an inverse

7.7 Commutation

Arjan was lucky to realise that he wanted to undo his change as quickly as he did. But what happens if he was a little slower to realise his mistake? What if he makes some other changes before realising that he wants to undo the first change? Is it possible to undo his first change without undoing all the subsequent changes? It sometimes is, but to do so, we need to define an operation called commutation . Consider a variant of the example above. As usual, Arjan adds beer to the shopping list. Next, he decides to add some pasta on line 5 of the file:

35 Introduction to Patch Theory

Figure 18 Beer and pasta

The question is how darcs should behave if Arjan now decides that he does not want beer on the shopping list after all. Arjan simply wants to remove the patch that adds the beer, without touching the one which adds pasta. The problem is that darcs repositories are simple, stupid sequences of patches. We can’t just remove the beer patch, because then there would no longer be a context for the pasta patch! Arjan’s first patch A takes us to context a like so: oAa, and his second patch takes us to context b, notably starting from the initial context a: aBb. Removing patch A would be pulling the rug out from under patch B. The trick behind this is to somehow change the order of patches A and B. This is precisely what commutation is for:

36 Commutation

i Information

The commutation of patches X and Y is represented by XY ↔ Y1X1. X1 and Y1 are intended to perform the same change as X and Y

7.7.1 Why not keep our old patches?

To understand commutation, you should understand why we cannot keep our original patches, but are forced to rely on evil step sisters instead. It helps to work with a concrete example such as the beer and pasta one above. While we could write the sequence AB to represent adding beer and then pasta, simply writing BA for pasta and then beer would be a very foolish thing to do. Put it this way: what would happen if we applied B before A? We add pasta to line 5 of the file:

1 apples 2 bananas 3 cookies 4 rice 5 pasta

Does something seem amiss to you? We continue by adding beer to line 3. If you pay attention to the contents of the end result, you might notice that the order of our list is subtly wrong. Compare the two lists to see why:

BA (wrong!) AB (right) 1 apples 2 bananas 3 beer 4 cookies 5 rice 6 pasta 1 apples 2 bananas 3 beer 4 cookies 5 pasta 6 rice

It might not matter here because it is only a shopping list, but imagine that it was your PhD thesis, or your computer program to end world hunger. The error is all the more alarming because it is subtle and hard to pick out with the human eye. The problem is one of context, specifically speaking, the context between A and B. In order for instructions like ”add pasta to line 5 of s_list” to make any sense, they have to be in the correct context. Fortunately, commutation is easy to do, it produces two new patches B1 and A1 which perform the same change as A and B but with a different context in between.

Exercises: Patch A1 is identical to A. It adds ”beer” to line 3 of the shopping list. But what should patch B1 do?

One more important detail to note though! We said earlier that getting the context right is the motivation behind commutation -- we can’t simply apply patches AB in a different order, BA because that would get the context all wrong. But context does not have any effect on whether A and B can commute (or how they should commute). This is strictly a local affair. Conversely, the commutation of A and B does not have any effect either on the

37 Introduction to Patch Theory

global context: the sequences AB and B1A1 (where the latter is the commutation of the former) start from the same context and end in the same context.

7.7.2 The complex undo revisited

Now that we know what the commutation operation does, let’s see how we can use it to undo a patch that is buried under some other patch. The first thing we do is commute Arjan’s beer and pasta patches. This gives us an alternate route to the same context. But notice the small difference between B and B1!

Figure 19 commutation gives us two ways to get to the same patch

38 Commutation

The purpose of commuting the patches is essentially to push patch A on to end of the list, so that we could simply apply its inverse. Only here, it is not the inverse of A that we want, but the inverse of its evil step sister A1. This is what applying that inverse does: it walks us back to the context b1, as if we had only applied the pasta patch, but not the beer one.

Figure 20 commutation gives us two ways to get to the same patch

And now the undo is complete. To sum up, when the patch we want to undo is buried under some other patch, we use commutation to squeeze it to the end of the patch sequence, and then compute the inverse of the commuted patch. For the more sequentially minded, this is what the general scheme looks like:

39 Introduction to Patch Theory

Figure 21 Using commutation to handle a complex undo

Exercises: Imagine the opposite scenario: Arjan had started by adding pasta to the list, and then followed up with the beer. 1. If there was no commutation, what concretely would happen if he tried to remove the pasta patch, and not the beer patch? 2. Work out how this undo would work using commutation. Pay attention to the line numbers.

7.7.3 Commutation and patches

Every time we define a type of patch, we have to define how it commutes with other patches. Most of time, it is very straightforward. When commuting two hunk patches, for instance, we simply adjust their line offset. For instance, we want to put something on line 3 of the file, but if we use patch Y to insert a single line before that, what used to be line 3 now becomes line 4! So patch X1 inserts the line ”x” into line 4, much like X inserts it into line 3. Some patches cannot be commuted. For example, you can’t commute the addition of a file with adding contents to it. But for now, we focus on patches which can commute.

40 Merging

7.8 Merging

Note: this might be a good place to take a break. We are moving on to a new topic and new (but similar) examples We have presented two fundamental darcs operations: patch inverse and patch commu- tation. It turns out these two operations are almost all that we need to perform a darcs . Arjan and Ganesh are working together to build a shopping list for the upcoming darcs hackathon. Arjan initialises the repository and adds a file s_list with the contents

1 apples 2 bananas 3 cookies 4 rice

He then records his changes, and Ganesh performs a darcs get to obtain an identical copy of his repository. Notice that Arjan and Ganesh are starting from the same context

41 Introduction to Patch Theory

Figure 22 the initial context

Arjan makes a modification which consists of adding a line in s_list . His new file looks like this:

1 apples 2 bananas 3 beer 4 cookies 5 rice

Arjan’s patch brings him to a new context a:

42 Merging

Figure 23 patch A

Now, in his repository, Ganesh also makes a modification; he decides that s_list is a little hard to decipher and renames the file to shopping . Remember, at this point, Ganesh has not seen Arjan’s modifications. He’s still starting from the original context o, and has moved a new context b, via his patch B:

43 Introduction to Patch Theory

Figure 24 patch B

7.8.1 Parallel patches

At this point in time, Ganesh decides that it would be useful if he got a copy of Arjan’s changes. Roughly speaking we would like to pull Arjan’s patch A into Ganesh’s repository B. But, there is a major problem! Namely, Arjan’s patch takes us from context o to context a. Pulling it into Ganesh’s repository would involve trying to apply it to context b, which we simply do not know how to do. Put another way: Arjan’s patch tells us to add a line to file s_list ; however, in Ganesh’s repository, s_list no longer exists, as it has been moved to shopping . How are we supposed to know that Arjan’s change (adding the line ”beer”) is supposed to apply to the new file shopping instead?

44 Merging

Figure 25 Ganesh attempts to pull from Arjan

Arjan and Ganesh’s patches start from the same context o and diverge to different contexts a and b. We say that their patches are parallel to each other, and write it as A ∨ B. In trying to pull patches from Arjan’s repository, we are trying to merge these two patches. The basic approach is to convert the parallel patches into the sequential patches BA1, such that A1 does essentially the same change as A does, but within the context of b. We want o b c to produce the situation B A1

45 Introduction to Patch Theory

7.8.2 Performing the merge

Converting Arjan and Ganesh’s parallel patches into sequential ones requires little more than the inverse and commutation operations that we described earlier in this module: 1. So we’re starting out with just Ganesh’s patch. In context notation, we are at oBb 2. We calculate the inverse patch B−1. The sequence BB−1 consists of moving s_list to shopping and then back again. We’ve walked our way back to the original context: oBbB−1o 3. Now we can apply Arjan’s patch without worries: oBbB−1oAa, but the result does not look very interesting, because we’ve basically got the same thing Arjan has now, not a merge. 4. All we need to do is commute the last two patches, B−1A, to get a new pair of patches −1 A1B1 . Still, the end result doesn’t seem to look very interesting since it results in o b c −1a exactly the same state as the last step: B A1 B1 5. However, one crucial difference is that the second to last patch produces just the state −1 we’re looking for! All we now have to do to get at it is to ditch the B1 patch, which is only serving to undo Ganesh’s precious work anyway. That is to say, by simply determining how to produce an A1 which will commute with B, we have determined the version of A which will update Ganesh’s repository.

Figure 26 Merging via inverse and commutation

The end result of all this is that we have the patch we’re looking for, A1 and a successful merge.

46 Merging

Figure 27 We want a new patch A_1

7.8.3 Merging is symmetric

Note: Merging is symmetric

Concretely, we’ve talked about Ganesh pulling Arjan’s patch into his repository, so what about the other way around? Arjan pulling Ganesh’s patch into his repository would work the same exact way, only that he is looking for a commuted version of Ganesh’s patch B1

47 Introduction to Patch Theory that would apply to his repository. If Ganesh can pull Arjan’s patch in, then Arjan can pull Ganesh’s one too, and the result would be exactly the same:

Figure 28 Merging is symmetric

Definition The result of a merge of two patches A and B is one of two patches A1 and B1, which satisfy the relationship A ∨ B =⇒ BA1 ↔ AB1

The merge definition describes what should happen when you combine two parallel patches into a patch sequence. The built-in symmetry is essential for darcs because a darcs reposi- tory is defined entirely by its patches. Put another way,

48 Definitions and properties

To be written

7.8.4 The commutation with inverse property

The definition of a merge tells us what we want merging to look like. How did we know how to actually perform that merge? The answer comes out of the following property of commutation and inverse: if you can commute the inverse of a patch A−1 with some other patch B, then you can also commute the patch itself against B1.

i Information −1 −1 BA1 ↔ AB1 if and only if B1A1 ↔ A B, provided both commutations succeed.

Note how the left hand side of this property exactly matches the relationship demanded by the definition of a merge. To see why this all works, To be written

7.9 Definitions and properties

definition of inverse AA−1 has no effect inverse of an inverse (A−1)−1 = A inverse composition property (AB)−1 = B−1A−1 definition of commutation AB ↔ B1A1 definition of a merge A ∨ B =⇒ BA1 ↔ AB1 −1 −1 commutation with inverse property BA1 ↔ AB1 if and only if B1A1 ↔ A B

2

2 http://en.wikibooks.org/wiki/Category%3A

49

8 Intermediary Patch Theory

8.1 It’s all patches

Note: Prior to darcs 1.0.6, changes were also called patches , but we decided it was too confusing.

Before moving on, we would like to make one very minor point clear: in the day to day operation of darcs, we talk about pulling and pushing patches , and of recording and reverting changes . This is just a user interface convention. In patch theory terms, all of these are just patches. The patches which you pull and push are named patches , patches which contain a name and a list of unnamed patches. So in fact, when you pull a single named patch from somebody else’s repository, you are pulling a sequence of potentially many primitive patches. What does this mean for merging?

8.2 Merging a sequence of patches

In the last chapter, we saw that dealing with simple, non-conflicting merges consists mainly of making an inverse patch and commuting that inverse with the other side’s patches. Let us now explore a slightly more complicated scenario, where we have to merge against a non-conflicting sequence of patches. We do this with a variant of the darcs hackathon shopping list. As usual, Arjan and Ganesh are working together to write the shopping list. They both start from a common file shplst containing

apples bananas cookies

As before, Arjan inserts ”beer” in line 3 of shplst and records the change. He then decides to add another item on the end of the list, this time, ”pasta” and records his second change. In darcs notation, Arjan has brought us from an initial context o, to a new context a with beer in it, and then to yet another context c with pasta as well.. FIXME: will be fleshed out: i want to show what happens when Ganesh pulls two patches in

51 Intermediary Patch Theory

8.3 Sequences of patches

8.4 Permutivity

1

1 http://en.wikibooks.org/wiki/Category%3A

52 9 Patch Theory and Conflicts

B Warning This guide uses notation and terminology developed during FOSDEM 2006, so it will be out of synch with the older notation/terminology from the darcs-conflicts mailing list archive

9.1 Conflicts

Up to now, we have only dealt with merging patches that do not conflict with each other. The next question of interest is how darcs should behave when they do. Consider the previous darcs hackathon example, where as usual, Arjan decides that the shopping list needs some beer. In this scenario, Ganesh decides that you can’t live on apples and cookies alone and records a patch adding ”pasta” to the s_list file. Now he wants to know what Arjan is up to, and so pulls the beer patch into his repository, but oh no! Arjan and Ganesh’s patches conflict! How should darcs behave here?

53 Patch Theory and Conflicts

Figure 29 Arjan and Ganesh’s patches conflict

The darcs answer is that both patches cancel each other out so that neither of them has any effect. The resulting shopping list has neither beer nor pasta. This might sound alarming, but it’s not as bad as you might think. Darcs does not silently delete your code. After canceling the two patches out, it adds a third patch into your working directory which indicates both sides of the conflict so that you can select the one that you want. So any resolution you apply is a third patch which depends on the two conflicting ones. If you did darcs whatsnew on Ganesh’s repository at this point, what you would get is something like this: v v v v v v

54 Conflicts

beer ------pasta ˆ ˆ ˆ ˆ ˆ ˆ

9.1.1 How do we know we have a conflict?

It is intuitively obvious that Arjan’s patch conflicts with Ganesh’s, but intuition is useless if it does not translate into actual Haskell code. The first issue is thus that of knowing that we have a conflict in the first place. All of this boils down to commutation. We have a conflict if commutation is not defined for the two patches. Let us briefly revisit the merge process described in the previous chapter1. When Ganesh tries to pull Arjan’s patch in, he tries to adapt the patch to his context by performing the following sequence: invert his own patch, apply Arjan’s patch A, commute the inverted patch with Arjan’s patch, and discard the evil step sister of his inverted patch. As we know, inverting patches is easy. Ganesh’s patch is inverted into something which remove ’pasta’ from line 3 of the s_list file. On the other hand, when we try to commute that against Arjan’s patch, we have a failure. Why? Simply because it is how we define commutation between the two types of patches. For instance, both Ganesh’s and Arjan’s patches are hunk patches . The commutation of two hunk patches of the same file is defined in darcs using Haskell code very similar to the following (simplified from PatchCommute.lhs): commuteHunk :: FileName -> (FilePatchType, FilePatchType) -> Maybe (Patch, Patch) commuteHunk f (p1@(Hunk line2 old2 new2), p2@(Hunk line1 old1 new1)) | line1 + lengthnew1 < line2 = Just ... | line1 + lengthnew1 == line2 && nonZero = Just ... | line2 + lengthold2 < line1 = Just ... | line2 + lengthold2 == line1 && nonZero = Just ... | otherwise = Nothing where nonZero = lengthold2 /= 0 && lengthold1 /= 0 && lengthnew2 /= 0 && lengthnew1 /= 0 lengthnew1 = length new1 lengthnew2 = length new2 lengthold1 = length old1 lengthold2 = length old2

Only four cases are defined. The first two cases cover the situation where the p1 occurs in an earlier part file than p2 (even bumping up against it as in the second case). The latter two cases cover the reverse situation (p2 is in earlier part of the file than p1 ). However, the case where p1 and p2 overlap simply does not fall into one of these possibilities. Thus we have a conflict on our hands.

1 Chapter 7 on page 29

55 Patch Theory and Conflicts

9.2 Forced commutation

Now that we know we have a conflict, we now need to deal with this conflict in a sane manner. We not only want to deal with the conflict at hand, but deal with it in a way which allows the conflict to propagate cleanly across an entire sequence of patches. Well, darcs is based on commutation, so in order to keep things running smoothly, we need to make sure that things continue to commute. So, we’re going to define a secondary forced commutation operation that we only use when there is a conflict. Recall the definition of commutation from the previous chapter:

i Information

The commutation of patches X and Y is represented by XY ↔ Y1X1. X1 and Y1 are intended to perform the same change as X and Y

The forced commutation is going to do something similar, but with a very odd twist. Instead of patches Y1 and X1 performing the same change as their respective ancestors Y and X; forced commutation is going to give us patches, each of which makes the change that the other patch does. That is, normal commutation wants Y1 to do roughly the same thing as Y , but forced commutation makes it do the same thing as X.

operation effect of Y1 effect of X1 normal commutation Y X forced commutation X Y

9.2.1 Effects

As a side note, we’re going to need a little terminology to keep ourselves from tripping over our tongues. It’s not very convenient to always talk about one patch making the same change as another patch, which is something we will be referring to a lot. So let us compress things a little bit. Instead of saying that patch Y1 makes the same change as X, let us simply say that the effect of Y1 is X. It is the same idea, but with slightly smoother terminology.

9.3 Forced commutation in merging

Let us see what the implications of this are for Ganesh and Arjan. We want to commute the inverse of Ganesh’s patch (B−1) against Arjan’s patch. Since the two patches conflict, −1 we have to resort to forced commutation, which produces two patches A1 and B1 with the following bizarre properties: −1 • the effect of A1 is B ; it removes Ganesh’s ”pasta” from the shopping list. −1 • likewise, the effect of B1 is A; it adds Arjan’s ”beer” to the shopping list.

56 Forced commutation in merging

Figure 30 Merging a conflict through forced commutation

This is all very convenient, because if I may remind you, what we’re really after is cancelling −1 out the patches. If we do the standard merging technique of simply removing B1 (so we don’t add the beer after all), we will have succesfully undone Ganesh’s pasta patch. The merge is complete!

57 Patch Theory and Conflicts

Figure 31 Resolving Arjan and Ganesh’s conflict

9.3.1 Marking the conflict

But wait! We can’t just leave things undone. How is the poor developer supposed to know if there is a conflict, if darcs handles them by undoing things? The answer is that we’re not going to stop here. Undoing the conflict is a very important first step, as we will see in further detail below. Look at it this way. We know there was a conflict, because of the way commutation was defined, and we know which patches were involved in the conflict. So whenever this happens, we first undo everything, and then inspect the contents of the conflicting patches, and use that to create a new conflict-marking patch.

58 Darcs 2

FIXME:insert image here showing the conflict-marking patch

9.4 Darcs 2

:TODO: introduce this section

9.4.1 The exponential merge problem

Unfortunately, the darcs 1 merge algorithm has the property that certain merges -- merges that people have experienced in real life -- are exponential in time with respect to the size of conflict (in number of conflicting patches). This leads to the problem that some users have experienced where users would do a darcs pull and inexplicably, darcs would just sit there and hang... So how does the new darcs 2 fix this problem? What’s going on under the hood?

9.4.2 Conflictors

The notion of conflictors is essentially that we would special patches that contain a list of patches they conflict with

9.4.3 Use of Generalised Algebraic Datatypes to improve code safety

• See also Haskell/GADT2 and http://wiki.darcs.net/Ideas/GADTPlan

9.5 Current research

3

2 http://en.wikibooks.org/wiki/Haskell%2FGADT 3 http://en.wikibooks.org/wiki/Category%3A

59

10 Contributors

Edits User 10 Adrignola1 6 Jguk2 291 Kowey3 1 QuiteUnusual4 10 Thenub3145

1 http://en.wikibooks.org/wiki/User:Adrignola 2 http://en.wikibooks.org/wiki/User:Jguk 3 http://en.wikibooks.org/wiki/User:Kowey 4 http://en.wikibooks.org/wiki/User:QuiteUnusual 5 http://en.wikibooks.org/wiki/User:Thenub314

61

List of Figures

• GFDL: Gnu Free Documentation License. http://www.gnu.org/licenses/fdl. html • cc-by-sa-3.0: Creative Commons Attribution ShareAlike 3.0 License. http:// creativecommons.org/licenses/by-sa/3.0/ • cc-by-sa-2.5: Creative Commons Attribution ShareAlike 2.5 License. http:// creativecommons.org/licenses/by-sa/2.5/ • cc-by-sa-2.0: Creative Commons Attribution ShareAlike 2.0 License. http:// creativecommons.org/licenses/by-sa/2.0/ • cc-by-sa-1.0: Creative Commons Attribution ShareAlike 1.0 License. http:// creativecommons.org/licenses/by-sa/1.0/ • cc-by-2.0: Creative Commons Attribution 2.0 License. http://creativecommons. org/licenses/by/2.0/ • cc-by-2.0: Creative Commons Attribution 2.0 License. http://creativecommons. org/licenses/by/2.0/deed.en • cc-by-2.5: Creative Commons Attribution 2.5 License. http://creativecommons. org/licenses/by/2.5/deed.en • cc-by-3.0: Creative Commons Attribution 3.0 License. http://creativecommons. org/licenses/by/3.0/deed.en • GPL: GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt • LGPL: GNU Lesser General Public License. http://www.gnu.org/licenses/lgpl. html • PD: This image is in the public domain. • ATTR: The copyright holder of this file allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted. • EURO: This is the common (reverse) face of a euro coin. The copyright on the design of the common face of the euro coins belongs to the European Commission. Authorised is reproduction in a format without relief (drawings, paintings, films) provided they are not detrimental to the image of the euro. • LFK: Lizenz Freie Kunst. http://artlibre.org/licence/lal/de • CFR: Copyright free use.

63 List of Figures

• EPL: Eclipse Public License. http://www.eclipse.org/org/documents/epl-v10. php Copies of the GPL, the LGPL as well as a GFDL are included in chapter Licenses6. Please note that images in the public domain do not require attribution. You may click on the image numbers in the following table to open the webpage of the images in your webbrower.

6 Chapter 11 on page 67

64 List of Figures

1 Emijrpbot, Hazard-Bot, JarektBot, Kowey 2 Emijrpbot, Hazard-Bot, JarektBot, Kowey 3 Emijrpbot, Hazard-Bot, JarektBot, Kowey 4 Emijrpbot, Hazard-Bot, JarektBot, Kowey 5 Emijrpbot, Hazard-Bot, JarektBot, Kowey 6 Emijrpbot, Hazard-Bot, JarektBot, Kowey 7 Emijrpbot, Hazard-Bot, JarektBot, Kowey 8 Emijrpbot, Hazard-Bot, JarektBot, Kowey 9 Emijrpbot, Hazard-Bot, JarektBot, Kowey 10 Emijrpbot, Hazard-Bot, JarektBot, Kowey 11 Eric Kow GFDL 12 Eric Kow GFDL 13 Eric Kow GFDL 14 Eric Kow GFDL 15 AtonX, Emijrpbot, Hazard-Bot, JarektBot, Kowey 16 Emijrpbot, Hazard-Bot, JarektBot, Kowey 17 Emijrpbot, Hazard-Bot, JarektBot, Kowey 18 Emijrpbot, Hazard-Bot, JarektBot, Kowey 19 Bukk, Emijrpbot, Hazard-Bot, Kowey 20 Emijrpbot, Hazard-Bot, JarektBot, Kowey 21 Emijrpbot, Hazard-Bot, JarektBot, Kowey 22 AtonX, Emijrpbot, Hazard-Bot, JarektBot, Kowey 23 Emijrpbot, Hazard-Bot, JarektBot, Kowey 24 Emijrpbot, Hazard-Bot, JarektBot, Kowey 25 Emijrpbot, Hazard-Bot, JarektBot, Kowey 26 Emijrpbot, Hazard-Bot, JarektBot, Kowey 27 Emijrpbot, Hazard-Bot, JarektBot, Kowey 28 Emijrpbot, Hazard-Bot, JarektBot, Kowey 29 Emijrpbot, Hazard-Bot, JarektBot, Kowey 30 AtonX, Emijrpbot, Hazard-Bot, JarektBot, Kowey 31 AtonX, Emijrpbot, Hazard-Bot, JarektBot, Kowey

65

11 Licenses

11.1 GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007 The “Corresponding Source” for a work in object code form means all different server (operated by you or a third party) that supports equiv- your license, and (b) permanently, if the copyright holder fails to no- the source code needed to generate, install, and (for an executable alent copying facilities, provided you maintain clear directions next to tify you of the violation by some reasonable means prior to 60 days Copyright © 2007 Free Software Foundation, Inc. work) run the object code and to modify the work, including scripts the object code saying where to find the Corresponding Source. Re- after the cessation. to control those activities. However, it does not include the work’s gardless of what server hosts the Corresponding Source, you remain System Libraries, or general-purpose tools or generally available free obligated to ensure that it is available for as long as needed to satisfy Everyone is permitted to copy and distribute verbatim copies of this Moreover, your license from a particular copyright holder is reinstated programs which are used unmodified in performing those activities but these requirements. * e) Convey the object code using peer-to-peer license document, but changing it is not allowed. Preamble permanently if the copyright holder notifies you of the violation by which are not part of the work. For example, Corresponding Source transmission, provided you inform other peers where the object code some reasonable means, this is the first time you have received notice includes interface definition files associated with source files for the and Corresponding Source of the work are being offered to the general of violation of this License (for any work) from that copyright holder, The GNU General Public License is a free, copyleft license for software work, and the source code for shared libraries and dynamically linked public at no charge under subsection 6d. and you cure the violation prior to 30 days after your receipt of the and other kinds of works. subprograms that the work is specifically designed to require, such as notice. by intimate data communication or control flow between those sub- A separable portion of the object code, whose source code is excluded The licenses for most software and other practical works are designed programs and other parts of the work. from the Corresponding Source as a System Library, need not be in- Termination of your rights under this section does not terminate the to take away your freedom to share and change the works. By con- cluded in conveying the object code work. licenses of parties who have received copies or rights from you under trast, the GNU General Public License is intended to guarantee your The Corresponding Source need not include anything that users can re- this License. If your rights have been terminated and not permanently freedom to share and change all versions of a program–to make sure generate automatically from other parts of the Corresponding Source. reinstated, you do not qualify to receive new licenses for the same it remains free software for all its users. We, the Free Software Foun- A “User Product” is either (1) a “consumer product”, which means any material under section 10. 9. Acceptance Not Required for Having dation, use the GNU General Public License for most of our software; tangible personal property which is normally used for personal, family, The Corresponding Source for a work in source code form is that same Copies. it applies also to any other work released this way by its authors. You or household purposes, or (2) anything designed or sold for incorpora- work. 2. Basic Permissions. can apply it to your programs, too. tion into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a You are not required to accept this License in order to receive or run All rights granted under this License are granted for the term of copy- particular product received by a particular user, “normally used” refers a copy of the Program. Ancillary propagation of a covered work oc- When we speak of free software, we are referring to freedom, not price. right on the Program, and are irrevocable provided the stated con- to a typical or common use of that class of product, regardless of the curring solely as a consequence of using peer-to-peer transmission to Our General Public Licenses are designed to make sure that you have ditions are met. This License explicitly affirms your unlimited per- status of the particular user or of the way in which the particular receive a copy likewise does not require acceptance. However, nothing the freedom to distribute copies of free software (and charge for them mission to run the unmodified Program. The output from running a user actually uses, or expects or is expected to use, the product. A other than this License grants you permission to propagate or modify if you wish), that you receive source code or can get it if you want covered work is covered by this License only if the output, given its product is a consumer product regardless of whether the product has any covered work. These actions infringe copyright if you do not accept it, that you can change the software or use pieces of it in new free content, constitutes a covered work. This License acknowledges your substantial commercial, industrial or non-consumer uses, unless such this License. Therefore, by modifying or propagating a covered work, programs, and that you know you can do these things. rights of fair use or other equivalent, as provided by copyright law. uses represent the only significant mode of use of the product. you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. To protect your rights, we need to prevent others from denying you You may make, run and propagate covered works that you do not con- these rights or asking you to surrender the rights. Therefore, you have “Installation Information” for a User Product means any methods, pro- vey, without conditions so long as your license otherwise remains in Each time you convey a covered work, the recipient automatically re- certain responsibilities if you distribute copies of the software, or if you cedures, authorization keys, or other information required to install force. You may convey covered works to others for the sole purpose ceives a license from the original licensors, to run, modify and prop- modify it: responsibilities to respect the freedom of others. and execute modified versions of a covered work in that User Product of having them make modifications exclusively for you, or provide you from a modified version of its Corresponding Source. The information agate that work, subject to this License. You are not responsible for with facilities for running those works, provided that you comply with must suffice to ensure that the continued functioning of the modified enforcing compliance by third parties with this License. For example, if you distribute copies of such a program, whether gratis the terms of this License in conveying all material for which you do not object code is in no case prevented or interfered with solely because or for a fee, you must pass on to the recipients the same freedoms that control copyright. Those thus making or running the covered works modification has been made. An “entity transaction” is a transaction transferring control of an or- you received. You must make sure that they, too, receive or can get for you must do so exclusively on your behalf, under your direction ganization, or substantially all assets of one, or subdividing an orga- the source code. And you must show them these terms so they know and control, on terms that prohibit them from making any copies of If you convey an object code work under this section in, or with, or nization, or merging organizations. If propagation of a covered work their rights. your copyrighted material outside their relationship with you. specifically for use in, a User Product, and the conveying occurs as results from an entity transaction, each party to that transaction who part of a transaction in which the right of possession and use of the receives a copy of the work also receives whatever licenses to the work Developers that use the GNU GPL protect your rights with two steps: Conveying under any other circumstances is permitted solely under User Product is transferred to the recipient in perpetuity or for a fixed the party’s predecessor in interest had or could give under the previous (1) assert copyright on the software, and (2) offer you this License the conditions stated below. Sublicensing is not allowed; section 10 term (regardless of how the transaction is characterized), the Corre- paragraph, plus a right to possession of the Corresponding Source of giving you legal permission to copy, distribute and/or modify it. makes it unnecessary. 3. Protecting Users’ Legal Rights From Anti- sponding Source conveyed under this section must be accompanied by the work from the predecessor in interest, if the predecessor has it or Circumvention Law. the Installation Information. But this requirement does not apply if can get it with reasonable efforts. For the developers’ and authors’ protection, the GPL clearly explains neither you nor any third party retains the ability to install modi- that there is no warranty for this free software. For both users’ and No covered work shall be deemed part of an effective technological fied object code on the User Product (for example, the work has been You may not impose any further restrictions on the exercise of the authors’ sake, the GPL requires that modified versions be marked as measure under any applicable law fulfilling obligations under article installed in ROM). rights granted or affirmed under this License. For example, you may changed, so that their problems will not be attributed erroneously to 11 of the WIPO copyright treaty adopted on 20 December 1996, or not impose a license fee, royalty, or other charge for exercise of rights authors of previous versions. similar laws prohibiting or restricting circumvention of such measures. The requirement to provide Installation Information does not include granted under this License, and you may not initiate litigation (in- a requirement to continue to provide support service, warranty, or up- cluding a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or Some devices are designed to deny users access to install or run mod- When you convey a covered work, you waive any legal power to forbid dates for a work that has been modified or installed by the recipient, importing the Program or any portion of it. 11. Patents. ified versions of the software inside them, although the manufacturer circumvention of technological measures to the extent such circum- or for the User Product in which it has been modified or installed. can do so. This is fundamentally incompatible with the aim of protect- vention is effected by exercising rights under this License with respect Access to a network may be denied when the modification itself ma- ing users’ freedom to change the software. The systematic pattern of to the covered work, and you disclaim any intention to limit opera- terially and adversely affects the operation of the network or violates A “contributor” is a copyright holder who authorizes use under this such abuse occurs in the area of products for individuals to use, which tion or modification of the work as a means of enforcing, against the the rules and protocols for communication across the network. License of the Program or a work on which the Program is based. The is precisely where it is most unacceptable. Therefore, we have designed work’s users, your or third parties’ legal rights to forbid circumvention work thus licensed is called the contributor’s “contributor version”. this version of the GPL to prohibit the practice for those products. If of technological measures. 4. Conveying Verbatim Copies. such problems arise substantially in other domains, we stand ready to Corresponding Source conveyed, and Installation Information pro- A contributor’s “essential patent claims” are all patent claims owned extend this provision to those domains in future versions of the GPL, vided, in accord with this section must be in a format that is publicly or controlled by the contributor, whether already acquired or hereafter as needed to protect the freedom of users. You may convey verbatim copies of the Program’s source code as you documented (and with an implementation available to the public in receive it, in any medium, provided that you conspicuously and appro- source code form), and must require no special password or key for acquired, that would be infringed by some manner, permitted by this priately publish on each copy an appropriate copyright notice; keep in- unpacking, reading or copying. 7. Additional Terms. License, of making, using, or selling its contributor version, but do Finally, every program is threatened constantly by software patents. tact all notices stating that this License and any non-permissive terms not include claims that would be infringed only as a consequence of States should not allow patents to restrict development and use of soft- added in accord with section 7 apply to the code; keep intact all no- further modification of the contributor version. For purposes of this ware on general-purpose computers, but in those that do, we wish to “Additional permissions” are terms that supplement the terms of this tices of the absence of any warranty; and give all recipients a copy of definition, “control” includes the right to grant patent sublicenses in a avoid the special danger that patents applied to a free program could License by making exceptions from one or more of its conditions. Ad- this License along with the Program. manner consistent with the requirements of this License. make it effectively proprietary. To prevent this, the GPL assures that ditional permissions that are applicable to the entire Program shall be patents cannot be used to render the program non-free. treated as though they were included in this License, to the extent that You may charge any price or no price for each copy that you con- they are valid under applicable law. If additional permissions apply Each contributor grants you a non-exclusive, worldwide, royalty-free vey, and you may offer support or warranty protection for a fee. 5. patent license under the contributor’s essential patent claims, to make, The precise terms and conditions for copying, distribution and modi- only to part of the Program, that part may be used separately under Conveying Modified Source Versions. use, sell, offer for sale, import and otherwise run, modify and propa- fication follow. TERMS AND CONDITIONS 0. Definitions. those permissions, but the entire Program remains governed by this License without regard to the additional permissions. gate the contents of its contributor version. You may convey a work based on the Program, or the modifications “This License” refers to version 3 of the GNU General Public License. In the following three paragraphs, a “patent license” is any express to produce it from the Program, in the form of source code under the When you convey a copy of a covered work, you may at your option agreement or commitment, however denominated, not to enforce a terms of section 4, provided that you also meet all of these conditions: remove any additional permissions from that copy, or from any part “Copyright” also means copyright-like laws that apply to other kinds patent (such as an express permission to practice a patent or covenant of it. (Additional permissions may be written to require their own of works, such as semiconductor masks. not to sue for patent infringement). To “grant” such a patent license * a) The work must carry prominent notices stating that you modified removal in certain cases when you modify the work.) You may place to a party means to make such an agreement or commitment not to it, and giving a relevant date. * b) The work must carry prominent additional permissions on material, added by you to a covered work, enforce a patent against the party. “The Program” refers to any copyrightable work licensed under this Li- notices stating that it is released under this License and any conditions for which you have or can give appropriate copyright permission. cense. Each licensee is addressed as “you”. “Licensees” and “recipients” added under section 7. This requirement modifies the requirement in may be individuals or organizations. section 4 to “keep intact all notices”. * c) You must license the entire If you convey a covered work, knowingly relying on a patent license, Notwithstanding any other provision of this License, for material you work, as a whole, under this License to anyone who comes into pos- and the Corresponding Source of the work is not available for anyone add to a covered work, you may (if authorized by the copyright holders session of a copy. This License will therefore apply, along with any to copy, free of charge and under the terms of this License, through To “modify” a work means to copy from or adapt all or part of the work of that material) supplement the terms of this License with terms: in a fashion requiring copyright permission, other than the making of applicable section 7 additional terms, to the whole of the work, and a publicly available network server or other readily accessible means, an exact copy. The resulting work is called a “modified version” of the all its parts, regardless of how they are packaged. This License gives then you must either (1) cause the Corresponding Source to be so earlier work or a work “based on” the earlier work. no permission to license the work in any other way, but it does not * a) Disclaiming warranty or limiting liability differently from the available, or (2) arrange to deprive yourself of the benefit of the patent invalidate such permission if you have separately received it. * d) If terms of sections 15 and 16 of this License; or * b) Requiring preser- license for this particular work, or (3) arrange, in a manner consistent vation of specified reasonable legal notices or author attributions in with the requirements of this License, to extend the patent license to A “covered work” means either the unmodified Program or a work the work has interactive user interfaces, each must display Appropriate that material or in the Appropriate Legal Notices displayed by works downstream recipients. “Knowingly relying” means you have actual based on the Program. Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make containing it; or * c) Prohibiting misrepresentation of the origin of knowledge that, but for the patent license, your conveying the cov- them do so. that material, or requiring that modified versions of such material be ered work in a country, or your recipient’s use of the covered work To “propagate” a work means to do anything with it that, without per- marked in reasonable ways as different from the original version; or * in a country, would infringe one or more identifiable patents in that mission, would make you directly or secondarily liable for infringement d) Limiting the use for publicity purposes of names of licensors or au- country that you have reason to believe are valid. A compilation of a covered work with other separate and independent under applicable copyright law, except executing it on a computer or thors of the material; or * e) Declining to grant rights under trademark works, which are not by their nature extensions of the covered work, modifying a private copy. Propagation includes copying, distribution law for use of some trade names, trademarks, or service marks; or * and which are not combined with it such as to form a larger program, If, pursuant to or in connection with a single transaction or arrange- (with or without modification), making available to the public, and in f) Requiring indemnification of licensors and authors of that material in or on a volume of a storage or distribution medium, is called an ment, you convey, or propagate by procuring conveyance of, a covered some countries other activities as well. by anyone who conveys the material (or modified versions of it) with “aggregate” if the compilation and its resulting copyright are not used work, and grant a patent license to some of the parties receiving the contractual assumptions of liability to the recipient, for any liability to limit the access or legal rights of the compilation’s users beyond covered work authorizing them to use, propagate, modify or convey a To “convey” a work means any kind of propagation that enables other that these contractual assumptions directly impose on those licensors what the individual works permit. Inclusion of a covered work in an specific copy of the covered work, then the patent license you grant is parties to make or receive copies. Mere interaction with a user through and authors. aggregate does not cause this License to apply to the other parts of automatically extended to all recipients of the covered work and works a computer network, with no transfer of a copy, is not conveying. the aggregate. 6. Conveying Non-Source Forms. based on it. All other non-permissive additional terms are considered “further re- An interactive user interface displays “Appropriate Legal Notices” to You may convey a covered work in object code form under the terms of strictions” within the meaning of section 10. If the Program as you A patent license is “discriminatory” if it does not include within the the extent that it includes a convenient and prominently visible fea- sections 4 and 5, provided that you also convey the machine-readable received it, or any part of it, contains a notice stating that it is gov- scope of its coverage, prohibits the exercise of, or is conditioned on the ture that (1) displays an appropriate copyright notice, and (2) tells the Corresponding Source under the terms of this License, in one of these erned by this License along with a term that is a further restriction, non-exercise of one or more of the rights that are specifically granted user that there is no warranty for the work (except to the extent that ways: you may remove that term. If a license document contains a further under this License. You may not convey a covered work if you are warranties are provided), that licensees may convey the work under restriction but permits relicensing or conveying under this License, you a party to an arrangement with a third party that is in the business this License, and how to view a copy of this License. If the inter- may add to a covered work material governed by the terms of that li- of distributing software, under which you make payment to the third * a) Convey the object code in, or embodied in, a physical product (in- face presents a list of user commands or options, such as a menu, a cense document, provided that the further restriction does not survive party based on the extent of your activity of conveying the work, and cluding a physical distribution medium), accompanied by the Corre- prominent item in the list meets this criterion. 1. Source Code. such relicensing or conveying. under which the third party grants, to any of the parties who would sponding Source fixed on a durable physical medium customarily used receive the covered work from you, a discriminatory patent license (a) for software interchange. * b) Convey the object code in, or embodied The “source code” for a work means the preferred form of the work for in connection with copies of the covered work conveyed by you (or in, a physical product (including a physical distribution medium), ac- If you add terms to a covered work in accord with this section, you making modifications to it. “Object code” means any non-source form copies made from those copies), or (b) primarily for and in connection companied by a written offer, valid for at least three years and valid must place, in the relevant source files, a statement of the additional of a work. with specific products or compilations that contain the covered work, for as long as you offer spare parts or customer support for that prod- terms that apply to those files, or a notice indicating where to find the unless you entered into that arrangement, or that patent license was uct model, to give anyone who possesses the object code either (1) a applicable terms. granted, prior to 28 March 2007. A “Standard Interface” means an interface that either is an official copy of the Corresponding Source for all the software in the product standard defined by a recognized standards body, or, in the case of that is covered by this License, on a durable physical medium cus- Additional terms, permissive or non-permissive, may be stated in the interfaces specified for a particular programming language, one that is Nothing in this License shall be construed as excluding or limiting any tomarily used for software interchange, for a price no more than your form of a separately written license, or stated as exceptions; the above widely used among developers working in that language. implied license or other defenses to infringement that may otherwise reasonable cost of physically performing this conveying of source, or requirements apply either way. 8. Termination. (2) access to copy the Corresponding Source from a network server at be available to you under applicable patent law. 12. No Surrender of The “System Libraries” of an executable work include anything, other no charge. * c) Convey individual copies of the object code with a Others’ Freedom. than the work as a whole, that (a) is included in the normal form of copy of the written offer to provide the Corresponding Source. This You may not propagate or modify a covered work except as expressly packaging a Major Component, but which is not part of that Major alternative is allowed only occasionally and noncommercially, and only provided under this License. Any attempt otherwise to propagate or If conditions are imposed on you (whether by court order, agreement Component, and (b) serves only to enable use of the work with that if you received the object code with such an offer, in accord with sub- modify it is void, and will automatically terminate your rights under or otherwise) that contradict the conditions of this License, they do Major Component, or to implement a Standard Interface for which an section 6b. * d) Convey the object code by offering access from a this License (including any patent licenses granted under the third not excuse you from the conditions of this License. If you cannot con- implementation is available to the public in source code form. A “Ma- designated place (gratis or for a charge), and offer equivalent access to paragraph of section 11). vey a covered work so as to satisfy simultaneously your obligations jor Component”, in this context, means a major essential component the Corresponding Source in the same way through the same place at under this License and any other pertinent obligations, then as a con- (kernel, window system, and so on) of the specific (if no further charge. You need not require recipients to copy the Corre- However, if you cease all violation of this License, then your license sequence you may not convey it at all. For example, if you agree to any) on which the executable work runs, or a compiler used to produce sponding Source along with the object code. If the place to copy the from a particular copyright holder is reinstated (a) provisionally, un- terms that obligate you to collect a royalty for further conveying from the work, or an object code interpreter used to run it. object code is a network server, the Corresponding Source may be on a less and until the copyright holder explicitly and finally terminates those to whom you convey the Program, the only way you could satisfy

67 Licenses

both those terms and this License would be to refrain entirely from Later license versions may give you additional or different permissions. If the disclaimer of warranty and limitation of liability provided above You should have received a copy of the GNU General Public License conveying the Program. 13. Use with the GNU Affero General Public However, no additional obligations are imposed on any author or copy- cannot be given local legal effect according to their terms, reviewing along with this program. If not, see . License. right holder as a result of your choosing to follow a later version. 15. courts shall apply local law that most closely approximates an abso- Disclaimer of Warranty. lute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program Also add information on how to contact you by electronic and paper Notwithstanding any other provision of this License, you have permis- in return for a fee. mail. sion to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single com- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EX- If the program does terminal interaction, make it output a short notice bined work, and to convey the resulting work. The terms of this Li- TENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN END OF TERMS AND CONDITIONS How to Apply These Terms like this when it starts in an interactive mode: cense will continue to apply to the part which is the covered work, but OTHERWISE STATED IN WRITING THE COPYRIGHT HOLD- to Your New Programs the special requirements of the GNU Affero General Public License, ERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EX- section 13, concerning interaction through a network will apply to the If you develop a new program, and you want it to be of the greatest Copyright (C) This program PRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, combination as such. 14. Revised Versions of this License. possible use to the public, the best way to achieve this is to make it comes with ABSOLUTELY NO WARRANTY; for details type ‘show THE IMPLIED WARRANTIES OF MERCHANTABILITY AND free software which everyone can redistribute and change under these w’. This is free software, and you are welcome to redistribute it under FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK terms. certain conditions; type ‘show c’ for details. The Free Software Foundation may publish revised and/or new ver- AS TO THE QUALITY AND PERFORMANCE OF THE PRO- sions of the GNU General Public License from time to time. Such new GRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DE- To do so, attach the following notices to the program. It is safest to versions will be similar in spirit to the present version, but may differ FECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SER- attach them to the start of each source file to most effectively state the The hypothetical commands ‘show w’ and ‘show c’ should show the in detail to address new problems or concerns. VICING, REPAIR OR CORRECTION. 16. Limitation of Liability. exclusion of warranty; and each file should have at least the “copyright” appropriate parts of the General Public License. Of course, your pro- line and a pointer to where the full notice is found. gram’s commands might be different; for a GUI interface, you would use an “about box”. Each version is given a distinguishing version number. If the Program IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR specifies that a certain numbered version of the GNU General Pub- AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, lic License “or any later version” applies to it, you have the option of Copyright (C) You should also get your employer (if you work as a programmer) or following the terms and conditions either of that numbered version or OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS school, if any, to sign a “copyright disclaimer” for the program, if nec- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU of any later version published by the Free Software Foundation. If This program is free software: you can redistribute it and/or modify essary. For more information on this, and how to apply and follow the the Program does not specify a version number of the GNU General FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCI- GNU GPL, see . DENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF it under the terms of the GNU General Public License as published by Public License, you may choose any version ever published by the Free the Free Software Foundation, either version 3 of the License, or (at Software Foundation. THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING REN- your option) any later version. The GNU General Public License does not permit incorporating your DERED INACCURATE OR LOSSES SUSTAINED BY YOU OR program into proprietary programs. If your program is a subroutine If the Program specifies that a proxy can decide which future versions THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPER- This program is distributed in the hope that it will be useful, but library, you may consider it more useful to permit linking proprietary of the GNU General Public License can be used, that proxy’s public ATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER WITHOUT ANY WARRANTY; without even the implied warranty applications with the library. If this is what you want to do, use the statement of acceptance of a version permanently authorizes you to OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- GNU Lesser General Public License instead of this License. But first, choose that version for the Program. OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. POSE. See the GNU General Public License for more details. please read .

11.2 GNU Free Documentation License

Version 1.3, 3 November 2008 following text that translates XYZ in another language. (Here XYZ in their titles. Section numbers or the equivalent are not considered (section 1) will typically require changing the actual title. 9. TERMI- stands for a specific section name mentioned below, such as ”Acknowl- part of the section titles. * M. Delete any section Entitled ”Endorse- NATION Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, edgements”, ”Dedications”, ”Endorsements”, or ”History”.) To ”Preserve ments”. Such a section may not be included in the Modified Version. Inc. the Title” of such a section when you modify the Document means that * N. Do not retitle any existing section to be Entitled ”Endorsements” You may not copy, modify, sublicense, or distribute the Document it remains a section ”Entitled XYZ” according to this definition. or to conflict in title with any Invariant Section. * O. Preserve any except as expressly provided under this License. Any attempt oth- Warranty Disclaimers. Everyone is permitted to copy and distribute verbatim copies of this erwise to copy, modify, sublicense, or distribute it is void, and will license document, but changing it is not allowed. 0. PREAMBLE The Document may include Warranty Disclaimers next to the notice automatically terminate your rights under this License. which states that this License applies to the Document. These War- If the Modified Version includes new front-matter sections or appen- ranty Disclaimers are considered to be included by reference in this dices that qualify as Secondary Sections and contain no material copied The purpose of this License is to make a manual, textbook, or other However, if you cease all violation of this License, then your license License, but only as regards disclaiming warranties: any other impli- from the Document, you may at your option designate some or all of functional and useful document ”free” in the sense of freedom: to as- from a particular copyright holder is reinstated (a) provisionally, un- cation that these Warranty Disclaimers may have is void and has no these sections as invariant. To do this, add their titles to the list of sure everyone the effective freedom to copy and redistribute it, with or less and until the copyright holder explicitly and finally terminates effect on the meaning of this License. 2. VERBATIM COPYING Invariant Sections in the Modified Version’s license notice. These titles without modifying it, either commercially or noncommercially. Sec- your license, and (b) permanently, if the copyright holder fails to no- must be distinct from any other section titles. ondarily, this License preserves for the author and publisher a way to tify you of the violation by some reasonable means prior to 60 days get credit for their work, while not being considered responsible for You may copy and distribute the Document in any medium, either after the cessation. modifications made by others. commercially or noncommercially, provided that this License, the You may add a section Entitled ”Endorsements”, provided it con- copyright notices, and the license notice saying this License applies tains nothing but endorsements of your Modified Version by various Moreover, your license from a particular copyright holder is reinstated to the Document are reproduced in all copies, and that you add no parties—for example, statements of peer review or that the text has This License is a kind of ”copyleft”, which means that derivative works permanently if the copyright holder notifies you of the violation by other conditions whatsoever to those of this License. You may not use been approved by an organization as the authoritative definition of a of the document must themselves be free in the same sense. It com- some reasonable means, this is the first time you have received notice technical measures to obstruct or control the reading or further copy- standard. plements the GNU General Public License, which is a copyleft license of violation of this License (for any work) from that copyright holder, ing of the copies you make or distribute. However, you may accept and you cure the violation prior to 30 days after your receipt of the designed for free software. compensation in exchange for copies. If you distribute a large enough You may add a passage of up to five words as a Front-Cover Text, notice. number of copies you must also follow the conditions in section 3. and a passage of up to 25 words as a Back-Cover Text, to the end We have designed this License in order to use it for manuals for free of the list of Cover Texts in the Modified Version. Only one passage software, because free software needs free documentation: a free pro- Termination of your rights under this section does not terminate the You may also lend copies, under the same conditions stated above, and of Front-Cover Text and one of Back-Cover Text may be added by gram should come with manuals providing the same freedoms that the licenses of parties who have received copies or rights from you under you may publicly display copies. 3. COPYING IN QUANTITY (or through arrangements made by) any one entity. If the Document software does. But this License is not limited to software manuals; this License. If your rights have been terminated and not permanently already includes a cover text for the same cover, previously added by it can be used for any textual work, regardless of subject matter or reinstated, receipt of a copy of some or all of the same material does you or by arrangement made by the same entity you are acting on whether it is published as a printed book. We recommend this Li- If you publish printed copies (or copies in media that commonly have not give you any rights to use it. 10. FUTURE REVISIONS OF THIS behalf of, you may not add another; but you may replace the old one, cense principally for works whose purpose is instruction or reference. printed covers) of the Document, numbering more than 100, and the LICENSE on explicit permission from the previous publisher that added the old 1. APPLICABILITY AND DEFINITIONS Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: one. The Free Software Foundation may publish new, revised versions Front-Cover Texts on the front cover, and Back-Cover Texts on the of the GNU Free Documentation License from time to time. Such This License applies to any manual or other work, in any medium, back cover. Both covers must also clearly and legibly identify you as The author(s) and publisher(s) of the Document do not by this Li- new versions will be similar in spirit to the present version, but that contains a notice placed by the copyright holder saying it can the publisher of these copies. The front cover must present the full title cense give permission to use their names for publicity for or to as- may differ in detail to address new problems or concerns. See be distributed under the terms of this License. Such a notice grants a with all words of the title equally prominent and visible. You may add world-wide, royalty-free license, unlimited in duration, to use that work sert or imply endorsement of any Modified Version. 5. COMBINING http://www.gnu.org/copyleft/. other material on the covers in addition. Copying with changes limited DOCUMENTS under the conditions stated herein. The ”Document”, below, refers to to the covers, as long as they preserve the title of the Document and any such manual or work. Any member of the public is a licensee, and satisfy these conditions, can be treated as verbatim copying in other Each version of the License is given a distinguishing version number. is addressed as ”you”. You accept the license if you copy, modify or respects. You may combine the Document with other documents released under If the Document specifies that a particular numbered version of this distribute the work in a way requiring permission under copyright law. this License, under the terms defined in section 4 above for modified License ”or any later version” applies to it, you have the option of versions, provided that you include in the combination all of the In- following the terms and conditions either of that specified version or If the required texts for either cover are too voluminous to fit legibly, variant Sections of all of the original documents, unmodified, and list of any later version that has been published (not as a draft) by the A ”Modified Version” of the Document means any work containing the you should put the first ones listed (as many as fit reasonably) on the them all as Invariant Sections of your combined work in its license Free Software Foundation. If the Document does not specify a version Document or a portion of it, either copied verbatim, or with modifica- actual cover, and continue the rest onto adjacent pages. tions and/or translated into another language. notice, and that you preserve all their Warranty Disclaimers. number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document If you publish or distribute Opaque copies of the Document numbering The combined work need only contain one copy of this License, and specifies that a proxy can decide which future versions of this License A ”Secondary Section” is a named appendix or a front-matter sec- more than 100, you must either include a machine-readable Transpar- multiple identical Invariant Sections may be replaced with a single can be used, that proxy’s public statement of acceptance of a version tion of the Document that deals exclusively with the relationship of ent copy along with each Opaque copy, or state in or with each Opaque copy. If there are multiple Invariant Sections with the same name permanently authorizes you to choose that version for the Document. the publishers or authors of the Document to the Document’s overall copy a computer-network location from which the general network- but different contents, make the title of each such section unique by 11. RELICENSING subject (or to related matters) and contains nothing that could fall using public has access to download using public-standard network adding at the end of it, in parentheses, the name of the original au- directly within that overall subject. (Thus, if the Document is in part protocols a complete Transparent copy of the Document, free of added thor or publisher of that section if known, or else a unique number. a textbook of mathematics, a Secondary Section may not explain any material. If you use the latter option, you must take reasonably pru- ”Massive Multiauthor Collaboration Site” (or ”MMC Site”) means any Make the same adjustment to the section titles in the list of Invariant mathematics.) The relationship could be a matter of historical connec- dent steps, when you begin distribution of Opaque copies in quantity, World Wide Web server that publishes copyrightable works and also Sections in the license notice of the combined work. tion with the subject or with related matters, or of legal, commercial, to ensure that this Transparent copy will remain thus accessible at the provides prominent facilities for anybody to edit those works. A public philosophical, ethical or political position regarding them. stated location until at least one year after the last time you distribute wiki that anybody can edit is an example of such a server. A ”Massive an Opaque copy (directly or through your agents or retailers) of that In the combination, you must combine any sections Entitled ”History” Multiauthor Collaboration” (or ”MMC”) contained in the site means any set of copyrightable works thus published on the MMC site. The ”Invariant Sections” are certain Secondary Sections whose titles edition to the public. in the various original documents, forming one section Entitled ”His- are designated, as being those of Invariant Sections, in the notice that tory”; likewise combine any sections Entitled ”Acknowledgements”, and any sections Entitled ”Dedications”. You must delete all sections En- says that the Document is released under this License. If a section does It is requested, but not required, that you contact the authors of the ”CC-BY-SA” means the Creative Commons Attribution-Share Alike titled ”Endorsements”. 6. COLLECTIONS OF DOCUMENTS not fit the above definition of Secondary then it is not allowed to be Document well before redistributing any large number of copies, to 3.0 license published by Creative Commons Corporation, a not-for- designated as Invariant. The Document may contain zero Invariant give them a chance to provide you with an updated version of the profit corporation with a principal place of business in San Francisco, Sections. If the Document does not identify any Invariant Sections Document. 4. MODIFICATIONS You may make a collection consisting of the Document and other doc- California, as well as future copyleft versions of that license published then there are none. uments released under this License, and replace the individual copies by that same organization. of this License in the various documents with a single copy that is You may copy and distribute a Modified Version of the Document un- included in the collection, provided that you follow the rules of this The ”Cover Texts” are certain short passages of text that are listed, as der the conditions of sections 2 and 3 above, provided that you release ”Incorporate” means to publish or republish a Document, in whole or License for verbatim copying of each of the documents in all other Front-Cover Texts or Back-Cover Texts, in the notice that says that the Modified Version under precisely this License, with the Modified in part, as part of another Document. respects. the Document is released under this License. A Front-Cover Text may Version filling the role of the Document, thus licensing distribution be at most 5 words, and a Back-Cover Text may be at most 25 words. and modification of the Modified Version to whoever possesses a copy An MMC is ”eligible for relicensing” if it is licensed under this License, of it. In addition, you must do these things in the Modified Version: You may extract a single document from such a collection, and dis- and if all works that were first published under this License somewhere A ”Transparent” copy of the Document means a machine-readable tribute it individually under this License, provided you insert a copy other than this MMC, and subsequently incorporated in whole or in copy, represented in a format whose specification is available to the * A. Use in the Title Page (and on the covers, if any) a title dis- of this License into the extracted document, and follow this License part into the MMC, (1) had no cover texts or invariant sections, and general public, that is suitable for revising the document straightfor- tinct from that of the Document, and from those of previous versions in all other respects regarding verbatim copying of that document. 7. (2) were thus incorporated prior to November 1, 2008. wardly with generic text editors or (for images composed of pixels) (which should, if there were any, be listed in the History section of AGGREGATION WITH INDEPENDENT WORKS generic paint programs or (for drawings) some widely available drawing the Document). You may use the same title as a previous version if The operator of an MMC Site may republish an MMC contained in editor, and that is suitable for input to text formatters or for automatic the original publisher of that version gives permission. * B. List on A compilation of the Document or its derivatives with other separate the site under CC-BY-SA on the same site at any time before August translation to a variety of formats suitable for input to text formatters. the Title Page, as authors, one or more persons or entities responsible and independent documents or works, in or on a volume of a storage or 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: A copy made in an otherwise Transparent file format whose markup, for authorship of the modifications in the Modified Version, together distribution medium, is called an ”aggregate” if the copyright resulting How to use this License for your documents or absence of markup, has been arranged to thwart or discourage sub- with at least five of the principal authors of the Document (all of its from the compilation is not used to limit the legal rights of the com- sequent modification by readers is not Transparent. An image format pilation’s users beyond what the individual works permit. When the principal authors, if it has fewer than five), unless they release you To use this License in a document you have written, include a copy is not Transparent if used for any substantial amount of text. A copy Document is included in an aggregate, this License does not apply to from this requirement. * C. State on the Title page the name of the of the License in the document and put the following copyright and that is not ”Transparent” is called ”Opaque”. the other works in the aggregate which are not themselves derivative publisher of the Modified Version, as the publisher. * D. Preserve license notices just after the title page: all the copyright notices of the Document. * E. Add an appropriate works of the Document. Examples of suitable formats for Transparent copies include plain copyright notice for your modifications adjacent to the other copyright ASCII without markup, Texinfo input format, LaTeX input for- notices. * F. Include, immediately after the copyright notices, a license Copyright (C) YEAR YOUR NAME. Permission is granted to copy, If the Cover Text requirement of section 3 is applicable to these copies distribute and/or modify this document under the terms of the GNU mat, SGML or XML using a publicly available DTD, and standard- notice giving the public permission to use the Modified Version under of the Document, then if the Document is less than one half of the conforming simple HTML, PostScript or PDF designed for human the terms of this License, in the form shown in the Addendum below. Free Documentation License, Version 1.3 or any later version pub- entire aggregate, the Document’s Cover Texts may be placed on cov- lished by the Free Software Foundation; with no Invariant Sections, modification. Examples of transparent image formats include PNG, * G. Preserve in that license notice the full lists of Invariant Sections ers that bracket the Document within the aggregate, or the electronic XCF and JPG. Opaque formats include proprietary formats that can and required Cover Texts given in the Document’s license notice. * no Front-Cover Texts, and no Back-Cover Texts. A copy of the license equivalent of covers if the Document is in electronic form. Otherwise is included in the section entitled ”GNU Free Documentation License”. be read and edited only by proprietary word processors, SGML or H. Include an unaltered copy of this License. * I. Preserve the section they must appear on printed covers that bracket the whole aggregate. XML for which the DTD and/or processing tools are not generally Entitled ”History”, Preserve its Title, and add to it an item stating at 8. TRANSLATION available, and the machine-generated HTML, PostScript or PDF pro- least the title, year, new authors, and publisher of the Modified Ver- If you have Invariant Sections, Front-Cover Texts and Back-Cover duced by some word processors for output purposes only. sion as given on the Title Page. If there is no section Entitled ”History” Texts, replace the ”with … Texts.” line with this: in the Document, create one stating the title, year, authors, and pub- Translation is considered a kind of modification, so you may distribute lisher of the Document as given on its Title Page, then add an item translations of the Document under the terms of section 4. Replacing The ”Title Page” means, for a printed book, the title page itself, plus Invariant Sections with translations requires special permission from with the Invariant Sections being LIST THEIR TITLES, with the such following pages as are needed to hold, legibly, the material this describing the Modified Version as stated in the previous sentence. * Front-Cover Texts being LIST, and with the Back-Cover Texts being J. Preserve the network location, if any, given in the Document for their copyright holders, but you may include translations of some or all License requires to appear in the title page. For works in formats Invariant Sections in addition to the original versions of these Invari- LIST. which do not have any title page as such, ”Title Page” means the text public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was ant Sections. You may include a translation of this License, and all the near the most prominent appearance of the work’s title, preceding the license notices in the Document, and any Warranty Disclaimers, pro- If you have Invariant Sections without Cover Texts, or some other beginning of the body of the text. based on. These may be placed in the ”History” section. You may omit a network location for a work that was published at least four years vided that you also include the original English version of this License combination of the three, merge those two alternatives to suit the sit- before the Document itself, or if the original publisher of the version it and the original versions of those notices and disclaimers. In case of a uation. The ”publisher” means any person or entity that distributes copies of refers to gives permission. * K. For any section Entitled ”Acknowledge- disagreement between the translation and the original version of this the Document to the public. ments” or ”Dedications”, Preserve the Title of the section, and preserve License or a notice or disclaimer, the original version will prevail. If your document contains nontrivial examples of program code, we in the section all the substance and tone of each of the contributor ac- recommend releasing these examples in parallel under your choice of A section ”Entitled XYZ” means a named subunit of the Document knowledgements and/or dedications given therein. * L. Preserve all If a section in the Document is Entitled ”Acknowledgements”, ”Dedi- free software license, such as the GNU General Public License, to per- whose title either is precisely XYZ or contains XYZ in parentheses the Invariant Sections of the Document, unaltered in their text and cations”, or ”History”, the requirement (section 4) to Preserve its Title mit their use in free software.

68 GNU Lesser General Public License

11.3 GNU Lesser General Public License

GNU LESSER GENERAL PUBLIC LICENSE The “Corresponding Application Code” for a Combined Work means You may convey a Combined Work under terms of your choice that, You may place library facilities that are a work based on the Library the object code and/or source code for the Application, including any taken together, effectively do not restrict modification of the portions side by side in a single library together with other library facilities that Version 3, 29 June 2007 data and utility programs needed for reproducing the Combined Work of the Library contained in the Combined Work and reverse engineer- are not Applications and are not covered by this License, and convey from the Application, but excluding the System Libraries of the Com- ing for debugging such modifications, if you also do each of the follow- such a combined library under terms of your choice, if you do both of bined Work. 1. Exception to Section 3 of the GNU GPL. ing: the following: Copyright © 2007 Free Software Foundation, Inc. You may convey a covered work under sections 3 and 4 of this License Everyone is permitted to copy and distribute verbatim copies of this * a) Give prominent notice with each copy of the Combined Work * a) Accompany the combined library with a copy of the same work without being bound by section 3 of the GNU GPL. 2. Conveying based on the Library, uncombined with any other library facilities, license document, but changing it is not allowed. Modified Versions. that the Library is used in it and that the Library and its use are covered by this License. * b) Accompany the Combined Work with a conveyed under the terms of this License. * b) Give prominent no- tice with the combined library that part of it is a work based on the This version of the GNU Lesser General Public License incorporates copy of the GNU GPL and this license document. * c) For a Com- If you modify a copy of the Library, and, in your modifications, a fa- bined Work that displays copyright notices during execution, include Library, and explaining where to find the accompanying uncombined the terms and conditions of version 3 of the GNU General Public Li- cility refers to a function or data to be supplied by an Application that form of the same work. cense, supplemented by the additional permissions listed below. 0. the copyright notice for the Library among these notices, as well as a uses the facility (other than as an argument passed when the facility reference directing the user to the copies of the GNU GPL and this Additional Definitions. is invoked), then you may convey a copy of the modified version: license document. * d) Do one of the following: o 0) Convey the 6. Revised Versions of the GNU Lesser General Public License. Minimal Corresponding Source under the terms of this License, and As used herein, “this License” refers to version 3 of the GNU Lesser * a) under this License, provided that you make a good faith effort to the Corresponding Application Code in a form suitable for, and under General Public License, and the “GNU GPL” refers to version 3 of the ensure that, in the event an Application does not supply the function terms that permit, the user to recombine or relink the Application The Free Software Foundation may publish revised and/or new ver- GNU General Public License. or data, the facility still operates, and performs whatever part of its with a modified version of the Linked Version to produce a modified sions of the GNU Lesser General Public License from time to time. purpose remains meaningful, or * b) under the GNU GPL, with none Combined Work, in the manner specified by section 6 of the GNU Such new versions will be similar in spirit to the present version, but “The Library” refers to a covered work governed by this License, other of the additional permissions of this License applicable to that copy. GPL for conveying Corresponding Source. o 1) Use a suitable shared may differ in detail to address new problems or concerns. than an Application or a Combined Work as defined below. library mechanism for linking with the Library. A suitable mechanism 3. Object Code Incorporating Material from Library Header Files. is one that (a) uses at run time a copy of the Library already present Each version is given a distinguishing version number. If the Library An “Application” is any work that makes use of an interface provided on the user’s computer system, and (b) will operate properly with a as you received it specifies that a certain numbered version of the GNU by the Library, but which is not otherwise based on the Library. Defin- The object code form of an Application may incorporate material from modified version of the Library that is interface-compatible with the Lesser General Public License “or any later version” applies to it, you ing a subclass of a class defined by the Library is deemed a mode of a header file that is part of the Library. You may convey such object Linked Version. * e) Provide Installation Information, but only if you have the option of following the terms and conditions either of that using an interface provided by the Library. code under terms of your choice, provided that, if the incorporated ma- would otherwise be required to provide such information under section published version or of any later version published by the Free Software terial is not limited to numerical parameters, data structure layouts 6 of the GNU GPL, and only to the extent that such information is Foundation. If the Library as you received it does not specify a version and accessors, or small macros, inline functions and templates (ten or necessary to install and execute a modified version of the Combined number of the GNU Lesser General Public License, you may choose A “Combined Work” is a work produced by combining or linking an Work produced by recombining or relinking the Application with a Application with the Library. The particular version of the Library fewer lines in length), you do both of the following: any version of the GNU Lesser General Public License ever published modified version of the Linked Version. (If you use option 4d0, the by the Free Software Foundation. with which the Combined Work was made is also called the “Linked Installation Information must accompany the Minimal Corresponding Version”. * a) Give prominent notice with each copy of the object code that the Source and Corresponding Application Code. If you use option 4d1, Library is used in it and that the Library and its use are covered by you must provide the Installation Information in the manner specified If the Library as you received it specifies that a proxy can decide The “Minimal Corresponding Source” for a Combined Work means the this License. * b) Accompany the object code with a copy of the GNU by section 6 of the GNU GPL for conveying Corresponding Source.) whether future versions of the GNU Lesser General Public License Corresponding Source for the Combined Work, excluding any source GPL and this license document. shall apply, that proxy’s public statement of acceptance of any ver- code for portions of the Combined Work that, considered in isolation, sion is permanent authorization for you to choose that version for the are based on the Application, and not on the Linked Version. 4. Combined Works. 5. Combined Libraries. Library.

69