System Information
Linux bubastis 3.10.25-gentoo #10 SMP Thu Jan 30 22:17:35 UTC 2014 x86_64 Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz GenuineIntel GNU/Linux
01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M] (rev a1) (prog-if 00 [VGA controller])
Blender Version
Broken: git bc9e66f0830627e807f720dca4b9d5d8d39e732a
and probably 2.70
Short description of error
The blender UI allows the user to change which material is in the material_slot of a linked mesh and these alterations affect any renders done during the session, however the alterations are NOT saved and will not take effect for any command-line renders.
To reproduce, link (not append) a mesh object from another .blend file. Make a local copy of the object, but leave the mesh as a link to the external file. You can change the material in the material_slots and see the effects in the UI and rendered images and animations. However, if you save the file and open it again, the changes have been lost since the material_slots are pulled from the linked mesh.
I feel the bug is that the UI does not prevent the user from altering the materials in the material_slots of the mesh.
A workaround for this "problem" is to use the per-object material_slots instead of the per-mesh material slots. Fixing the UI will take a little bit of ingenuity since the material combo box will have to be read-only for per-mesh slots and read/write for per-object slots. (although the per-object slots will have to be read-only if the object is still linked to an external file, eh)
See T40393 for some .blend files I was working with that helped me discover and characterize this shortcoming.