SpecCheck: Check for NULL char in all lines
Fix https://github.com/rpm-software-management/rpmlint/issues/1067
This commit is contained in:
parent
f44dc3ebfd
commit
c46c7617fe
|
@ -670,6 +670,8 @@ class SpecCheck(AbstractCheck):
|
|||
self._checkline_package_obsoletes(line)
|
||||
self._checkline_package_conflicts(line)
|
||||
|
||||
self._checkline_forbidden_controlchars(line)
|
||||
|
||||
def _checkline_changelog(self, line):
|
||||
if self.current_section == 'changelog':
|
||||
deptoken = Pkg.has_forbidden_controlchars(line)
|
||||
|
@ -762,3 +764,9 @@ class SpecCheck(AbstractCheck):
|
|||
if python_sitelib_glob_regex.match(line):
|
||||
self.output.add_info('W', self.pkg, 'python-sitelib-glob-in-files',
|
||||
line[:-1])
|
||||
|
||||
def _checkline_forbidden_controlchars(self, line):
|
||||
"""Look for controlchar in any line"""
|
||||
# https://github.com/rpm-software-management/rpmlint/issues/1067
|
||||
if Pkg.has_forbidden_controlchars(line):
|
||||
self.output.add_info('W', self.pkg, 'forbidden-controlchar-found')
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1156,3 +1156,15 @@ def test_python_sitelib(package, speccheck):
|
|||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'W: python-sitelib-glob-in-files' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [
|
||||
'spec/null-char-last',
|
||||
'spec/null-char-first',
|
||||
])
|
||||
def test_null_char(package, speccheck):
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'forbidden-controlchar-found' in out
|
||||
|
|
Loading…
Reference in New Issue