copr icon indicating copy to clipboard operation
copr copied to clipboard

rpmbuild: avoid the ugly traceback if --task-url combined with -r

Open praiskup opened this issue 1 year ago • 2 comments

Copy-pasted from: https://bugzilla.redhat.com/show_bug.cgi?id=2319907

You can reproduce this build on your computer by running:

sudo dnf install copr-rpmbuild
/usr/bin/copr-rpmbuild --task-url https://copr.fedorainfracloud.org/coprs/solomoncyj/SVT-AV1-PSY/build/8156386/ -r /etc/mock/fedora-rawhide-x86_64-rpmfusion_nonfree.cfg

praiskup: this is invalid input, but we should validate it and provide a reasonable error output.

Version: 1.0
PID: 126276
Logging PID: 126277

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/home/solomoncyj/.local/lib/python3.13/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/home/solomoncyj/.local/lib/python3.13/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ~~~~~~~~~~~~~~~^^^
  File "/home/solomoncyj/.local/lib/python3.13/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/copr-rpmbuild", line 136, in main
    action(args, config)
    ~~~~~~^^^^^^^^^^^^^^
  File "/usr/bin/copr-rpmbuild", line 256, in build_rpm
    task = get_task(args, config, build_config_url_path, task_id)
  File "/usr/bin/copr-rpmbuild", line 185, in get_task
    task.update(get_vanilla_build_config(args.task_url))
                ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/bin/copr-rpmbuild", line 315, in get_vanilla_build_config
    build_config = response.json()
  File "/usr/lib/python3.13/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

Reproducible: Always

praiskup avatar Oct 21 '24 09:10 praiskup

either those should be mutually exclusive ~~or give nice traceback~~

nikromen avatar Oct 25 '24 11:10 nikromen

.. or -r should override the chroot from given task. Nb. -r should not accept nonexisting files.

praiskup avatar Oct 25 '24 15:10 praiskup