Bug 293822 - kst doesn't monitor dirfiles for metadata changes
Summary: kst doesn't monitor dirfiles for metadata changes
Status: RESOLVED WORKSFORME
Alias: None
Product: kst
Classification: Applications
Component: datasources (show other bugs)
Version: 2.0.4
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-11 03:32 UTC by D. V. Wiebe
Modified: 2023-01-20 05:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description D. V. Wiebe 2012-02-11 03:32:00 UTC
I've run into a problem due to kst not monitoring a dirfile's metadata on disk while working on defile (an {"anything"} to dirfile converter program).

When kst is reading from a dirfile which is truncated by a third party calling GetData's gd_open(..., GD_TRUNC) on it, a race condition exists in kst.  This call results in a dirfile with no fields in it.  The third party can then add fields to the dirfile and flush the metadata to disk.

If kst updates the datasource after truncation but before the new metadata has been written to disk, it will get a DIRFILE with no fields in it.  In particular, this means that gd_nframes() will always return zero.  Because kst doesn't monitor the dirfile's metadata for changes, the third party creating fields later doesn't fix this problem.

So: kst should monitor an open DIRFILE file for metadata changes and trigger a reload of datasource if it notices change.  Things get a little difficult because the dirfile metadata can be spread across multiple files.

I think it's sufficient to monitor the primary format file.  Kst can figure out the path of this file itself: it's just whatever pathname kst passed to the GetData::Dirfile constructor + "/format".  However, if it's easier, the name is also available via GetData.  A more complete solution would be to monitor every fragment.
Comment 1 D. V. Wiebe 2012-07-05 22:00:49 UTC
Not that I'm necessarily advocating it's use, but GetData-0.8 now provides Dirfile::DeSync() (= gd_desync()) which performs such monitoring and can, optionally automatically reload the dirfile if changes are detected.

The down side of this function is that it uses the mtime returned from stat(2) to determine if a file has changed.  This makes it both portable on anything providing something resembling a sysV stat(), including Win32, and also not dependent on external dependencies, but does limit the granularity of changes to one second, which can result in this function being unable to detect changes to a dirfile in certain exceptional circumstances (see gd_desync(3) for a discussion).  Using FAM/inotify/whatever would be a better but non-portable solution.
Comment 2 Andrew Crouthamel 2018-11-09 00:55:13 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Andrew Crouthamel 2018-11-18 03:35:08 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Justin Zobel 2022-12-21 23:58:21 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 5 Bug Janitor Service 2023-01-05 05:25:50 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2023-01-20 05:09:05 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!