Ask Your Question
2

How to install patches? (Or should we?)

asked 2012-03-29 05:27:33 -0500

jdc gravatar image

updated 2015-01-14 05:15:29 -0500

FrédéricC gravatar image

Hi -

Hopefully this question is basic, but I haven't been able to find a clear answer online. (For the record, I am using the Sage notebook with the app version of Sage on a Mac.)

I consider myself a lowly and ignorant end user of Sage -- maybe one day I'll know enough to be able to contribute to development, but that day is not near. How do I (or should I, even) download and install patches, fixes and updates to Sage, short of doing a whole new installation from scratch?

More specifically: Suppose I encounter some bug or shortcoming with Sage, and I discover that there is already a ticket for that problem on the Sage developer trac. Suppose that that ticket is categorized as "fixed," and I see a link to some file (usually ending with .spkg, .patch, or .diff) near the top of the page. Is that file something that I, the lowly end user, am meant to download and install, hopefully fixing my problem? Or are those files on sage_trac really just meant for development work, and the fix will only trickle down to the end users once those fixes are incorporated into a future version of Sage?

If am I meant to be installing these patches myself, how exactly is that done? That is, where do I put the files, and what do I type where?

I feel like an idiot phrasing it in such basic terms. And I'm sure that the answers to my questions are already floating out there somewhere, but I haven't been able to find them. For example, the help stuff I've found out there for sage_trac is all about how to post or contribute to a trac ticket, rather than how to take advantage of the fixes found for that ticket.

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
4

answered 2012-03-29 05:39:21 -0500

Volker Braun gravatar image

The developer manual has a walk through of the patch applying process. Essentially you can just use the Sage command

hg_sage.apply("http://trac.sagemath.org/sage_trac/raw-attachment/ticket/11329/f2c-20070816.p2-p3.diff")

but really you want to create a clone of the repository first if you want to get rid of the patch later.

edit flag offensive delete link more

Comments

Or you can look further in the developer guide for other ways of doing it... by the way, if you only want to apply and get rid of one patch, then `hg_sage.rollback()` will get rid of the patch. You will also need to do `sage -b` each time to make the changes actually happen.

kcrisman gravatar imagekcrisman ( 2012-03-29 05:58:58 -0500 )edit

Okay, that's helpful. It's interesting that the method for downloading patches is buried in the development manual, in a discussion of how to *review* patches, instead of in the main Sage tutorial or FAQ. Also, do I just want to be doing this with .patch files, or are spkg's also a type of patch?

jdc gravatar imagejdc ( 2012-03-29 06:09:02 -0500 )edit

If a patch fixes a problem, what would be my motivation for wanting to get rid of it later? Is that just in case the patch turns out not to work, or gets improved later?

jdc gravatar imagejdc ( 2012-03-29 06:10:19 -0500 )edit
2

answered 2012-03-29 07:51:30 -0500

niles gravatar image

updated 2012-03-29 07:55:06 -0500

When you're looking at a ticket page, you could also check to see if the patch is marked as "merged" in some in-progress new version of Sage. Once a ticket is marked as "fixed", this tends to happen pretty fast and you can just install the new version (even if it's a development version).

As to why you would want to unapply a patch, this is useful if you're using multiple patches at once, which possibly conflict with eachother (i.e. one can't be applied after the other). Or if you depend on your Sage install for something critical which you don't want to inadvertently bring bugs into, but you also want to use Sage for some other non-critical task where you don't care about unreviewed patches. So maybe none of these matter to you, but you might want to keep the possibility in the back of your mind.

Spkg's are something different from patches, and instructions for installing them are given in answer to a different Ask Sage question.

And it bears mentioning that many of the nice folks here are the same people having opaque discussions on Trac! It's just a matter of context :)

Lastly, you're right that it would be more intuitive and useful to have the instructions for applying a patch separated in the manual from the instructions for reviewing a patch. In fact, you can make this happen! To do it, just read the other sections on contributing to Sage, open a ticket and submit your patch. Feel free to add me ("niles" on Trac) to the Cc field of the ticket if you'd like me to take a look at it with you. The same probably goes for @Volker Braun and @kcrisman, so don't be shy about adding them too.

edit flag offensive delete link more

Comments

1

Thanks, Niles. I think I'd better see if I actually am capable of applying a patch before I write instructions telling other people how to do it. But you guys probably will con me into contributing something sooner or later. :)

jdc gravatar imagejdc ( 2012-03-29 08:34:17 -0500 )edit

Ha! good idea :)

niles gravatar imageniles ( 2012-03-29 08:54:16 -0500 )edit

I just want to affirm what Niles says about context. On a ticket, it's definitely assumed you know what you are talking about, and if not, someone will hopefully point you to the documentation. Here, the point is to have resources that help out.

kcrisman gravatar imagekcrisman ( 2012-03-29 17:46:57 -0500 )edit
1

answered 2012-03-29 05:57:54 -0500

kcrisman gravatar image

The answer to your meta-question about "should you" is an unqualified yes! Otherwise I would have never become a developer, and probably many others. Even if you just apply it to see whether it still applies to the latest Sage and report back, you've done a valuable service for the Sage community. No "lowly end users" here.

There is a learning curve, it's true, but luckily a well-documented one. Volker is spot on.

edit flag offensive delete link more

Comments

The learning curve feels more like a vertical ascent sometimes. I've tried to read tickets at sage_trac a few times, but the discussion is opaque to me. Even the documentation seems to assume a level of familiarity and expertise that I don't have. But thank heaven for the nice folks at ASKSAGE.

jdc gravatar imagejdc ( 2012-03-29 06:17:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-03-29 05:27:33 -0500

Seen: 1,069 times

Last updated: Mar 29 '12