[master/rhel7] Ensure media being verified is always unmounted

David Shea dshea at redhat.com
Mon Feb 24 22:47:14 UTC 2014


On 02/24/2014 02:26 PM, David Shea wrote:
> Exceptions raised in verifyMedia could cause rmdir to be called on the
> temporary mountpoint before the media is unmounted, causing another
> error.
>
> Resolves: rhbz#1050943
> ---
>   pyanaconda/image.py | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/pyanaconda/image.py b/pyanaconda/image.py
> index 3c154d3..159583f 100644
> --- a/pyanaconda/image.py
> +++ b/pyanaconda/image.py
> @@ -209,11 +209,14 @@ def opticalInstallMedia(devicetree):
>               except FSError:
>                   continue
>   
> -            if not verifyMedia(mountpoint):
> -                dev.format.unmount()
> -                continue
> +            try:
> +                if not verifyMedia(mountpoint):
> +                    dev.format.unmount()
> +                    continue
>   
> -            dev.format.unmount()
> +                dev.format.unmount()
> +            finally:
> +                dev.format.unmount()
>           finally:
>               os.rmdir(mountpoint)
>   

Obviously I should remove the two old unmount calls if I'm adding a new 
one. Fixed locally.


More information about the anaconda-patches mailing list