← Back to team overview

openerp-india team mailing list archive

Re: [Bug 928376] Re: file_open is not safe and performs too many useless syscalls

 

On 02/08/2012 06:51 PM, Florent wrote:
> Well the reason for zip before unzipped might be because OpenERP was
> proposing to "Import module" as a .ZIP file in 4.2 and 5.0.
> 
> And in this case the assumption is that the imported ZIP module should take
> precedence on the installed (not zipped) module.
> However I agree that it is deprecated now, and the behaviour you propose
> looks more sane.

Thank your for the feedback. It also seems to me that even with the zip upload
case supported, allowing to upload a zip file with the same name as an existing
module is going to be confusing.. whichever precedence we choose may not be the
one the user expects (e.g importing by mistake a zip with the same name as an
existing module)


> I did not know you were already working on a patch.
> The merge proposal covers the point 2 and also the other bug 928507.
> 
> I refactored the utility while preserving as much compatibility as possible
> (and keeping an eye on Win32, even if I don't run it).

Thanks, that's very much appreciated!


> It is very easy to adapt it to cover point 1 too (loading from directory
> first, from zip second).

Excellent, thanks for merging my changes in your branch!
I have a few remaining things to check and then we can do the final merge of
your work: there are a few pathological cases during module installation where
we explicitly call tools.file_open on an ambiguous path, still causing a great
number of useless zip-related i/o syscalls before eventually finding the
regular file somewhere else.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/928376

Title:
  file_open is not safe and performs too many useless syscalls

Status in OpenERP Server:
  In Progress

Bug description:
  It happens with 5.0 and certainly with 6.1 too.

  When you update the list of modules, the application calls:
    tools.file_open(terp_file)

  And file_open will browse all the parents of the "addons_path" for a zip file ... 
  I've added a statement to trace the call to "open()" :

  open('/home/florent/erpdemo/parts/openerp-server/bin/addons/account.zip', 'rb')
  open('/home/florent/erpdemo/parts/openerp-server/bin/addons.zip', 'rb')
  open('/home/florent/erpdemo/parts/openerp-server/bin.zip', 'rb')
  open('/home/florent/erpdemo/parts/openerp-server.zip', 'rb')
  open('/home/florent/erpdemo/parts.zip', 'rb')
  open('/home/florent/erpdemo.zip', 'rb')
  open('/home/florent.zip', 'rb')
  open('/home.zip', 'rb')
  open('/.zip', 'rb')

  This behaviour is seen on module installation or upgrade too.
  It is probably a security issue which impacts performance as well.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/928376/+subscriptions


References