Bug #1547
Directories in timeshift buffer not removed
100%
Description
Minor one.
Timeshift is on-demand.
Start watching channel A - a new directory with numeric name is created immediately under timeshift/buffer (let's call it N).
Switch to channel B - directory N+1 is created, directory N remains (not deleted).
Use timeshift on channel B (pause/resume etc), files are written to directory N+1
Switch to channel C - directory N+2 is created, directory N+1 along with all files in it gets deleted (this is correct).
When I zap channels without using timeshift, I end up with tens of empty directories under timeshift/buffer.
I expect either no directory created unless I actually use timeshift (preffered) or at least those empty directories gets deleted after channel change even if I didn't use timeshift and no files were created in it.
This minor since does not affect watching/timeshifting, but I think it needs to be fixed anyways, these directories look so useless.
History
Updated by Adam Sutton almost 12 years ago
Agreed, the on-demand stuff was added on a bit of a whim at a user request. The file management was in place, but directory stuff is setup for each timeshift pipeline that's created (i.e. each sub).
I'll have a quick look though as I agree that for on-demand it doesn't look right. And my guess is the reason the dirs don't get removed is this only happens if you actually have stuff in them (i.e. removal of the last file triggers removal of the directory).
Adam
Updated by Adam Sutton almost 12 years ago
The one issue that could arise, is that the point at which you find out about an inability to write the timeshift buffer will be different (i.e. if you don't have permission). Not sure just yet what that might mean for a client.
Adam
Updated by Adam Sutton almost 12 years ago
- Status changed from New to Fixed
- % Done changed from 0 to 100
Applied in changeset commit:2dcbc3632736a2323ecdeb6f1853e0b134836f3c.
Updated by Dmitry Avsioukov almost 12 years ago
Can't be directory creation moved to the place where the files are created?
I mean this function:
/* * Get current / new file */ timeshift_file_t *timeshift_filemgr_get ( timeshift_t *ts, int create )
Just before you create new file, you check that folder already exists, and if no, you create it. Does this makes sense?
Updated by Dmitry Avsioukov almost 12 years ago
Oops, sorry: while I was posting my suggestion, you've already fixed it