From 80fa07d3f5a3c917ab5de1f924c1eec5cd361dbb Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Nov 11 2013 15:39:54 +0000 Subject: fix unbound var, do not overload sys.argv[0] --- diff --git a/rpmlint-1.5-dont-modify-sys-argv-0.patch b/rpmlint-1.5-dont-modify-sys-argv-0.patch new file mode 100644 index 0000000..f716f5a --- /dev/null +++ b/rpmlint-1.5-dont-modify-sys-argv-0.patch @@ -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[\w-]+)-rpmlint(\.py)?", sys.argv[0]) ++m = re.match(r"(?P[\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__': diff --git a/rpmlint-1.5-fix-unbound-var.patch b/rpmlint-1.5-fix-unbound-var.patch new file mode 100644 index 0000000..98e9bc9 --- /dev/null +++ b/rpmlint-1.5-fix-unbound-var.patch @@ -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: diff --git a/rpmlint.spec b/rpmlint.spec index 178f359..ea2ca53 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -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 - 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 - 1.5-4 - Fix handling of Exec= with an absolute path (bz991278) - Update license list, add AGPLv3+ (bz894187)