pbuilder-dist subject to race conditions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-dev-tools (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: ubuntu-dev-tools
In the Python code of pbuilder-dist, a number of calls are of the "look before you leap" form (rather than the pythonic "Easier to ask forgiveness" idiom) which can lead to race conditions. An example "bad call" is on line 93:
if not os.path.
os.
Should be more like this:
try:
os.
except os.error, e:
if e.errno != errno.EEXIST:
raise
In a quick skim, I see at least these line numbers in Jaunty:
78 possibly (better to just do run a "which " + builder command, like getoutput('which ' + self.builder) and parse it, IMHO)
93 (example above)
104 (open inside of a try-catch and catch only the error meaning file not found/inaccessible)
204
A reference on EAFP vs LBYL is here:
http://
Changed in ubuntu-dev-tools (Ubuntu): | |
status: | New → Won't Fix |
The exception is slower and less readable, and the risk of a race condition here is pretty much negligible.