Skip to content

File deletion is not working on XFS filesystems #37

Description

@paraenggu

The deletion of old recordings is not working if one runs rotter with a recording root directory on top of an XFS filesystem and has file deletion enabled (rotter -d <hours> ...):

[...]
[ERROR]  Tue Feb  6 08:00:10 2018  Warning: not a file or a directory:
[ERROR]  Tue Feb  6 08:00:10 2018  Warning: not a file or a directory:
[DEBUG]  Tue Feb  6 08:00:10 2018  File deletion child-process has finished.

Apart from the actual file path which is missing in the error message (see #36), the file deletion doesn't work.

The problem relates from the fact that the value of dp->d_type from the readdir() call, will always be DT_UNKNOWN on XFS file systems (and probably others as well).

Quoting the READDIR(3) man page:

d_type This field contains a value indicating the file type [...]
[...]
DT_UNKNOWN The file type could not be determined.

Currently, only some filesystems (among them: Btrfs, ext2, ext3, and ext4) have
full support for returning the file type in d_type. All applications must
properly handle a return of DT_UNKNOWN.

A possible fix would be to call lstat() to get the file type, regardless of the filesystem in use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions