Mailinglist Archive: opensuse-buildservice (148 mails)

< Previous Next >
Re: [opensuse-buildservice] [PATCH] build: Do not leave filedescriptors open
  • From: Marcus Hüwe <suse-tux@xxxxxx>
  • Date: Sun, 2 Jan 2011 23:37:32 +0100
  • Message-id: <20110102223732.GB5322@linux>
On 2010-12-31 16:39:18 +0100, Michal Marek wrote:
There is no need for the whole build process to have the _buildinfo* and
_buildconfig* files open.

Hmm with this patch it might be possible that the temporary file isn't
unlinked (because you call NamedTemporaryFile with "delete=False").
For instance if an exception is raised before the
"if buildfiles_temporary..." check is reached the tempfiles won't be
unlinked (with "delete=True" the file will be removed whenever the
_TemporaryFileWrapper instance is "deleted").
I need to think about it again (because I want to avoid a big
try-finally block)...

Signed-off-by: Michal Marek <mmarek@xxxxxxx>


@@ -882,10 +884,9 @@ def main(apiurl, opts, argv):
for i in b_built.splitlines() + s_built.splitlines():
shutil.copy2(i, os.path.join(opts.keep_pkgs,

- if bi_file:
- bi_file.close()
- if bc_file:
- bc_file.close()
- rpmlist_file.close()
+ if buildfiles_temporary:
+ os.unlink(bi_filename)
+ os.unlink(bc_filename)
+ os.unlink(rpmlist_filename)

To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups