Bug 2250188 - [abrt] rust2rpm: local_toml_file(): crate.py:62:local_toml_file:AssertionError
Summary: [abrt] rust2rpm: local_toml_file(): crate.py:62:local_toml_file:AssertionError
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rust2rpm
Version: rawhide
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rust SIG
QA Contact:
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:76dad3cbc8d0f0a9889975c74b4...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-11-16 21:31 UTC by Petr Menšík
Modified: 2023-12-01 16:18 UTC (History)
3 users (show)

Fixed In Version: rust2rpm-25.0.3-1.fc40
Clone Of:
Environment:
Last Closed: 2023-12-01 16:18:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: namespaces (171 bytes, text/plain)
2023-11-16 21:31 UTC, Petr Menšík
no flags Details
File: cpuinfo (2.98 KB, text/plain)
2023-11-16 21:31 UTC, Petr Menšík
no flags Details
File: open_fds (325 bytes, text/plain)
2023-11-16 21:31 UTC, Petr Menšík
no flags Details
File: environ (3.43 KB, text/plain)
2023-11-16 21:31 UTC, Petr Menšík
no flags Details
File: os_info (734 bytes, text/plain)
2023-11-16 21:32 UTC, Petr Menšík
no flags Details
File: mountinfo (4.09 KB, text/plain)
2023-11-16 21:32 UTC, Petr Menšík
no flags Details
File: backtrace (1.32 KB, text/plain)
2023-11-16 21:32 UTC, Petr Menšík
no flags Details

Description Petr Menšík 2023-11-16 21:31:48 UTC
Description of problem:
Specified invalid cargo name as used for golang usually.

Version-Release number of selected component:
rust2rpm-25.0.1-1.fc37

Additional info:
reporter:       libreport-2.17.11
comment:        Specified invalid cargo name as used for golang usually.
reason:         crate.py:62:local_toml_file:AssertionError
cgroup:         0::/user.slice/user-100616.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-7cf0ea2d-e714-4d62-8a5a-31a0e98a7c02.scope
executable:     /usr/bin/rust2rpm
kernel:         6.5.5-100.fc37.x86_64
crash_function: local_toml_file
cmdline:        /usr/bin/python3 -sP /usr/bin/rust2rpm https://github.com/NLnetLabs/octseq
interpreter:    python3-3.11.6-1.fc37.x86_64
package:        rust2rpm-25.0.1-1.fc37
type:           Python3
uid:            100616
exception_type: AssertionError
runlevel:       N 5

Truncated backtrace:
crate.py:62:local_toml_file:AssertionError

Traceback (most recent call last):
  File "/usr/bin/rust2rpm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rust2rpm/__main__.py", line 50, in main
    project, version, diffs, metadata, doc_files, license_files, is_local, vendor_tarball = process_project(
                                                                                            ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rust2rpm/crate.py", line 268, in process_project
    name, version, diffs, metadata, doc_files, license_files, vendor_tarball = process_project_local(
                                                                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rust2rpm/crate.py", line 181, in process_project_local
    toml_path, doc_files, license_files = local_toml_file(project)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rust2rpm/crate.py", line 62, in local_toml_file
    assert os.path.isfile(toml_path)
AssertionError

Local variables in innermost frame:
toml_path: 'https://github.com/NLnetLabs/octseq'

Comment 1 Petr Menšík 2023-11-16 21:31:52 UTC
Created attachment 1999904 [details]
File: namespaces

Comment 2 Petr Menšík 2023-11-16 21:31:54 UTC
Created attachment 1999905 [details]
File: cpuinfo

Comment 3 Petr Menšík 2023-11-16 21:31:56 UTC
Created attachment 1999906 [details]
File: open_fds

Comment 4 Petr Menšík 2023-11-16 21:31:58 UTC
Created attachment 1999907 [details]
File: environ

Comment 5 Petr Menšík 2023-11-16 21:32:00 UTC
Created attachment 1999908 [details]
File: os_info

Comment 6 Petr Menšík 2023-11-16 21:32:02 UTC
Created attachment 1999909 [details]
File: mountinfo

Comment 7 Petr Menšík 2023-11-16 21:32:04 UTC
Created attachment 1999910 [details]
File: backtrace

Comment 8 Petr Menšík 2023-11-16 21:34:31 UTC
I would expect nicer error message instead of just assertion error. It makes it unclear that I used it wrong way.

Comment 9 Fabio Valentini 2023-11-16 21:52:01 UTC
Hm, yeah. Passing something that's neither a crate name, nor a directory, nor a file path is unexpected.

Do you think it would make sense to convert the "else" case here to a check for "elif os.path.isfile" instead, and make the "else" case an error instead?
https://pagure.io/fedora-rust/rust2rpm/blob/main/f/rust2rpm/crate.py#_177-182

PS: If you're working on updating an existing package, then you don't need to pass any argument at all. If missing, the crate name is autodetected from any "rust-*.spec" files in the current working directory (or the name of the current working directory, if no "rust-*.spec" file exists yet).

Comment 10 Fabio Valentini 2023-11-16 21:55:05 UTC
> Specified invalid cargo name as used for golang usually.

I also don't really understand why you expect rust2rpm to behave exactly like go2rpm - these are ecosystems that work in diametrically opposed ways. Golang has no registry whatsoever and everything is a URL only, whereas Rust has a central registry where everything is identified by name, and it is impossible for any package uploaded there to reference projects via git URL.

Comment 11 Aoife Moloney 2023-11-23 01:52:58 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 12 Fabio Valentini 2023-11-29 15:56:12 UTC
I have refactored the code in question to do better error handling:
https://pagure.io/fedora-rust/rust2rpm/c/323dbea4b6dbfe60f650ab654dfc7f16f3aad9e4?branch=main

This will be part of the next rust2rpm release.

Comment 13 Fedora Update System 2023-12-01 16:16:11 UTC
FEDORA-2023-3565972927 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-3565972927

Comment 14 Fedora Update System 2023-12-01 16:18:46 UTC
FEDORA-2023-3565972927 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.