Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 212118 Details for
Bug 295805
sys-apps/portage-2.2_rc54[python3]: bytes/str mixing during "global updates on /etc/portage/package.*"
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bytes/str mixing fix in pym.portage.update.update_config_files(...)
portage-2.2_rc54-python3.patch (text/plain), 2.63 KB, created by
Nikolay Orlyuk
on 2009-12-05 10:01:04 UTC
(
hide
)
Description:
bytes/str mixing fix in pym.portage.update.update_config_files(...)
Filename:
MIME Type:
Creator:
Nikolay Orlyuk
Created:
2009-12-05 10:01:04 UTC
Size:
2.63 KB
patch
obsolete
>--- portage-2.2_rc43/pym/portage/update.py.orig 2009-09-25 06:29:54.000000000 +0300 >+++ portage-2.2_rc43/pym/portage/update.py 2009-12-05 11:38:46.000000000 +0200 >@@ -185,45 +185,53 @@ > protect_mask - list of paths from CONFIG_PROTECT_MASK > update_iter - list of update commands as returned from parse_updates()""" > >- config_root = normalize_path(config_root) >+ def decodeFS(y): >+ return (_unicode_decode(y, encoding=_encodings['fs'], errors='strict')) >+ >+ def encodeFS(x): >+ return (_unicode_encode(x, encoding=_encodings['fs'], errors='strict')) >+ >+ # os.path.* and normalize_path works with fs-encoded >+ # so combine only fs-encoded pathnames >+ config_root = normalize_path(encodeFS(config_root)) > update_files = {} > file_contents = {} > myxfiles = ["package.mask", "package.unmask", \ > "package.keywords", "package.use"] > myxfiles += [os.path.join("profile", x) for x in myxfiles] >- abs_user_config = os.path.join(config_root, USER_CONFIG_PATH) >- recursivefiles = [] >+ myxfiles = [encodeFS(x) for x in myxfiles] >+ abs_user_config = os.path.join(config_root, encodeFS(USER_CONFIG_PATH)) >+ recursivefiles = [] # pairs of (bytes, string) > for x in myxfiles: > config_file = os.path.join(abs_user_config, x) > if os.path.isdir(config_file): > for parent, dirs, files in os.walk(config_file): > for y in dirs: >+ # do not descent to hidden folders or those with wrong name encoding > try: >- y = _unicode_decode(y, >- encoding=_encodings['fs'], errors='strict') >+ y_decoded = decodeFS(y) > except UnicodeDecodeError: > dirs.remove(y) > continue >- if y.startswith("."): >+ if y_decoded.startswith("."): > dirs.remove(y) > for y in files: >+ # add only visible files with right name encoding > try: >- y = _unicode_decode(y, >- encoding=_encodings['fs'], errors='strict') >+ y_decoded = decodeFS(y) > except UnicodeDecodeError: > continue >- if y.startswith("."): >+ if y_decoded.startswith("."): > continue >- recursivefiles.append( >- os.path.join(parent, y)[len(abs_user_config) + 1:]) >+ y = os.path.join(parent, y)[len(abs_user_config) + 1:] >+ recursivefiles.append((y, decodeFS(y))) > else: >- recursivefiles.append(x) >+ recursivefiles.append((x, decodeFS(x))) > myxfiles = recursivefiles >- for x in myxfiles: >+ for (x, y) in myxfiles: > try: >- file_contents[x] = codecs.open( >- _unicode_encode(os.path.join(abs_user_config, x), >- encoding=_encodings['fs'], errors='strict'), >+ file_contents[y] = codecs.open( >+ os.path.join(abs_user_config, x), > mode='r', encoding=_encodings['content'], > errors='replace').readlines() > except IOError:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 295805
:
212118
|
212189