[Mesa-dev] [PATCH] meson, install_megadrivers: Also remove stale symlinks

Dylan Baker dylan at pnwbakers.com
Fri Aug 3 18:28:57 UTC 2018


Quoting Gert Wollny (2018-08-03 11:12:47)
> Am Freitag, den 03.08.2018, 08:47 -0700 schrieb Dylan Baker:
> > Quoting Gert Wollny (2018-08-03 02:55:36)
> > > From: Gert Wollny <gert.wollny at collabora.com>
> > > 
> > > os.path.exists doesn't return True for stale symlinks, but they are
> > > in
> > > the way later, when a link/file with the same name is to be
> > > created.
> > > For instance it is conceivable that the pointed to file is replaced
> > > by
> > > a file with a new name, and then the symlink is dead.
> > > 
> > > To handle this check specifically for all existing symlinks to be
> > > removed. (This bugged me for some time with a link libXvMCr600.so
> > > always being in the way of installing this file)
> > > 
> > > Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> > > ---
> > > It could also be that the problem is elsewhere, but at least here
> > > it manifests itself and this patch fixes it. 
> > > 
> > >  bin/install_megadrivers.py | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/bin/install_megadrivers.py
> > > b/bin/install_megadrivers.py
> > > index 8d9ed9c6dc..7bf0037a6e 100755
> > > --- a/bin/install_megadrivers.py
> > > +++ b/bin/install_megadrivers.py
> > > @@ -49,7 +49,7 @@ def main():
> > >      for driver in args.drivers:
> > >          abs_driver = os.path.join(to, driver)
> > >  
> > > -        if os.path.exists(abs_driver):
> > > +        if os.path.exists(abs_driver) or
> > > os.path.lexists(abs_driver):
> > 
> > exists() and lexists() only differ in what they do with broken
> > symlinks, so I think we should just replace exists() with lexists()
> > and not have the "or".
> You're right, should I re-post the patch or would it be okay to push
> the changed version right away? 
> 
> best, 
> Gert

Please send a v2, there are two other instances of os.path.exists() looking at
symlinks in this script, and I think they all need to use os.path.lexists().

This probably should be backported to stable as well, so please add
Fixes: f7f1b30f81e842db6057591470ce3cb6d4fb2795
       ("meson: extend install_megadrivers script to handle symmlinking")

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180803/b60ad411/attachment.sig>


More information about the mesa-dev mailing list