gazebosim / gz-common

An audio-visual library supports processing audio and video files, a graphics library can load a variety 3D mesh file formats into a generic in-memory representation, and the core library of Gazebo Common contains functionality that spans Base64 encoding/decoding to thread pools.
https://gazebosim.org
Apache License 2.0
12 stars 38 forks source link

`gz::common:moveFile()` does not work accross different partitions #533

Open jrutgeer opened 1 year ago

jrutgeer commented 1 year ago

Environment

Description

gz::common:moveFile() calls std::filesystem::rename(), which fails with error generic:18 Invalid cross-device link if the source and destination folder are on different partitions.

Steps to reproduce

E.g. with /home and / mounted on different partitions:

[GUI] [Wrn] [Filesystem.cc:50] Failed common::moveFile (ec: generic:18 Invalid cross-device link)
[GUI] [Err] [VideoRecorder.cc:380] Unable to rename file from[ign_recording.mp4] to [/tmp/aaa.mp4]

Possible fix

I found this similar report (though boost rather than std), which proposes to copy + delete original if succesful.

mjcarroll commented 1 year ago

Interesting, good catch. Would you be interested in doing a PR with the proposed workaround (copy+delete)

jrutgeer commented 1 year ago

good catch.

Well, I did not catch it, I experienced it... ;-)

While I generally try to contribute (e.g. fix, new functionality, system plugin), I cannot commit time for this one unfortunately.