[Rpm-maint] [rpm-software-management/rpm] Race condition in rpmioMkpath ("Unable to open temp file: File exists") (Issue #3508)

Etienne Champetier notifications at github.com
Tue Jan 7 18:57:20 UTC 2025


**Describe the bug**
When running multiple `rpmbuild` in parallel with a non existing `%{_tmppath}`,
if you are lucky enough you will get an error `Unable to open temp file: File exists`

**To Reproduce**
Race condition are always a pain to reproduce
-> Code review

**Expected behavior**
multiple rpmioMkpath in // do not fail

**Output**
```
Unable to open temp file: File exists
```

**Environment**
 - OS / Distribution: `EL9.5`
 - Version: `rpm-4.16.1.3-34.el9.x86_64`

**Additional context**

https://github.com/rpm-software-management/rpm/blob/cae8ef521690ef07aa5664da2575e37126ee52cc/build/build.cc#L200-L202

https://github.com/rpm-software-management/rpm/blob/cae8ef521690ef07aa5664da2575e37126ee52cc/rpmio/rpmfileutil.cc#L75-L108
I don't get `error creating temporary file` error, only `Unable to open temp file: File exists` error, so the error is from `rpmioMkpath` when trying to create `%{_tmppath}`

https://github.com/rpm-software-management/rpm/blob/cae8ef521690ef07aa5664da2575e37126ee52cc/rpmio/rpmfileutil.cc#L125-L131
If another process create the folder between `stat` and `mkdir` we get the error

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3508
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3508 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20250107/d839ff09/attachment-0001.htm>


More information about the Rpm-maint mailing list