Recipe 18.16. Storing Binary Files in CVS

 < Day Day Up > 

18.16.1 Problem

CVS is great with plain ASCII text files, but you are running into problems with binary files, like binary executables, MS Word files, image files, and such. How can you store binary files in the CVS repository without CVS doing strange things to them and making them not work?

18.16.2 Solution

Use the -kb flags with the add command, like this:

$ cvs update  binaryfile $ cvs add -kb binaryfile $ cvs commit -m 'C proggie for timing tea' binaryfile

You should also check out binary files with the -kb flags. If you are working with binary files a lot, you can make this the default in your ~/.cvsrc.

18.16.3 Discussion

Making -kb the default means you will have to use cvs add -kkv when adding non-binary files. If you forget to use the -kkv flags when adding a non-binary file, run the following command:

$ cvs admin -kkv textfile

to modify the file for future commits and updates.

CVS makes a number of changes to text files that do no good to binary files:

  • It changes linefeeds to carriage return/linefeeds, for cross-platform compatibility.

  • It performs keyword expansion, so that any string in a binary file that looks like a CVS keyword will be changed. Embedded strings in the form $keyword$ and $keyword:...$ are replaced with their actual values whenever you fetch a new revision of the file. This is definitely not something you want to happen to a binary file.

18.16.4 See Also

  • Chapter 3 of Essential CVS

  • Local documentation "Keyword Substitution" (/usr/share/doc/cvs/html-info/cvs_12.html)

  • Recipe 18.19

     < Day Day Up > 


    Linux Cookbook
    Linux Cookbook
    ISBN: 0596006403
    EAN: 2147483647
    Year: 2004
    Pages: 434

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net