Bug 694806

Summary: [abrt] git-cola-1.4.3.1-1.fc14: core.py:36:encode:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)
Product: [Fedora] Fedora Reporter: Christian Jann <christian.jann>
Component: git-colaAssignee: Kevin Kofler <kevin>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: davvid, kevin
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://github.com/davvid/git-cola/issues#issue/74
Whiteboard: abrt_hash:7ab77497
Fixed In Version: git-cola-1.4.3.2-1.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-23 20:50:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 696563    
Bug Blocks:    
Attachments:
Description Flags
File: backtrace
none
handle unicode in repo paths for the git init case none

Description Christian Jann 2011-04-08 13:38:20 UTC
abrt version: 1.1.17
architecture: x86_64
comment: I can rename the folder but such a crash should not happen.
component: git-cola
executable: /usr/bin/git-cola
kernel: 2.6.35.11-83.fc14.x86_64
package: git-cola-1.4.3.1-1.fc14
reason: core.py:36:encode:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)
release: Fedora release 14 (Laughlin)
time: 1302268930
uid: 1000

backtrace
-----
core.py:36:encode:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/bin/git-cola", line 54, in <module>
    cola.main.main()
  File "/usr/share/git-cola/lib/cola/main.py", line 157, in main
    valid = model.use_worktree(repo)
  File "/usr/share/git-cola/lib/cola/models/main.py", line 141, in use_worktree
    self._init_config_data()
  File "/usr/share/git-cola/lib/cola/models/main.py", line 183, in _init_config_data
    _config.update()
  File "/usr/share/git-cola/lib/cola/gitcfg.py", line 88, in update
    self._read_configs()
  File "/usr/share/git-cola/lib/cola/gitcfg.py", line 117, in _read_configs
    self._repo = self.read_config(self._config_files['repo'])
  File "/usr/share/git-cola/lib/cola/gitcfg.py", line 127, in read_config
    config_lines = self.git.config(*args).split('\0')
  File "/usr/share/git-cola/lib/cola/git.py", line 63, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/usr/share/git-cola/lib/cola/git.py", line 224, in _call_process
    ext_args = map(core.encode, args)
  File "/usr/share/git-cola/lib/cola/core.py", line 36, in encode
    return unenc.encode('utf-8', 'replace')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)

Local variables in innermost frame:
unenc: '/home/chris/work/projects/csync/backup/csync_Christian_K\xc3\xb6lpin/csync/.git/config'

"csync_Christian_Kölpin"
I can rename the folder but such a crash should not happen.

How to reproduce
-----
1. open a git repo with an 'ö'  ASCII 246 inside the path (maybe also ä,ü,Ü,Ö,Ä  ASCII Latin-1)
2. wait for ABRT
3.

Comment 1 Christian Jann 2011-04-08 13:38:22 UTC
Created attachment 490795 [details]
File: backtrace

Comment 2 Christian Jann 2011-04-08 14:00:05 UTC
https://github.com/davvid/git-cola/issues#issue/74

Comment 3 Kevin Kofler 2011-04-08 15:22:20 UTC
Thanks, let's track this upstream. (We can reopen this bug if upstream has a fix.)

Comment 5 Fedora Update System 2011-04-14 20:48:41 UTC
git-cola-1.4.3.2-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/git-cola-1.4.3.2-1.fc15

Comment 6 Fedora Update System 2011-04-14 20:49:14 UTC
git-cola-1.4.3.2-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/git-cola-1.4.3.2-1.fc14

Comment 7 Fedora Update System 2011-04-14 20:50:03 UTC
git-cola-1.4.3.2-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/git-cola-1.4.3.2-1.fc13

Comment 8 Christian Jann 2011-04-15 07:23:07 UTC
https://github.com/davvid/git-cola/issues/74#issuecomment-1005518

I don't get a crash, but I see this on the command line:
Traceback (most recent call last):
File "/usr/share/git-cola/lib/cola/views/main.py", line 269, in _update_callback merge_msg_hash = utils.checksum(merge_msg_path) File "/usr/share/git-cola/lib/cola/utils.py", line 287, in checksum md5.update(slurp(path)) File "/usr/share/git-cola/lib/cola/utils.py", line 209, in slurp fh = open(core.encode(path)) File "/usr/share/git-cola/lib/cola/core.py", line 36, in encode return unenc.encode('utf-8', 'replace') UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)

git-cola --version
cola version 1.4.3.2

Comment 9 Fedora Update System 2011-04-15 20:46:42 UTC
Package git-cola-1.4.3.2-1.fc14:
* should fix your issue,
* was pushed to the Fedora 14 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing git-cola-1.4.3.2-1.fc14'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/git-cola-1.4.3.2-1.fc14
then log in and leave karma (feedback).

Comment 10 David Aguilar 2011-04-16 21:10:04 UTC
Hello

After teh 1.4.3.2 release Christian helped me identify more unicode-related issues.  They've all been fixed in the latest github master branch.  These will be released in 1.4.3.3, which hasn't happened yet.

I'm going to exercise it some more this week and plan on having 1.4.3.3 released by next week.  I'll post another comment here once it's available.

Thanks all for your help

Comment 11 Kevin Kofler 2011-04-17 01:51:38 UTC
Thanks for the status update.

My plan is to go ahead with pushing 1.4.3.2 to our users for now, and to push 1.4.3.3 as another update as soon as it's ready.

Comment 12 Christian Jann 2011-04-17 09:27:11 UTC
Are you sure that they are fixed now, less than 5 minutes ago I've done a git pull:

[chris@linuxbox git-cola]$ git pull
Already up-to-date.
[chris@linuxbox git-cola]$ cd /home/chris/excluded/csync_Christian_Kölpin/csync/
[chris@linuxbox csync]$ /mnt/data/BUILD/git-cola/bin/git-cola 
Traceback (most recent call last):
  File "/mnt/data/BUILD/git-cola/cola/views/main.py", line 274, in _update_callback
    merge_msg_path)
  File "/mnt/data/BUILD/git-cola/cola/notification.py", line 26, in broadcast
    self.emit(signal, *args, **opts)
  File "/mnt/data/BUILD/git-cola/cola/notification.py", line 32, in emit
    fxn(*args, **opts)
  File "/mnt/data/BUILD/git-cola/cola/cmdfactory.py", line 88, in run
    return self.do(signal, *args, **opts)
  File "/mnt/data/BUILD/git-cola/cola/cmdfactory.py", line 97, in do
    ok, result = self._do(cmdobj)
  File "/mnt/data/BUILD/git-cola/cola/cmdfactory.py", line 104, in _do
    result = cmdobj.do()
  File "/mnt/data/BUILD/git-cola/cola/cmds.py", line 467, in do
    self.model.set_commitmsg(utils.slurp(self.path))
  File "/mnt/data/BUILD/git-cola/cola/utils.py", line 209, in slurp
    fh = open(core.encode(path))
  File "/mnt/data/BUILD/git-cola/cola/core.py", line 36, in encode
    return unenc.encode('utf-8', 'replace')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 38: ordinal not in range(128)
[chris@linuxbox csync]$

Comment 13 Fedora Update System 2011-04-20 03:23:29 UTC
git-cola-1.4.3.2-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 David Aguilar 2011-04-23 03:50:14 UTC
Additional testing found a few more fixes for this bug.  They are available in the v1.4.3.3 tag and tarball.

http://cola.tuxfamily.org/releases/cola-1.4.3.3.tar.gz

Comment 15 Kevin Kofler 2011-04-23 15:23:43 UTC
1.4.3.3 is now queued for updates-testing, see tracking bug 699123.

Meanwhile, 1.4.3.2 is now queued for stable.

Comment 16 Christian Jann 2011-04-23 18:44:08 UTC
davvid could you please test the following commands, do you see the same like I?

[chris@linuxbox git-cola]$ git pull
Already up-to-date.
[chris@linuxbox git-cola]$ git log -n 1
commit ada59fa9521b120ed8b6a97b68c8c8a2789120ba
Author: David Aguilar <davvid>
Date:   Sat Apr 23 00:21:14 2011 -0700

    doc: Document the --prompt option and fix a typo.
    
    Signed-off-by: David Aguilar <davvid>
[chris@linuxbox git-cola]$ cd ..
[chris@linuxbox BUILD]$ mkdir testöüäÖÜÄß
[chris@linuxbox BUILD]$ cd testöüäÖÜÄß/
[chris@linuxbox testöüäÖÜÄß]$ git init
Initialized empty Git repository in /mnt/data/BUILD/testöüäÖÜÄß/.git/
[chris@linuxbox testöüäÖÜÄß]$ ../git-cola/bin/git-cola 
Traceback (most recent call last):
  File "/mnt/data/BUILD/git-cola/cola/main.py", line 232, in run
    model.update_status()
  File "/mnt/data/BUILD/git-cola/cola/models/main.py", line 306, in update_status
    self._update_files()
  File "/mnt/data/BUILD/git-cola/cola/models/main.py", line 324, in _update_files
    staged_only=staged_only)
  File "/mnt/data/BUILD/git-cola/cola/gitcmds.py", line 458, in worktree_state_dict
    tracked = tracked_branch()
  File "/mnt/data/BUILD/git-cola/cola/gitcmds.py", line 145, in tracked_branch
    branch = current_branch()
  File "/mnt/data/BUILD/git-cola/cola/gitcmds.py", line 67, in current_branch
    data = _read_git_head(head)
  File "/mnt/data/BUILD/git-cola/cola/gitcmds.py", line 90, in _read_git_head
    data = utils.slurp(head).rstrip()
  File "/mnt/data/BUILD/git-cola/cola/utils.py", line 209, in slurp
    fh = open(core.encode(path))
  File "/mnt/data/BUILD/git-cola/cola/core.py", line 36, in encode
    return unenc.encode('utf-8', 'replace')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
[chris@linuxbox testöüäÖÜÄß]$ 

the last 6 lines are uninteresting for this bug

I don't know about python but Google gives a lot about these errors
http://docs.python.org/howto/unicode.html (I would try the latin-1 encoding if ascii does not work)
http://stackoverflow.com/questions/447107/whats-the-difference-between-encode-decode-python-2-x
http://www.daniweb.com/software-development/python/threads/258139

I don't need this bug to be fixed, but it is only a manner of time until the next will stumble upon it.

Comment 17 David Aguilar 2011-04-23 19:14:04 UTC
Created attachment 494452 [details]
handle unicode in repo paths for the git init case

Okay, here's a patch to fix the "git init" example.  The next cola release will include this.

Comment 18 David Aguilar 2011-04-23 19:15:39 UTC
Christian, I just pushed another fix to github.  I'd like wait at least another week before creating v1.4.3.4 so that we can roll in other fixes in the meantime.  Thanks for your help!

Comment 19 Christian Jann 2011-04-23 19:36:17 UTC
YES, this fixes the last one, but I've found the next (I don't know at the moment how to get a minimal example but I will invest some more time if you need more info):
[chris@linuxbox csync_Christian_Kölpin]$ cd /home/chris/excluded/csync_Christian_Kölpin/csync
[chris@linuxbox csync]$ /mnt/data/BUILD/git-cola/bin/git-cola 
Traceback (most recent call last):
  File "/mnt/data/BUILD/git-cola/cola/views/main.py", line 274, in _update_callback
    merge_msg_path)
  File "/mnt/data/BUILD/git-cola/cola/notification.py", line 26, in broadcast
    self.emit(signal, *args, **opts)
  File "/mnt/data/BUILD/git-cola/cola/notification.py", line 32, in emit
    fxn(*args, **opts)
  File "/mnt/data/BUILD/git-cola/cola/cmdfactory.py", line 88, in run
    return self.do(signal, *args, **opts)
  File "/mnt/data/BUILD/git-cola/cola/cmdfactory.py", line 97, in do
    ok, result = self._do(cmdobj)
  File "/mnt/data/BUILD/git-cola/cola/cmdfactory.py", line 104, in _do
    result = cmdobj.do()
  File "/mnt/data/BUILD/git-cola/cola/cmds.py", line 467, in do
    self.model.set_commitmsg(utils.slurp(self.path))
  File "/mnt/data/BUILD/git-cola/cola/utils.py", line 209, in slurp
    fh = open(core.encode(path))
  File "/mnt/data/BUILD/git-cola/cola/core.py", line 36, in encode
    return unenc.encode('utf-8', 'replace')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 38: ordinal not in range(128)

Comment 20 Fedora Update System 2011-04-23 20:48:00 UTC
git-cola-1.4.3.2-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2011-04-23 20:50:29 UTC
git-cola-1.4.3.2-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 22 David Aguilar 2011-04-23 21:23:53 UTC
Thanks Christian.  I was able to reproduce the latest one by doing "touch .git/MERGE_MSG".  I pushed a fix to github.  Thanks again.

Comment 23 Christian Jann 2011-04-23 21:38:05 UTC
After clicking around no crashes so far, I'm happy now. I think we could close this bug now. (Or keep it open for a week, just to be sure)