I took part in a meeting about sustainable scientific software at last month's SciPy conference. Much of it was taken up with discussion of getting scientists recognition for building software, but there was also some interesting debate about what "sustainability" actually means. After talking to a few people in the software engineering research community, I'd like to propose that:
A piece of software is being sustained if people are using it, fixing it, and improving it rather than replacing it.
This definition highlights the fact that sustainability isn't just a property of the software: it's also a property of the culture of its actual and potential users. It doesn't matter whether a library has automated tests and is properly packaged if its users don't understand those things or suffer from Not Invented Here syndrome. Conversely, if "share, mend, and extend" is woven into the fabric of the users' culture, even Fortran-77 can thrive, though of course good tooling and packaging can lower costs (and barriers to entry).
In light of this, we can say that the goal of Software Carpentry is to give people the skills and perspective needed to be enlightened members of sustaining communities. If I'm able to attend the next WSSSPE workshop, I'll try to say this all more coherently than I did in Austin.
For more on this point of view, please see the work of Jim Herbsleb and colleagues.