Project

General

Profile

Bug #14626

Ceph CLI + python bindings restrict string inputs to ASCII, but mon doesn't

Added by John Spray about 8 years ago. Updated over 4 years ago.

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.


Related issues

Duplicated by Ceph - Bug #41894: ceph_argparse: UnicodeEncodeError: 'ascii' codec can't encode... Duplicate 09/17/2019

History

#1 Updated by John Spray about 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

#2 Updated by Sebastian Wagner over 4 years ago

  • Duplicated by Bug #41894: ceph_argparse: UnicodeEncodeError: 'ascii' codec can't encode... added

#3 Updated by Sebastian Wagner over 4 years ago

  • Status changed from New to 12

#4 Updated by Sebastian Wagner over 4 years ago

  • Description updated (diff)

#5 Updated by Patrick Donnelly over 4 years ago

  • Status changed from 12 to New

Also available in: Atom PDF