Actions
Bug #14626
openCeph CLI + python bindings restrict string inputs to ASCII, but mon doesn't
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:
0%
Source:
other
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
CephString.__init__
does this:
self.goodset = frozenset(
[c for c in printable if re.match(goodchars, c)]
)
('printable' is a python constant that is printable ascii chars)
Multiple interlocked issues here:
1. If we really forbid non-ascii, the check belongs in the mon where it can't be circumvented, not in the python bindings.
2. We shouldn't forbid non-ascii characters. client.björn should be valid (even domain names support unicode these days)
3. If someone submits non-ascii input, currently they get a UnicodeEncodeError like this:
ceph auth get-or-create "client.Björn" *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** 2016-02-03 11:50:45.769856 7fa828d76700 0 lockdep start 2016-02-03 11:50:45.770757 7fa828d76700 -1 WARNING: the following dangerous and experimental features are enabled: * 2016-02-03 11:50:45.786774 7fa828d76700 -1 WARNING: the following dangerous and experimental features are enabled: * Traceback (most recent call last): File "./ceph", line 939, in <module> retval = main() File "./ceph", line 873, in main sigdict, inbuf, verbose) File "./ceph", line 407, in new_style_command valid_dict = validate_command(sigdict, cmdargs, verbose) File "/home/john/ceph/src/pybind/ceph_argparse.py", line 958, in validate_command matched = matchnum(args, sig, partial=True) File "/home/john/ceph/src/pybind/ceph_argparse.py", line 766, in matchnum validate_one(word, desc, partial and (len(words) == 0)) File "/home/john/ceph/src/pybind/ceph_argparse.py", line 737, in validate_one desc.instance.valid(word, partial) File "/home/john/ceph/src/pybind/ceph_argparse.py", line 211, in valid format(''.join(sset - self.goodset), s)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128)
...because the string formatting for the exception doesn't take account of the possibility that its arguments might be non-ascii.
Updated by John Spray over 8 years ago
- Subject changed from Ceph CLI restricts strings to ASCII, but mon doesn't to Ceph CLI + python bindings restrict string inputs to ASCII, but mon doesn't
Updated by Sebastian Wagner over 4 years ago
- Has duplicate Bug #41894: ceph_argparse: UnicodeEncodeError: 'ascii' codec can't encode... added
Actions