Bitten by python
Feb. 20th, 2007 05:49 pmI've finally uncovered the source of the bug that caused my backup script to go horribly wrong. Essentially, it comes down to how the python
os.path.join() behaves when given a pair of absolute paths. When the second path element is unqualified, the join function works as expected:
>>> os.path.join("/tmp", "foo")
'/tmp/foo'
>>>
But when the second path element is fully qualified, the join function returns the second path:
>>> os.path.join("/tmp", "/foo")
'/foo'
>>>
I think that explains why my backup script chose to dump all over the root file system instead of putting all the files into a nice little archive directory. Oops.