Skip to content
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

cylc reg "[\n]\0 \/\/ exit" #2281

Closed
oliver-sanders opened this issue May 12, 2017 · 8 comments
Closed

cylc reg "[\n]\0 \/\/ exit" #2281

oliver-sanders opened this issue May 12, 2017 · 8 comments
Labels
bug Something is wrong :( superseded

Comments

@oliver-sanders
Copy link
Member

Currently cylc will let you register suites with unsafe characters. My favourites are:

  • Empty string
  • Backquotes
  • New lines, tab, null characters
@oliver-sanders oliver-sanders added the bug Something is wrong :( label May 12, 2017
@oliver-sanders oliver-sanders added this to the soon milestone May 12, 2017
@dvalters
Copy link
Contributor

dvalters commented May 12, 2017

(From earlier office discussion)

One option: Python string methods: isalpha(), isdigit(), isalnum() will test a character is alpha/number/alphanumeric. This also works on unicode strings, and (it would appear) on non-latin alphabets characters.

chinese_string = u'中文。'
for char in chinese_string: print char, char.isalpha()
    
# > 中 True
# > 文 True
# > 。 False

# German
german_string = u'„Hallo! Grüß dich 666!“'
for char in german_string: print char, char.isalnum()

# true for all the letters, including non-English ones, false for all others.
# etc...

Example here:

https://github.com/dvalters/Notebooks/blob/master/is_it_a_letter.ipynb

@matthewrmshin
Copy link
Contributor

In theory, we should be able to get re.compile(ur'\w', re.U) to match Unicode word characters. This didn't work in my environment the last time I looked (when I was working to white list the allowed characters for task names). I have just taken a look in my environment, and it seems to be working now! I'll see if I can repeat this success in a different environment, so we can modify the logic for matching task names as well.

@dvalters
Copy link
Contributor

...I couldn't get that regex to work either

@matthewrmshin
Copy link
Contributor

I think we should revisit this one when we port cylc to Python 3 - #1874, when we can be sure that all strings are automatically Unicode.

@matthewrmshin
Copy link
Contributor

See also #51.

This was referenced Mar 7, 2019
@oliver-sanders
Copy link
Member Author

We may want to roll this one into #2979

@matthewrmshin
Copy link
Contributor

Please close. (The originator of this issue can do the honour.)

@oliver-sanders
Copy link
Member Author

Superseded by the more generic #2979

@matthewrmshin matthewrmshin removed this from the soon milestone Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :( superseded
Projects
None yet
Development

No branches or pull requests

3 participants