<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>41958</bug_id>
          
          <creation_ts>2022-02-15 18:02:08 +0300</creation_ts>
          <short_desc>Rust builds with non-LFS functions on 32-bit arches</short_desc>
          <delta_ts>2022-02-20 09:21:03 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rust</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vitaly Chikunov">vt</reporter>
          <assigned_to name="Сергей Жидких">rx1513</assigned_to>
          <cc>iv</cc>
    
    <cc>ldv</cc>
    
    <cc>legion</cc>
    
    <cc>rauty</cc>
    
    <cc>rx1513</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>207798</commentid>
    <comment_count>0</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-02-15 18:02:08 +0300</bug_when>
    <thetext>Impossible to enable `%set_verify_elf_method strict` for Rust packages because rustc builds with non-LFS functions on 32-bit architectures. For example Firefox:

https://git.altlinux.org/beehive/logs/Sisyphus-i586/latest/success/firefox-97.0-alt1
  verify-elf: WARNING: ./usr/lib/firefox/libxul.so: uses non-LFS functions: fallocate fcntl fopen fstat fstatfs ftruncate getrlimit glob globfree lseek lstat mkstemp mmap open openat posix_fadvise posix_fallocate pread pwrite readdir setrlimit stat statfs</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>208010</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Gladkov">legion</who>
    <bug_when>2022-02-19 18:46:26 +0300</bug_when>
    <thetext>Ничего не понятно, но спасибо на багрепорт.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>208019</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Gladkov">legion</who>
    <bug_when>2022-02-19 22:09:46 +0300</bug_when>
    <thetext>$ rustc -vV
rustc 1.58.1
binary: rustc
commit-hash: unknown
commit-date: unknown
host: i686-unknown-linux-gnu
release: 1.58.1
LLVM version: 12.0.1

$ cat &gt;main.rs
use std::fs;

fn main() -&gt; std::io::Result&lt;()&gt; {
    let metadata = match fs::metadata(&quot;foo.txt&quot;) {
        Err(why) =&gt; panic!(&quot;couldn&apos;t open: {}&quot;, why),
        Ok(file) =&gt; file,
    };
    print!(&quot;len: {}\n&quot;,  metadata.len());
    Ok(())
}

$ rustc main.rs

$ truncate -s 6E foo.txt

$ ./main 
len: 6917529027641081856

$ nm main |grep -o &apos;U open.*&apos;
U open64@GLIBC_2.1
U open@GLIBC_2.0

$ nm main |grep -o &apos;U .*stat.*&apos;
U fstat64@GLIBC_2.33
U stat64@GLIBC_2.33</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>208020</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Gladkov">legion</who>
    <bug_when>2022-02-19 22:12:56 +0300</bug_when>
    <thetext>$ strace -f -e trace=file ./main 
execve(&quot;./main&quot;, [&quot;./main&quot;], 0xffa21b1c /* 17 vars */) = 0
access(&quot;/etc/ld.so.preload&quot;, R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, &quot;/etc/ld.so.cache&quot;, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
statx(3, &quot;&quot;, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=5695, ...}) = 0
openat(AT_FDCWD, &quot;/lib/libgcc_s.so.1&quot;, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
statx(3, &quot;&quot;, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=127880, ...}) = 0
openat(AT_FDCWD, &quot;/lib/libc.so.6&quot;, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
statx(3, &quot;&quot;, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=2002476, ...}) = 0
openat(AT_FDCWD, &quot;/proc/self/maps&quot;, O_RDONLY|O_CLOEXEC) = 3
statx(3, &quot;&quot;, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=0, ...}) = 0
statx(0, NULL, AT_STATX_SYNC_AS_STAT, STATX_ALL, NULL) = -1 EFAULT (Bad address)
statx(AT_FDCWD, &quot;foo.txt&quot;, AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=6917529027641081856, ...}) = 0
len: 6917529027641081856
+++ exited with 0 +++

$ grep -c statx /usr/lib/rpm/verify-elf-non-lfs-funcs.list
0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>208021</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Gladkov">legion</who>
    <bug_when>2022-02-19 22:33:23 +0300</bug_when>
    <thetext>Ещё для наглядности:

$ cat main.rs 
use std::fs::File;

fn main() {
    let file = match File::open(&quot;foo.txt&quot;) {
        Err(why) =&gt; panic!(&quot;couldn&apos;t open: {}&quot;, why),
        Ok(file) =&gt; file,
    };
    let metadata = match file.metadata() {
        Err(why) =&gt; panic!(&quot;couldn&apos;t get metadata: {}&quot;, why),
        Ok(file) =&gt; file,
    };
    print!(&quot;len: {}\n&quot;,  metadata.len());
}

$ strace -f ./main 2&gt;&amp;1 |grep foo.txt 
openat(AT_FDCWD, &quot;foo.txt&quot;, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>208023</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2022-02-20 00:05:38 +0300</bug_when>
    <thetext>$ for f in /usr/lib/rustlib/i686-unknown-linux-gnu/lib/lib*.rlib; do nm &quot;$f&quot; 2&gt;/dev/null |grep -E &quot;U ($(tr &apos;\n&apos; &apos;|&apos; &lt; /usr/lib/rpm/verify-elf-non-lfs-funcs.list))$&quot; &amp;&amp; echo &quot;$f&quot;; done
         U fcntl
         U mmap
         U sendfile
         U fcntl
         U mmap
         U open
         U openat
/usr/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-689d71722d0c29bf.rlib

$ rpmquery -f /usr/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-689d71722d0c29bf.rlib
rust-1.58.1-alt1.i586</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>