SB2 Bug using std::filesystem

That’s what I was thinking, especially in the case of moving from 5 to 6. We don’t appear to hit similar issues on obs that often, otherwise?

Completely going by an hunch, and I don’t actually know what I’m talking about, but at least on aarch64 it’s (almost?) always __fxstatat64.
So my hunch/prediction is it has something to do with LFS (large file support), a.k.a -D_LARGEFILE64_SOURCE, -D_LARGEFILE_SOURCE, -D_FILE_OFFSET_BITS=64, a.k.a. -D_GNU_SOURCE, a.k.a #include <features.h>.

Now, akshually.

A typical FM is e.g. (WARNING) moc[5815/-143018176] Path not found for FD 3, for __fxstatat64()

The ‘Path not found’ comes from here, and we can see the third parameter is empty. Which means virtual_path must have been ‘\0’, and this jumps to the error handling. (Also the weird indentation hints at some merge error or so).

PR21 to scratchbox seems to deal with errors in this space.
Can someone test whether an sb2 binary with that applied fares better compiling Qt stuff?

I don’t think I can update the sb2 package from within an OBS project, right?

Unless we roll out our own OBS :slight_smile:

Hey! That was my idea! :slight_smile:

And, in retrospective, maybe I should have tried to roll out some experimental OBS instead of rewriting tbuilder. It just seemed easier at that time… Anyone playing with private OBS already?

PS: sorry for off-topic. Maybe its better to discuss it under Qt6 for devs thread

@vige Updated info…

I think the issue is in the implementation of fchmod, see the following log an minimal example.

fchmod is used in libstdc++ do_file_copy here gcc/libstdc++-v3/src/filesystem/ops-common.h at master · gcc-mirror/gcc · GitHub which is called by filesystem::copy

I checked build logs and fchmod support is compiled in.
[ 3044s] checking for fchmod… yes
[ 3046s] checking for fchmodat… yes

Because fchmod is the first #ifdef check, it will be used.

File main.txt is rw,r,r inside the SDK

[SailfishOS-5.0.0.55EA-aarch64] testfchmod $ ls -lh
total 20K
-rwxr-xr-x 1 1001 1001 70K Jun 10 20:01 a.out
-rw-r–r-- 1 1001 1001 176 Jun 10 20:01 main.c
-rw-r–r-- 1 1001 1001 0 Jun 10 19:20 main.txt

Exit the SDK

[SailfishOS-5.0.0.55EA-aarch64] testfchmod $ exit
exit
piggz  ~  mer  cd projects/testfchmod/

File main.txt is rw,r,r outside the SDK

piggz  ~  mer  projects  testfchmod  ls -lh
total 20K
-rwxr-xr-x 1 piggz piggz 70K Jun 10 21:01 a.out
-rw-r–r-- 1 piggz piggz 176 Jun 10 21:01 main.c
-rw-r–r-- 1 piggz piggz 0 Jun 10 20:20 main.txt

Enter the SDK
 1
piggz  ~  mer  sfdk build-shell
[SailfishOS-5.0.0.55EA-aarch64] mer $ cd projects/testfchmod/

Program should change main.txt to rw,r,-

[SailfishOS-5.0.0.55EA-aarch64] testfchmod $ cat main.c
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(){
int f;

f = open(“./main.txt”, O_RDWR);
fchmod(f, S_IRUSR|S_IWUSR|S_IRGRP);
close(f);
}

Inside the SDK, permissions have not changed

[SailfishOS-5.0.0.55EA-aarch64] testfchmod $ ls -lh
total 20K
-rwxr-xr-x 1 1001 1001 70K Jun 10 20:49 a.out
-rw-r–r-- 1 1001 1001 162 Jun 10 20:05 main.c
-rw-r–r-- 1 1001 1001 0 Jun 10 19:20 main.txt

[SailfishOS-5.0.0.55EA-aarch64] testfchmod $ exit
exit
piggz  ~  mer  cd projects/testfchmod/

Outside the SDK, permissions have changed

piggz  ~  mer  projects  testfchmod  ls -lh
total 20K
-rwxr-xr-x 1 piggz piggz 70K Jun 10 21:49 a.out
-rw-r–r-- 1 piggz piggz 162 Jun 10 21:05 main.c
-rw-r----- 1 piggz piggz 0 Jun 10 20:20 main.txt

1 Like

As before, this works fine with Docker build engine. I think we can rule out SB2 as the culprit, perhaps it’s time to change the title of the topic?

Sure, what to? Issue occurs on OBS builds, so not sure where to blame.

With the SDK I would blame the VirtualBox filesystem. With OBS it’s quite likely different issue as there is no VirtualBox there.

Mal found this comment in sb2, in case it is relevant