Re: rpmbuild problem with rust code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/26/24 1:41 PM, Richard W.M. Jones wrote:
> It's a bit unfortunate that Rust used the shebang syntax here,
> although in practice they couldn't be confused as these files
> shouldn't ever be executable.

It's _possible_ to play comment tricks for executable rust scripts,
because rustc allows and ignores actual shebang lines.

#!/bin/bash -e
#![cfg(unix)] /* (any attribute as a shell comment)
# shell here to self-compile
rustc "$0" -o ./foo
exec ./foo "$@"
(end rust comment) */
// continue in rust here
fn main() { ... }

There is also a real "cargo script" feature in development:
https://github.com/rust-lang/cargo/issues/12207

> It's also correct that RPM worries about this file since it is
> installed (in debuginfo) and appears to contain a shebang.
> 
>> Is there a way to tell rpmbuild not to worry about this?
> 
> rust.spec has this in %prep, and /usr/lib/rpm/redhat/brp-mangle-shebangs
> only seems to care about executable files, so this should help:
> 
>   # Sometimes Rust sources start with #![...] attributes, and "smart" editors think
>   # it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
>   find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'

I may have to make that smarter if "cargo script" gets used.

For now though, clearing everything should be fine.
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux