fix unbound var, do not overload sys.argv[0]

This commit is contained in:
Tom Callaway 2013-11-11 10:41:51 -05:00
parent 2be746cdc8
commit 6c560c4ef9
3 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,50 @@
diff -up rpmlint-1.5/rpmlint.no-sys-argv-overload rpmlint-1.5/rpmlint
--- rpmlint-1.5/rpmlint.no-sys-argv-overload 2013-11-11 10:27:05.579909238 -0500
+++ rpmlint-1.5/rpmlint 2013-11-11 10:28:13.827740569 -0500
@@ -235,7 +235,7 @@ def runChecks(pkg):
#
#############################################################################
-sys.argv[0] = os.path.basename(sys.argv[0])
+argv0 = os.path.basename(sys.argv[0])
# parse options
try:
@@ -256,8 +256,8 @@ try:
'rawout=',
])
except getopt.GetoptError, e:
- Pkg.warn("%s: %s" % (sys.argv[0], e))
- usage(sys.argv[0])
+ Pkg.warn("%s: %s" % (argv0, e))
+ usage(argv0)
sys.exit(1)
# process options
@@ -276,7 +276,7 @@ configs = glob.glob('/etc/rpmlint/*confi
configs.sort()
# Was rpmlint invoked as a prefixed variant?
-m = re.match(r"(?P<prefix>[\w-]+)-rpmlint(\.py)?", sys.argv[0])
+m = re.match(r"(?P<prefix>[\w-]+)-rpmlint(\.py)?", argv0)
if m:
# Okay, we're a prefixed variant. Look for the variant config.
# If we find it, use it. If not, fallback to the default.
@@ -310,7 +310,7 @@ for o in opt:
# split by comma for deprecated backwards compatibility with < 1.2
info_error.update(o[1].split(','))
elif o[0] in ('-h', '--help'):
- usage(sys.argv[0])
+ usage(argv0)
sys.exit(0)
elif o[0] in ('-C', '--checkdir'):
Config.addCheckDir(o[1])
@@ -367,7 +367,7 @@ if info_error:
# if no argument print usage
if not args:
- usage(sys.argv[0])
+ usage(argv0)
sys.exit(1)
if __name__ == '__main__':

View File

@ -0,0 +1,11 @@
diff -up rpmlint-1.5/MenuXDGCheck.py.fixunbound rpmlint-1.5/MenuXDGCheck.py
--- rpmlint-1.5/MenuXDGCheck.py.fixunbound 2013-11-11 10:31:28.023362241 -0500
+++ rpmlint-1.5/MenuXDGCheck.py 2013-11-11 10:32:00.253303519 -0500
@@ -42,6 +42,7 @@ class MenuXDGCheck(AbstractCheck.Abstrac
self.cfp.read(f)
binary = self.cfp.get('Desktop Entry','Exec').split(' ',1)[0]
if binary:
+ found = False
if binary.startswith('/'):
found = os.path.exists(root + binary)
else:

View File

@ -1,6 +1,6 @@
Name: rpmlint
Version: 1.5
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Tool for checking common errors in RPM packages
Group: Development/Tools
@ -16,6 +16,10 @@ Source4: %{name}.config.el4
Source5: %{name}.config.el5
# http://sourceforge.net/p/rpmlint/code/ci/f85186d/
Patch0: rpmlint-1.5-desktopfix.patch
# http://sourceforge.net/p/rpmlint/code/ci/b5044ef95714377fd8b6f1dec79360b34d8c24f9
Patch1: rpmlint-1.5-dont-modify-sys-argv-0.patch
# http://sourceforge.net/p/rpmlint/code/ci/910b08d053eb384605ca6ad5606791e7c224c3fa
Patch2: rpmlint-1.5-fix-unbound-var.patch
BuildArch: noarch
BuildRequires: python >= 2.4
@ -52,6 +56,8 @@ and source packages as well as spec files can be checked.
%prep
%setup -q
%patch0 -p1 -b .desktopfix
%patch1 -p1 -b .argv0
%patch2 -p1 -b .fixunbound
sed -i -e /MenuCheck/d Config.py
cp -p config config.example
install -pm 644 %{SOURCE2} CHANGES.package.old
@ -102,6 +108,10 @@ make check
%changelog
* Mon Nov 11 2013 Tom Callaway <spot@fedoraproject.org> - 1.5-5
- do not modify sys.argv[0] (bz 1026333)
- fix unbound var in MenuXDGCheck.py (bz 1026328)
* Wed Oct 9 2013 Tom Callaway <spot@fedoraproject.org> - 1.5-4
- Fix handling of Exec= with an absolute path (bz991278)
- Update license list, add AGPLv3+ (bz894187)