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

When provided an invalid display name CLI argument, xpra throws IndexError: string index out of range #3820

Closed
audibleptr opened this issue Apr 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@audibleptr
Copy link

audibleptr commented Apr 10, 2023

Describe the bug
When provided an invalid display name CLI argument (which may happen accidentally), xpra throws IndexError: string index out of range.

This may not be strictly a bug, but it would be better if xpra provided a more easily understandable error message to the user.

To Reproduce

xpra stop :

System Information:

  • Server OS:
    # uname -a
    Linux kworkstation-10-20230406.localdomain 5.15.104-un-def-alt1 #1 SMP PREEMPT Tue Mar 28 17:27:40 UTC 2023 x86_64 GNU/Linux
    
  • Client OS: n/a (not used)
  • Xpra Server Version:
    # rpm -qa | grep xpra
    xpra-4.4.4-alt2.x86_64
    
  • Xpra Client Version: n/a (not used)

Additional context

Actual result:

xpra main error:
Traceback (most recent call last):
  File "/usr/lib64/python3/site-packages/xpra/scripts/main.py", line 144, in main
    return run_mode(script_file, cmdline, err, options, args, mode, defaults)
  File "/usr/lib64/python3/site-packages/xpra/scripts/main.py", line 453, in run_mode
    return do_run_mode(script_file, cmdline, error_cb, options, args, mode, defaults)
  File "/usr/lib64/python3/site-packages/xpra/scripts/main.py", line 500, in do_run_mode
    return run_stopexit(mode, error_cb, options, args, cmdline)
  File "/usr/lib64/python3/site-packages/xpra/scripts/main.py", line 2776, in run_stopexit
    display_desc = pick_display(error_cb, opts, extra_args, cmdline)
  File "/usr/lib64/python3/site-packages/xpra/scripts/main.py", line 816, in pick_display
    return do_pick_display(dotxpra, error_cb, opts, extra_args, cmdline)
  File "/usr/lib64/python3/site-packages/xpra/scripts/main.py", line 849, in do_pick_display
    return parse_display_name(error_cb, opts, extra_args[0], cmdline, find_session_by_name=find_session_by_name)
  File "/usr/lib64/python3/site-packages/xpra/scripts/parsing.py", line 420, in parse_display_name
    while display_name[pos]=="/" and scount<2:
IndexError: string index out of range

Expected result: An error that is more easily understandable to the user.

@audibleptr audibleptr added the bug Something isn't working label Apr 10, 2023
@totaam
Copy link
Collaborator

totaam commented Apr 10, 2023

Thanks, the commit above fixes that.

@totaam totaam closed this as completed Apr 10, 2023
totaam added a commit that referenced this issue Apr 13, 2023
@totaam
Copy link
Collaborator

totaam commented Apr 13, 2023

I had fat fingered the commit, fixed properly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants