your-tools/pycp

-g flag crashes pycp

15bitgames opened this issue · 5 comments

When I do pycp -g (directory) (directory) I get the following:

Traceback (most recent call last):
  File "/usr/sbin/pycp", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/pycp/main.py", line 114, in main
    errors = transfer_manager.do_transfer()
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 354, in do_transfer
    error = ftm.do_transfer()
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 188, in do_transfer
    self.transfer_file()
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 229, in transfer_file
    self.callback(transfered)
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 339, in on_file_transfer
    self.progress_indicator.on_progress(progress)
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 517, in on_progress
    self._render_second_line(progress)
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 511, in _render_second_line
    filename=progress.src,
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 391, in render
    length, string = component.render(kwargs)
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 252, in render
    return len(text), text
TypeError: object of type 'NoneType' has no len()

Oops.
Looks like I managed to create a race condition in a single-threaded program ;)

Glad I could help :)

Just to let you know the crash only happens for me on Voidlinux system which uses an AMD Ryzen 1800x. Updated to the latest on debian via pip and it runs fine (thats an AMD A8 APU).

Actually it had nothing to do with a race condition :)
I just failed to preserve the indentation when I move the code for shorten_path from one file to the other.
And I also forgot about those doctests tests.

Should be fixed not. Feel free to take a look at the pull request

cheers will try it out :)