Skip to content

ValueError: Sample larger than population or is negative #34

Description

@Neolex-Security

Hello !
I have an issue with interlace...
When I run my script using interlace from my user there is no issues, but when my cronjob run it I got this error message :

==============================================
Interlace v1.3.3	by Michael Skelton (@codingo_)
==============================================
Traceback (most recent call last):
  File "/usr/local/bin/interlace", line 11, in <module>
    load_entry_point('Interlace==1.3.3', 'console_scripts', 'interlace')()
  File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/interlace.py", line 24, in main
  File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/interlace.py", line 10, in build_queue
  File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/lib/core/input.py", line 190, in process_commands
  File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/lib/core/input.py", line 69, in _replace_variable_for_commands
  File "/usr/lib/python3.6/random.py", line 320, in sample
    raise ValueError("Sample larger than population or is negative")
ValueError: Sample larger than population or is negative

Do you have an idea from where it comes ?
Thanks

Activity

  1. hakluke commented on Apr 11, 2019

    @hakluke
    Collaborator

    Hey @Neolex-Security,
    I've also come across this. The error occurs when the targets file is empty. To reproduce:

    luke@b:/tmp$ echo "" > targets.txt
    luke@b:/tmp$ interlace -threads 10 -tL ./targets.txt -c "echo _target_"
    ==============================================
    Interlace v1.3.3	by Michael Skelton (@codingo_)
    ==============================================
    Traceback (most recent call last):
      File "/usr/local/bin/interlace", line 11, in <module>
        load_entry_point('Interlace==1.3.3', 'console_scripts', 'interlace')()
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/interlace.py", line 24, in main
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/interlace.py", line 10, in build_queue
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/lib/core/input.py", line 190, in process_commands
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.3.3-py3.6.egg/Interlace/lib/core/input.py", line 69, in _replace_variable_for_commands
      File "/usr/lib/python3.6/random.py", line 320, in sample
        raise ValueError("Sample larger than population or is negative")
    ValueError: Sample larger than population or is negative
    luke@b:/tmp$ 
    

    In a way, this is user error as this command wouldn't achieve anything anyway, however it would be nice to catch this exception and display a more descriptive error to avoid confusion.

  2. self-assigned this
    on Apr 11, 2019
  3. prodigysml commented on Apr 11, 2019

    @prodigysml
    Collaborator

    I'll try and look into this issue soon.

  4. prodigysml commented on Apr 12, 2019

    @prodigysml
    Collaborator

    Thanks for the steps to reproduce @hakluke ! Really helped in finding the issue quickly. Exception will now be raised.

  5. codingo commented on Apr 12, 2019

    @codingo
    Owner

    Hi @Neolex-Security, this is now fixed in 1.3.4 (release tag) - if you update you should no longer have this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions