Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 838091 - sys-fs/safecopy-1.7 fails to compile: simulatorlb.c:40:1: error: unknown type name off64_t; did you mean off_t?
Summary: sys-fs/safecopy-1.7 fails to compile: simulatorlb.c:40:1: error: unknown type...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: James Le Cuirot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: musl-1.2.4
  Show dependency tree
 
Reported: 2022-04-12 14:55 UTC by Agostino Sarubbo
Modified: 2023-12-21 20:24 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,45.51 KB, text/plain)
2022-04-12 14:55 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-04-12 14:55:49 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: sys-fs/safecopy-1.7 fails to compile.
Discovered on: amd64 (internal ref: tinderbox_musl)

NOTE:
This machine uses MUSL libc
Comment 1 Agostino Sarubbo gentoo-dev 2022-04-12 14:55:52 UTC
Created attachment 770378 [details]
build.log

build log and emerge --info
Comment 2 Jonathan Lovelace 2023-09-13 21:42:12 UTC
I'm seeing similar errors (not the one about "O_RDONLY undeclared", just "unknown type name off64_t; did you mean off_t?" and warning "implicit declaration of function lseek64; did you mean lseek?") while making a new Gentoo install on a MacBook using glibc.

Since, from <sys/types.h> and <features.h>, "off64_t" is defined when _LARGEFILE64_SOURCE is set, and that macro is set when _GNU_SOURCE is set, maybe something used to cause _GNU_SOURCE to be defined (by default?) and no longer does? In any case, the file that causes the error is in a directory that the ebuild only causes to be built when USE=test, so the package at least builds if its tests are restricted.
Comment 3 James Le Cuirot gentoo-dev 2023-09-13 22:17:21 UTC
Okay, I had assumed this was just musl, which I don't have much time for, but you're right, I've just hit this with glibc too.
Comment 4 James Le Cuirot gentoo-dev 2023-09-14 08:08:49 UTC
This helps, but one test still fails.

diff -Naurw a/simulator/src/simulatorlb.c b/simulator/src/simulatorlb.c
--- a/simulator/src/simulatorlb.c       2009-07-28 15:31:16.000000000 +0100
+++ b/simulator/src/simulatorlb.c       2023-09-14 09:04:41.321398218 +0100
@@ -2,7 +2,7 @@
  * This file is copyright ©2009 Corvus Corax
  * Distributed under the terms of the GPL version 2 or higher
  */
-#define _FILE_OFFSET_BITS 64
+#define _LARGEFILE64_SOURCE
 #include <config.h>
 
 #ifdef USE_GNU_SOURCE


----


Running test 0:
Testing debug library functionality: FAILED
Details:
 Test if the test library gets loaded and works.
  Runnign cat on the virtual debug file should result in a 2048 byte file
  since that is the address of the first simulated IO error.
 Error: file /var/tmp/portage/sys-fs/safecopy-1.7/work/safecopy-1.7/test/tmpdir/test.dat has size 10240, should be 2048
 program reported:
 -- ... 
 -- simulator initialising - reading config simulator.cfg 
 -- simulator time granularity: 77 usecs 
 -- simulator everything shorter will be busy-waiting 
 -- simulator simulated blocksize: 1024 
 -- simulator simulated filesize: 10240 
 -- simulator opening data source: test.dat 
 -- simulator simulating hard error in block: 2 
 -- opening debug 
 -- closing debug

storing temporary files of failed test0 in
/var/tmp/portage/sys-fs/safecopy-1.7/work/safecopy-1.7/test/tmp_failed_test0
Comment 5 James Le Cuirot gentoo-dev 2023-09-16 08:58:41 UTC
The test seems flawed. The "simulator" behaviour only kicks in if the opened file is called "debug", but in this case, it's called "test.dat", so it just passes calls through to the normal functions.
Comment 6 James Le Cuirot gentoo-dev 2023-09-16 09:05:29 UTC
Ah, ignore the above, talking crap. What I have noticed though is it behaves differently if you output to a file vs if you pipe to wc.

> $ LD_PRELOAD='/var/tmp/portage/sys-fs/safecopy-1.7/work/safecopy-1.7/simulator/src/libsimulatorlb.so.1.0: ' cat debug > foo   
> simulator initialising - reading config simulator.cfg
> simulator time granularity: 231 usecs
> simulator everything shorter will be busy-waiting
> simulator simulated blocksize: 1024
> simulator simulated filesize: 10240
> simulator opening data source: test.dat
> simulator simulating hard error in block: 2
> opening debug
> closing debug

> $ LD_PRELOAD='/var/tmp/portage/sys-fs/safecopy-1.7/work/safecopy-1.7/simulator/src/libsimulatorlb.so.1.0: ' cat debug | wc -c
> simulator initialising - reading config simulator.cfg
> simulator time granularity: 93 usecs
> simulator everything shorter will be busy-waiting
> simulator simulated blocksize: 1024
> simulator simulated filesize: 10240
> simulator opening data source: test.dat
> simulator simulating hard error in block: 2
> opening debug
> reading from debug file: 131072 at position 0 shrinks due to upcoming failure and  reads 2048 bytes
> reading from debug file: 131072 at position 2048 simulated hard failure!
> cat: debug: Input/output error
> closing debug
> 2048
Comment 7 James Le Cuirot gentoo-dev 2023-09-16 09:10:18 UTC
Aha! With a file, it's using copy_file_range rather than read! XD
Comment 8 Larry the Git Cow gentoo-dev 2023-09-16 13:11:39 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=547998220914f0d2d7bbf9b4e0ae2335c7deb6c4

commit 547998220914f0d2d7bbf9b4e0ae2335c7deb6c4
Author:     James Le Cuirot <chewi@gentoo.org>
AuthorDate: 2023-09-16 13:09:52 +0000
Commit:     James Le Cuirot <chewi@gentoo.org>
CommitDate: 2023-09-16 13:10:39 +0000

    sys-fs/safecopy: Fix test issues, EAPI 8
    
    Closes: https://bugs.gentoo.org/838091
    Signed-off-by: James Le Cuirot <chewi@gentoo.org>

 sys-fs/safecopy/files/safecopy-tests.patch         | 22 ++++++++++++++++++++++
 ...{safecopy-1.7.ebuild => safecopy-1.7-r1.ebuild} |  9 +++++----
 2 files changed, 27 insertions(+), 4 deletions(-)