Thomas Leonard | 30 Jun 2012 12:48
Picon
Gravatar

Re: [PATCH 2/2] Don't try to delete a directory tree from within that tree

I don't see any calls to chdir in 0install:

0install$ git grep chdir
tests/testdistro.py:            archdir =
os.path.join(os.path.dirname(__file__), 'arch')
tests/testdistro.py:            arch = distro.ArchDistribution(archdir)

A library really shouldn't be changing the current directory, anyway.
Which program triggers it?

On 30 June 2012 10:32, Dave Abrahams <dave <at> boostpro.com> wrote:
> Cleanup of some temp directory triggers it. Search for chdir followed by this call in the next 80 lines. If
you mean to fix the caller without applying this patch, that'd be a mistake IMO. This is a kind of
portability bug that you'll keep making otherwise, because it's so easy to do and is silent on Linux.
>
> Sent from my Q-42 Space Modulator
>
> On Jun 30, 2012, at 4:48 AM, Thomas Leonard <talex5 <at> gmail.com> wrote:
>
>> On 29 June 2012 18:51, Dave Abrahams <dave <at> boostpro.com> wrote:
>>> ---
>>>  zeroinstall/support/__init__.py |    4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/zeroinstall/support/__init__.py b/zeroinstall/support/__init__.py
>>> index efe3b8a..c652362 100644
>>> --- a/zeroinstall/support/__init__.py
>>> +++ b/zeroinstall/support/__init__.py
>>>  <at>  <at>  -76,6 +76,10  <at>  <at>  def ro_rmtree(root):
>>>        import shutil
>>>        import platform
>>>        if platform.system() == 'Windows':
>>> +               def true_path(x):
>>> +                        return os.path.normcase(os.path.normpath(os.path.realpath(x)));
>>> +               if true_path(os.getcwd()).startswith(true_path(root)):
>>> +                        os.chdir(os.path.join(root,os.path.pardir))
>>>                for main, dirs, files in os.walk(root):
>>>                        for i in files + dirs:
>>>                                os.chmod(os.path.join(main, i), 0o700)
>>
>> What triggers this? Probably we should fix the caller.
>>
>>
>> --
>> Dr Thomas Leonard        http://0install.net/
>> GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
>> GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Zero-install-devel mailing list
>> Zero-install-devel <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/zero-install-devel
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Zero-install-devel mailing list
> Zero-install-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/zero-install-devel

--

-- 
Dr Thomas Leonard        http://0install.net/
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Zero-install-devel mailing list
Zero-install-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/zero-install-devel

Gmane