Edgewall Software
Modify

Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#229 closed defect (fixed)

slave.py checks incorrect option when removing temp directory

Reported by: cwiddofer Owned by: osimons
Priority: trivial Milestone: 0.6
Component: General Version: dev
Keywords: keep_files, rmtree, work_dir Cc:
Operating System: Windows

Description

Starting at line 381 of slave.py:

if not options.work_dir:
        log.debug('Removing temporary directory %s' % slave.work_dir)
        shutil.rmtree(slave.work_dir)

This is for removing the files after the build, correct? So it should be checking whether options.keep_files is set rather than options.work_dir:

if not options.keep_files:
        log.debug('Removing temporary directory %s' % slave.work_dir)
        shutil.rmtree(slave.work_dir)

Attachments (0)

Change History (7)

comment:1 Changed 15 years ago by osimons

  • Owner changed from cmlenz to osimons

Confirmed. I'll fix.

comment:2 Changed 15 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

Committed in [644]. Thanks!

comment:3 follow-up: Changed 15 years ago by Olaf Meeuwissen <olaf@…>

Sure you want to remove the work_dir and not merely the build_dir which gets created below the work_dir? This may be an issue when you specified the same --work-dir value for parallel bitten-slave processes.

comment:4 in reply to: ↑ 3 Changed 15 years ago by osimons

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to Olaf Meeuwissen <olaf@…>:

Sure you want to remove the work_dir and not merely the build_dir which gets created below the work_dir?

Not as sure now as I was when I committed it... I suppose many use fixed work_dir to store things like pre-build checkouts and other dependencies - or even data. Deleting that is not so good.

I suppose the order of checking and action really should be:

if not options.keep_files:
        log.debug('Removing build directory %s' % slave.build_dir)
        shutil.rmtree(slave.build_dir)
if not (options.work_dir or options.keep_files):
        log.debug('Removing working directory %s' % slave.work_dir)
        shutil.rmtree(slave.work_dir)

Does that seem more suitable?

comment:5 Changed 15 years ago by osimons

No, that is not quite right either. The build files are already ckecked against keep_files elsewhere in slave.py, so I would propose just make the lines in question look like:

if not (options.work_dir or options.keep_files):
        log.debug('Removing working directory %s' % slave.work_dir)
        _rmtree(slave.work_dir)

That should account for keeping files either if a custom working directory is used, or if specifically requested to keep files.

(Also noticed that this code uses shutil.rmtree() and not the Bitten (custom _rmtree()` - should use the same.)

comment:6 follow-up: Changed 15 years ago by osimons

  • Resolution set to fixed
  • Status changed from reopened to closed

Last attempt committed in [650]. Hope this works as expected for all now.

comment:7 in reply to: ↑ 6 Changed 15 years ago by Olaf Meeuwissen <olaf@…>

Replying to osimons:

Last attempt committed in [650]. Hope this works as expected for all now.

Yup, that seems alright. At least now I won't wipe my build user's $HOME directory anymore when I forget to --keep-files ;-)

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.