# S390x/arm64 stat() bug

**URL:** https://travis-ci.community/t/s390x-arm64-stat-bug/11050
**Category:** Multi CPU Architecture
**Tags:** bug
**Created:** [January 19, 2021, 12:48pm UTC](https://travis-ci.community/t/s390x-arm64-stat-bug/11050 "2021-01-19T12:48:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![szeder](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/szeder/32/3177_2.png) [@szeder](https://travis-ci.community/u/szeder)
#### Post date: [January 19, 2021, 12:48pm UTC](https://travis-ci.community/t/s390x-arm64-stat-bug/11050/1 "2021-01-19T12:48:47Z")

</div>

If we call `stat()` on a just created file on s390x or arm64, then the value of `struct stat`'s `st_blocks` field is often wrong (usually 1).

Steps to reproduce:

- Create a file large enough to occupy a handful of blocks.
- Run `sync` for good measure (doesn’t make any difference).
- Run the `stat` command get all stat information of that file and save its output. It is likely that it reports that the file occupies only one block.
- Run `stat` repeatedly, and compare its output with the output we got in the previous point. After a few tries it will report the correct number of blocks.

This build runs the above steps:  
[https://travis-ci.org/github/szeder/git/builds/755102766](https://travis-ci.org/github/szeder/git/builds/755102766)

As you can see, all three supported Ubuntu releases are affected on s390x and arm64, while amd64 and ppc64le are apparently not affected at all.  
Interestingly, both s390x and arm64 have their root file system mounted through shiftfs, while amd64 and ppc64le use the good old ext4.

---

<div class="post-metadata">

### Author: ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)
#### Post date: [January 21, 2021, 4:17am UTC](https://travis-ci.community/t/s390x-arm64-stat-bug/11050/2 "2021-01-21T04:17:50Z")

</div>

Have you made your script executable?

---

<div class="post-metadata">

### Author: ![szeder](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/szeder/32/3177_2.png) [@szeder](https://travis-ci.community/u/szeder)
#### Post date: [January 21, 2021, 6:06am UTC](https://travis-ci.community/t/s390x-arm64-stat-bug/11050/3 "2021-01-21T06:06:01Z")

</div>

Of course, you can see that the script have been executed in all the jobs of the build that I linked above.
