[Piglit] [PATCH] framework: fix loading from an fd

Ilia Mirkin imirkin at alum.mit.edu
Mon Jul 6 10:01:08 PDT 2015


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

Thanks for investigating this!

On Mon, Jul 6, 2015 at 12:58 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> Apparently python's os.path.isfile doesn't consider special files like
> one in /proc/self/fd/ to be a file. So instead of testing with 'isfile',
> test with 'not isdir'.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  framework/backends/__init__.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/framework/backends/__init__.py b/framework/backends/__init__.py
> index 43a45d1..289b6da 100644
> --- a/framework/backends/__init__.py
> +++ b/framework/backends/__init__.py
> @@ -119,7 +119,9 @@ def load(file_path):
>      """
>      extension = None
>
> -    if os.path.isfile(file_path):
> +    # This should be 'not isdir', since an fd does not evaluate to True using
> +    # 'os.path.isfile'
> +    if not os.path.isdir(file_path):
>          extension = os.path.splitext(file_path)[1]
>          if not extension:
>              extension = ''
> --
> 2.4.5
>


More information about the Piglit mailing list