3876: rbt post + git-svn: CRITICAL: object of type 'NoneType' has no len()

ste****@gallaghe********* (Google Code) (Is this you? Claim this profile.)
May 26, 2015
Copying this bug from EPEL Bugzilla. RHEL/CentOS 6 only ships with git version 1.7.1, which is missing the "-c name=value" option that RBTools uses to ensure that path values with unusual characters are quoted.

It looks like this was added as a side-effect of
"Disable the HTTP cache by default" (commit 03dbc9e3f2e1f8d0cd73c1941d9a5d8ed9c123bf). It doesn't seem to be related to the rest of that patch.

In the short-term, I can patch this back out of the EPEL release of RBTools, but I'm not sure what the correct upstream solution should be here. Without context for this change, I'm not sure how bad the effect would be. Please advise.

==== Red Hat Bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1225179 ====

Description of problem:

When attempting to 'rbt post' inside a repository created with 'git svn clone', posting fails and "CRITICAL: object of type 'NoneType' has no len()." is displayed.  More detail is given 

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. git svn clone a repository that is linked to an RB instance
2. rbt post in the new clone

Actual results:

  CRITICAL: object of type 'NoneType' has no len().

Expected results:

  Successful RB posting.

Additional info:

  Running 'rbt post --debug' produces:

>>> RBTools 0.7.2
>>> Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
>>> Running on
>>> Home = /home/cstapleton
>>> Current directory = /home/cstapleton/public_html/2768_CS_MORENEWS/local/interface/ATECentral2
>>> Checking for a Subversion repository...
>>> Running: svn info --non-interactive
>>> Command exited with rc 1: ['svn', 'info', '--non-interactive']
svn: '.' is not a working copy
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git svn info
>>> Running: git svn rebase -n
>>> repository info: Path: file:///home/svnroot, Base path:
/trunk/AMSER2, Supports changesets: False
>>> Making HTTP GET request to https://int.scout.wisc.edu/reviewboard/api/
>>> Making HTTP GET request to
>>> Cached response for HTTP GET
https://int.scout.wisc.edu/reviewboard/api/repositories/ expired and
was modified
>>> Making HTTP GET request to
>>> Cached response for HTTP GET
expired and was modified
>>> repository info: Path: file:///home/svnroot, Base path:
/trunk/AMSER2, Supports changesets: False
>>> Running: git rev-parse refs/heads/master
>>> Running: git merge-base 727c08c23a00a1b209f4b1bdd862ced721b21e20
>>> Running: git rev-parse 197babf39f7dcf9e880fdc8a559664f6691d6e65
>>> Running: git status --porcelain --untracked-files=no
>>> Running: git rev-parse --git-dir
>>> Running: git -c core.quotepath=false diff --no-color --no-prefix
-r -u --no-ext-diff 197babf39f7dcf9e880fdc8a559664f6691d6e65..727c08c23a00a1b209f4b1bdd862ced721b21e20
>>> Command exited with rc 129: ['git', '-c', 'core.quotepath=false',
'diff', '--no-color', '--no-prefix', '-r', '-u', '--no-ext-diff', u'197babf39f7dcf9e880fdc8a559664f6691d6e65..727c08c23a00a1b209f4b1bdd862ced721b21e20']
Traceback (most recent call last):
  File "/usr/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.7.2', 'console_scripts', 'rbt')()
  File "/usr/lib/python2.6/site-packages/rbtools/commands/main.py",
line 133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
"/usr/lib/python2.6/site-packages/rbtools/commands/__init__.py", line
555, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/lib/python2.6/site-packages/rbtools/commands/post.py",
line 639, in main
  File "/usr/lib/python2.6/site-packages/rbtools/clients/git.py", line
448, in diff
  File "/usr/lib/python2.6/site-packages/rbtools/clients/git.py", line
552, in make_diff
  File "/usr/lib/python2.6/site-packages/rbtools/utils/process.py",
line 102, in execute
    if split_lines and len(data) > 0:
TypeError: object of type 'NoneType' has no len()

Manually running
git -c core.quotepath=false diff --no-color --no-prefix
-r -u --no-ext-diff 197babf39f7dcf9e880fdc8a559664f6691d6e65..727c08c23a00a1b209f4b1bdd862ced721b21e20

Unknown option: -c
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
           [--help] COMMAND [ARGS]

The installed git is:

azure:~$ git --version
git version 1.7.1
azure:~$ yum info git
Loaded plugins: changelog, etckeeper, fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: bay.uchicago.edu
 * elrepo: mirror.symnds.com
 * epel: mirror.steadfast.net
 * extras: mirrors.tripadvisor.com
 * updates: mirror.nexcess.net
Installed Packages
Name        : git
Arch        : x86_64
Version     : 1.7.1
Release     : 3.el6_4.1
Size        : 15 M
Repo        : installed
From repo   : updates
Summary     : Fast Version Control System
URL         : http://git-scm.com/
License     : GPLv2
Description : Git is a fast, scalable, distributed revision control system with an
            : unusually rich command set that provides both high-level operations
            : and full access to internals.
            : The git rpm installs the core tools with minimal dependencies.  To
            : install all git packages, including tools for integrating with other
            : SCMs, install the git-all meta-package.

From the git release notes, it looks as though the '-c name=value' option was introduced with git 1.7.2 ?

Changing line 477 of /usr/lib/python2.6/site-packages/rbtools/clients/git.py from
  git_cmd = [self.git, '-c', 'core.quotepath=false'] 
  git_cmd = [self.git]

resolves the issue.
#1 brennie
We're working on a patch that will be making its way into 0.7.3, which will be released soon.
  • +PendingReview
#2 brennie
The fix for this issue has landed on the release-0.7.x and master branches as commit 6ffe954787a3e9fccb3a91495bca2c149ba8f5f9. It will be included in the next minor RBTools release (0.7.3).
#3 brennie
  • -PendingReview