[Interest] Behavioural change in QFile/QDir rename

Elvis Stansvik elvstone at gmail.com
Sat Jun 15 18:28:26 CEST 2019

Den lör 15 juni 2019 kl 18:00 skrev Federico Buti <fed.buti at gmail.com>:
> Hi all.
> Recently we successfully switched from Qt 5.6 to Qt 5.12.3 after some struggles on win. Very few unit tests failed out of hundreds. Among those one stood out as quite strange and I'm looking for feedback on it.
> We wrote a simple wrapper around inotify API to collect events in a target directory for the set {IN_CREATE, IN_OPEN, IN_MODIFY, IN_CLOSE, IN_MOVED_TO, IN_DELETE}. All the unit tests for those events pass correctly on 5.12. All of them with the exception of the test for moved/renamed files which fails miserably.
> We gave strace a go and we noticed that 5.12 runtime acts differently for rename/move operations (see attached compare screenshot). In particular, on 5.6 we have an actual rename whereas a link/unlink sequence happens on 5.12. That sequence is not detected by our code, generating the failure.
> How can we handle this change? We should maybe pay attention to IN_ATTRIB attributes for link, shouldn't we? Can someone point out the commit that changes the behaviour?

The change is https://codereview.qt-project.org/c/qt/qtbase/+/199004
and it seems to have been made in order to avoid the overwriting
semantics of rename(2).

I don't know how to handle it as I'm not familiar with inotify, but I
bet someone here is.


> Any advice is pretty much appreciated!
> Thanks in advance
> F.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

More information about the Interest mailing list