Hi, We have a few different places in the code where we generate or modify tar headers or just read data out of them. The code in question uses one of my less-favorite programming things: magic numbers. The offsets of the various fields within the tar header are just hard-coded in each relevant place in our code. I think we should clean that up, as in the attached patch.
I hasten to emphasize that, while I think this is an improvement, I don't think the result is particularly awesome. Even with the patch, src/port/tar.c and src/include/pgtar.h do a poor job insulating callers from the details of the tar format. However, it's also not very clear to me how to fix that. For instance, I thought about writing a function that parses a tar header into a struct and then using it in all of these places, but that seems like it would lose too much efficiency relative to the current ad-hoc coding. So for now I don't have a better idea than this. -- Robert Haas EDB: http://www.enterprisedb.com
v1-0001-Add-and-use-symbolic-constants-for-tar-header-off.patch
Description: Binary data