[PATCH] emirrordist: Delete potential symlinks for all layouts

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] emirrordist: Delete potential symlinks for all layouts

Michał Górny-5
Unlink for all distfile layouts rather than for all but primary.  This
wrongly assumed that the primary layout will always be removed
as a result of earlier code.  However, the rename() call correctly
assumes that the primary layout may be an old symlink, and operates
on realpath().  Therefore, the real file from a secondary layout may
be renamed, leaving dangling symlink.

Bug: https://bugs.gentoo.org/697906
Signed-off-by: Michał Górny <[hidden email]>
---
 lib/portage/_emirrordist/DeletionTask.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/_emirrordist/DeletionTask.py b/lib/portage/_emirrordist/DeletionTask.py
index db5ac5ffb..a4bb29419 100644
--- a/lib/portage/_emirrordist/DeletionTask.py
+++ b/lib/portage/_emirrordist/DeletionTask.py
@@ -102,7 +102,7 @@ class DeletionTask(CompositeTask):
 
  def _delete_links(self):
  success = True
- for layout in self.config.layouts[1:]:
+ for layout in self.config.layouts:
  distfile_path = os.path.join(
  self.config.options.distfiles,
  layout.get_path(self.distfile))
--
2.23.0


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] emirrordist: Delete potential symlinks for all layouts

Zac Medico-2
On 10/17/19 5:09 AM, Michał Górny wrote:

> Unlink for all distfile layouts rather than for all but primary.  This
> wrongly assumed that the primary layout will always be removed
> as a result of earlier code.  However, the rename() call correctly
> assumes that the primary layout may be an old symlink, and operates
> on realpath().  Therefore, the real file from a secondary layout may
> be renamed, leaving dangling symlink.
>
> Bug: https://bugs.gentoo.org/697906
> Signed-off-by: Michał Górny <[hidden email]>
> ---
>  lib/portage/_emirrordist/DeletionTask.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/portage/_emirrordist/DeletionTask.py b/lib/portage/_emirrordist/DeletionTask.py
> index db5ac5ffb..a4bb29419 100644
> --- a/lib/portage/_emirrordist/DeletionTask.py
> +++ b/lib/portage/_emirrordist/DeletionTask.py
> @@ -102,7 +102,7 @@ class DeletionTask(CompositeTask):
>  
>   def _delete_links(self):
>   success = True
> - for layout in self.config.layouts[1:]:
> + for layout in self.config.layouts:
>   distfile_path = os.path.join(
>   self.config.options.distfiles,
>   layout.get_path(self.distfile))
>
Looks good. Please merge.
--
Thanks,
Zac


signature.asc (1000 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] emirrordist: Delete potential symlinks for all layouts

Michał Górny-5
On Thu, 2019-10-17 at 11:02 -0700, Zac Medico wrote:

> On 10/17/19 5:09 AM, Michał Górny wrote:
> > Unlink for all distfile layouts rather than for all but primary.  This
> > wrongly assumed that the primary layout will always be removed
> > as a result of earlier code.  However, the rename() call correctly
> > assumes that the primary layout may be an old symlink, and operates
> > on realpath().  Therefore, the real file from a secondary layout may
> > be renamed, leaving dangling symlink.
> >
> > Bug: https://bugs.gentoo.org/697906
> > Signed-off-by: Michał Górny <[hidden email]>
> > ---
> >  lib/portage/_emirrordist/DeletionTask.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/portage/_emirrordist/DeletionTask.py b/lib/portage/_emirrordist/DeletionTask.py
> > index db5ac5ffb..a4bb29419 100644
> > --- a/lib/portage/_emirrordist/DeletionTask.py
> > +++ b/lib/portage/_emirrordist/DeletionTask.py
> > @@ -102,7 +102,7 @@ class DeletionTask(CompositeTask):
> >  
> >   def _delete_links(self):
> >   success = True
> > - for layout in self.config.layouts[1:]:
> > + for layout in self.config.layouts:
> >   distfile_path = os.path.join(
> >   self.config.options.distfiles,
> >   layout.get_path(self.distfile))
> >
>
> Looks good. Please merge.
Done.  Could you make a bugfix release with this, please?

--
Best regards,
Michał Górny


signature.asc (631 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] emirrordist: Delete potential symlinks for all layouts

Zac Medico-2
On 10/17/19 11:09 AM, Michał Górny wrote:

> On Thu, 2019-10-17 at 11:02 -0700, Zac Medico wrote:
>> On 10/17/19 5:09 AM, Michał Górny wrote:
>>> Unlink for all distfile layouts rather than for all but primary.  This
>>> wrongly assumed that the primary layout will always be removed
>>> as a result of earlier code.  However, the rename() call correctly
>>> assumes that the primary layout may be an old symlink, and operates
>>> on realpath().  Therefore, the real file from a secondary layout may
>>> be renamed, leaving dangling symlink.
>>>
>>> Bug: https://bugs.gentoo.org/697906
>>> Signed-off-by: Michał Górny <[hidden email]>
>>> ---
>>>  lib/portage/_emirrordist/DeletionTask.py | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/portage/_emirrordist/DeletionTask.py b/lib/portage/_emirrordist/DeletionTask.py
>>> index db5ac5ffb..a4bb29419 100644
>>> --- a/lib/portage/_emirrordist/DeletionTask.py
>>> +++ b/lib/portage/_emirrordist/DeletionTask.py
>>> @@ -102,7 +102,7 @@ class DeletionTask(CompositeTask):
>>>  
>>>   def _delete_links(self):
>>>   success = True
>>> - for layout in self.config.layouts[1:]:
>>> + for layout in self.config.layouts:
>>>   distfile_path = os.path.join(
>>>   self.config.options.distfiles,
>>>   layout.get_path(self.distfile))
>>>
>>
>> Looks good. Please merge.
>
> Done.  Could you make a bugfix release with this, please?
Sure. Applied with sed in portage-2.3.77-r1.
--
Thanks,
Zac


signature.asc (1000 bytes) Download Attachment