New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run git-cola if the PATH environment variable contains non-ASCII characters #282

Closed
Vdragon opened this Issue Jun 7, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@Vdragon
Contributor

Vdragon commented Jun 7, 2014

Reproduce steps

  1. $ make prefix=軟體/git-cola install
  2. $ PATH=$PATH:$(pwd)/軟體/git-cola/bin
  3. $ git cola

Expected result

git-cola launches normally

Current result

git-cola fails with following output:

Traceback (most recent call last):
  File "/usr/bin/git-cola", line 359, in <module>
    sys.exit(main())
  File "/usr/bin/git-cola", line 71, in main
    return args.func(args)
  File "/usr/bin/git-cola", line 213, in cmd_cola
    context = application_init(args)
  File "/usr/share/git-cola/lib/cola/app.py", line 257, in application_init
    setup_environment()
  File "/usr/share/git-cola/lib/cola/app.py", line 81, in setup_environment
    compat.setenv('PATH', path)
  File "/usr/share/git-cola/lib/cola/compat.py", line 32, in setenv
    os.environ[key] = value
  File "/usr/lib/python2.7/os.py", line 471, in __setitem__
    putenv(key, item)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 239-240: ordinal not in range(128)

Environment

git-cola

commit 90b70d2

OS

Ubuntu 14.04LTS x86 64bit

Python

2.7.5 from Ubuntu repo

Locale

zh_TW.UTF-8

davvid added a commit to davvid/git-cola that referenced this issue Jun 7, 2014

compat: support unicode in environment variables
On Python2 we have to encode provide utf-8 bytestrings if we want
unicode values in enviornment variables.  Python3 accepts them as-is.

Related-to: #282
Reported-by: V字龍(Vdragon) <pika1021@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>

davvid added a commit to davvid/git-cola that referenced this issue Jun 7, 2014

git-{cola,dag}: support installation prefixes with utf-8 paths
Decode the bytestring so that os.path.join() can operate on it now that
we're using unicode literals.

Closes #282

Reported-by: V字龍(Vdragon) <pika1021@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>

davvid added a commit that referenced this issue Jun 7, 2014

compat: support unicode in environment variables
On Python2 we have to encode provide utf-8 bytestrings if we want
unicode values in enviornment variables.  Python3 accepts them as-is.

Related-to: #282
Reported-by: V字龍(Vdragon) <pika1021@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>

@davvid davvid closed this in 8fcc96d Jun 7, 2014

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Jun 7, 2014

Member

I typod the closes line. This was actually fixed in 3084fe2

Member

davvid commented Jun 7, 2014

I typod the closes line. This was actually fixed in 3084fe2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment