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

Test failures on Python 3.6.5 #37

Open
alex3kov opened this issue Apr 24, 2018 · 4 comments · May be fixed by #74
Open

Test failures on Python 3.6.5 #37

alex3kov opened this issue Apr 24, 2018 · 4 comments · May be fixed by #74

Comments

@alex3kov
Copy link

dex --test
**********************************************************************
File "/usr/bin/dex", line 389, in __main__.Application._build_cmd
Failed example:
    Application._build_cmd('"gvim test" test2 "test \\" 3"')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.6/doctest.py", line 1330, in __run
        compileflags, 1), test.globs)
      File "<doctest __main__.Application._build_cmd[4]>", line 1, in <module>
        Application._build_cmd('"gvim test" test2 "test \\" 3"')
      File "/usr/bin/dex", line 501, in _build_cmd
        raise ApplicationExecException('Exec value contains an unbalanced number of quote characters.')
    ApplicationExecException: 'Exec value contains an unbalanced number of quote characters.'
**********************************************************************
File "/usr/bin/dex", line 391, in __main__.Application._build_cmd
Failed example:
    Application._build_cmd(r'"test \\\\ \" moin" test')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.6/doctest.py", line 1330, in __run
        compileflags, 1), test.globs)
      File "<doctest __main__.Application._build_cmd[5]>", line 1, in <module>
        Application._build_cmd(r'"test \\\\ \" moin" test')
      File "/usr/bin/dex", line 501, in _build_cmd
        raise ApplicationExecException('Exec value contains an unbalanced number of quote characters.')
    ApplicationExecException: 'Exec value contains an unbalanced number of quote characters.'
**********************************************************************
File "/usr/bin/dex", line 393, in __main__.Application._build_cmd
Failed example:
    Application._build_cmd(r'"gvim \\\\ \`test\$"')
Expected:
    ['gvim \\ `test$']
Got:
    ['gvim \\\\ \\`test\\$']
**********************************************************************
1 items had failures:
   3 of  25 in __main__.Application._build_cmd
***Test Failed*** 3 failures.
@tardypad
Copy link

Not sure if it is related to the actual same failing tests or if this another not covered case

Exec=termite --exec "vim '\"yo\"'"

This is valid according to desktop-file-validate utility
but also raise the following error with dex
'Exec value contains an unbalanced number of quote characters.'

Using Python 3.6.6

tardypad added a commit to tardypad/dotfiles that referenced this issue Jul 27, 2018
Those desktop files are valid according to desktop-file-validate
but dex reports a quoting issue
see jceb/dex#37

(not quoting the tmux command should be fined for those)
@jceb
Copy link
Owner

jceb commented Sep 29, 2019

Thanks for reporting. I'll look into it .. there seem to be some differences with python3.

@jceb
Copy link
Owner

jceb commented Aug 8, 2024

I disabled the failing tests for the moment. Couldn't figure out what the issue was :-/

@reporter123
Copy link

reporter123 commented Jan 20, 2025

It looks python 3.6+ automatically processes escape sequences when looping through the characters in a string with:

   for c in _tmp:
    ...

Using a numeric index bypasses this behavior.

This appears to be a false lead on further review.

After testing with both versions of the loop I discovered a bug in dex. The escape sequence detection is turned off inside strings that appends '\' to the second parameter and makes the code interpret the escaped quote as an un-escaped one.

@reporter123 reporter123 linked a pull request Jan 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants