Comment 41 for bug 509180

Erik Carstensen (sandberg) wrote :

One painful workaround is to not touch the file and remount the ecryptfs partition (which usually means that you have to log out and re-login).

Another workaround is to use a script that I just wrote, which automatically tries to drop the trailing garbage (kind of like the link you posted, but automated)

The link you posted didn't observe these things:
- In some cases the trailing garbage can contain non-zeros; if the original object size was s this is typically seen in the intervals [4096, 4096 + s) and [8192, 8192+s).
- For non-blobs, there is a small probability (1/256) that the original object ends with a 0 byte.

My script will therefore try all 12288 possibile lengths, but in a smart order so the above cases are tried early.

To use it, go to the working tree's root directory and run the script, with the sha1 sum as only argument.