Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12111 [Umbrella] Split test-patch off into its own TLP
  3. HADOOP-12303

test-patch pylint plugin fails silently and votes +1 incorrectly

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • HADOOP-12111
    • HADOOP-12111
    • yetus
    • None

    Description

      This patch

      [sekikn@mobile hadoop]$ cat /tmp/test.patch 
      diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py
      index 37bd58a..7cd6dd3 100755
      --- a/dev-support/releasedocmaker.py
      +++ b/dev-support/releasedocmaker.py
      @@ -580,4 +580,4 @@ def main():
               sys.exit(1)
       
       if __name__ == "__main__":
      -    main()
      +    main( )
      

      is supposed to cause the following pylint errors.

      C:583, 0: No space allowed after bracket
          main( )
              ^ (bad-whitespace)
      C:583, 0: No space allowed before bracket
          main( )
                ^ (bad-whitespace)
      

      But the system locale is set as follows, pylint check is passed, and there is no pylint output.

      [sekikn@mobile hadoop]$ locale
      LANG=
      LC_COLLATE="C"
      LC_CTYPE="UTF-8"
      LC_MESSAGES="C"
      LC_MONETARY="C"
      LC_NUMERIC="C"
      LC_TIME="C"
      LC_ALL=
      [sekikn@mobile hadoop]$ dev-support/test-patch.sh --basedir=/Users/sekikn/dev/hadoop --project=hadoop /tmp/test.patch 
      
      (snip)
      
      | Vote |      Subsystem |  Runtime   | Comment
      ============================================================================
      |  +1  |       @author  |  0m 00s    | The patch does not contain any @author 
      |      |                |            | tags.
      |  +1  |    asflicense  |  0m 21s    | Patch does not generate ASF License 
      |      |                |            | warnings.
      |  +1  |        pylint  |  0m 01s    | There were no new pylint issues. 
      |  +1  |    whitespace  |  0m 00s    | Patch has no whitespace issues. 
      |      |                |  0m 24s    | 
      
      (snip)
      
      [sekikn@mobile hadoop]$ cat /private/tmp/test-patch-hadoop/8656/branch-pylint-result.txt 
      [sekikn@mobile hadoop]$ cat /private/tmp/test-patch-hadoop/8656/patch-pylint-result.txt 
      [sekikn@mobile hadoop]$ cat /private/tmp/test-patch-hadoop/8656/diff-patch-pylint.txt 
      

      Removing '2>/dev/null' from pylint.sh reveals the root cause. Setting LC_ALL or LC_CTYPE such like 'en_US.UTF-8' solves this problem.

      ============================================================================
      ============================================================================
                                pylint plugin: prepatch
      ============================================================================
      ============================================================================
      ============================================================================
      
      
      Running pylint against modified python scripts.
      No config file found, using default configuration
      Traceback (most recent call last):
        File "/usr/local/bin/pylint", line 11, in <module>
          sys.exit(run_pylint())
        File "/Library/Python/2.7/site-packages/pylint/__init__.py", line 23, in run_pylint
          Run(sys.argv[1:])
        File "/Library/Python/2.7/site-packages/pylint/lint.py", line 1332, in __init__
          linter.check(args)
        File "/Library/Python/2.7/site-packages/pylint/lint.py", line 747, in check
          self._do_check(files_or_modules)
        File "/Library/Python/2.7/site-packages/pylint/lint.py", line 869, in _do_check
          self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
        File "/Library/Python/2.7/site-packages/pylint/lint.py", line 944, in check_astroid_module
          checker.process_tokens(tokens)
        File "/Library/Python/2.7/site-packages/pylint/checkers/format.py", line 743, in process_tokens
          self.check_indent_level(token, indents[-1]+1, line_num)
        File "/Library/Python/2.7/site-packages/pylint/checkers/format.py", line 963, in check_indent_level
          expected * unit_size))
        File "/Library/Python/2.7/site-packages/pylint/checkers/__init__.py", line 101, in add_message
          self.linter.add_message(msg_id, line, node, args, confidence)
        File "/Library/Python/2.7/site-packages/pylint/utils.py", line 410, in add_message
          (abspath, path, module, obj, line or 1, col_offset or 0), msg, confidence))
        File "/Library/Python/2.7/site-packages/pylint/reporters/text.py", line 61, in handle_message
          self.write_message(msg)
        File "/Library/Python/2.7/site-packages/pylint/reporters/text.py", line 51, in write_message
          self.writeln(msg.format(self._template))
        File "/Library/Python/2.7/site-packages/pylint/reporters/__init__.py", line 94, in writeln
          print(self.encode(string), file=self.out)
        File "/Library/Python/2.7/site-packages/pylint/reporters/__init__.py", line 84, in encode
          locale.getdefaultlocale()[1] or
        File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 511, in getdefaultlocale
          return _parse_localename(localename)
        File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 443, in _parse_localename
          raise ValueError, 'unknown locale: %s' % localename
      ValueError: unknown locale: UTF-8
      

      In such a case, pylint plugin should fail and vote -1.

      Attachments

        1. HADOOP-12303.HADOOP-12111.01.patch
          2 kB
          Kengo Seki
        2. HADOOP-12303.HADOOP-12111.00.patch
          2 kB
          Kengo Seki

        Activity

          People

            sekikn Kengo Seki
            sekikn Kengo Seki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: