SHA256
1
0
forked from pool/rpmlint

- add 0001-Avoid-calling-close-on-undefined-fd-variable.patch

OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=543
This commit is contained in:
Dirk Mueller 2017-11-01 13:01:50 +00:00 committed by Git OBS Bridge
parent 169fb46bec
commit 0b80e184d3
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From 49611f900047d5397ebbbdb0ed5299580337ea34 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Wed, 1 Nov 2017 13:59:01 +0100
Subject: [PATCH] Avoid calling close on undefined fd variable
It can happen that open did through an OSError but then the
corresponding close UnknownVariableError wasn't caught. we
can fix that by putting both in the same try/exception block,
which also cleans up the code a bit.
---
Pkg.py | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/Pkg.py b/Pkg.py
index 47197c9..2622f9a 100644
--- a/Pkg.py
+++ b/Pkg.py
@@ -719,16 +719,11 @@ class Pkg(AbstractPkg):
# use descriptor() method instead
try:
fd = os.open(pkgfile.path, os.O_RDONLY)
- except OSError:
- if not pkgfile.is_ghost:
- raise
- else:
pkgfile.magic = b2s(_magic.descriptor(fd))
- # libmagic up to 5.18 already closes the descriptor
- try:
os.close(fd)
except OSError:
- pass
+ if not pkgfile.is_ghost:
+ raise
if pkgfile.magic is None:
pkgfile.magic = ''
elif Pkg._magic_from_compressed_re.search(pkgfile.magic):
--
2.14.2

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Nov 1 13:01:32 UTC 2017 - dmueller@suse.com
- add 0001-Avoid-calling-close-on-undefined-fd-variable.patch
-------------------------------------------------------------------
Tue Oct 24 12:54:47 UTC 2017 - jengelh@inai.de

View File

@ -87,6 +87,7 @@ Patch67: omit_BUILDROOT_from_pyo_files.patch
Patch68: 0001-Avoid-false-positives-on-is_elf-check.patch
Patch69: 0007-Validate-Appdata-also-when-appstream-util-is-unavail.patch
Patch70: rpmlint-all-pie.patch
Patch71: 0001-Avoid-calling-close-on-undefined-fd-variable.patch
BuildRequires: obs-service-format_spec_file
BuildRequires: python3-flake8
BuildRequires: python3-pytest