libutil/file-system.hh redefines standard #defines if a Lix internal HAVE_ isn't provided #455

Open
opened 2024-07-22 11:07:37 +00:00 by delroth · 2 comments
Member

Describe the bug

Trying to include (directly or transitively) libutil/file-system.hh from outside Lix causes warnings about DT_UNKNOWN, DT_REG, ... being redefined. This is because the header tries to define them #ifndef HAVE_STRUCT_DIRENT_D_TYPE, which will of course usually not be defined outside Lix.

This requires a bunch of workarounds in downstream projects and I really see no reason why such hacks should be in public headers - in fact, file-system.hh itself does not use the DT_* it defines, so at the very least those redefines are in the wrong place.

## Describe the bug Trying to include (directly or transitively) libutil/file-system.hh from outside Lix causes warnings about DT_UNKNOWN, DT_REG, ... being redefined. This is because the header tries to define them #ifndef HAVE_STRUCT_DIRENT_D_TYPE, which will of course usually not be defined outside Lix. This requires a bunch of workarounds in downstream projects and I really see no reason why such hacks should be in public headers - in fact, file-system.hh itself does *not* use the DT_* it defines, so at the very least those redefines are in the wrong place.
delroth added the
bug
label 2024-07-22 11:07:37 +00:00
Author
Member

See for reference this workaround in n-e-j: https://git.lix.systems/lix-project/nix-eval-jobs/src/branch/main/src/meson.build#L14

(I'm copy-pasting it in Hydra too, which is the trigger for me filing this bug...)

See for reference this workaround in n-e-j: https://git.lix.systems/lix-project/nix-eval-jobs/src/branch/main/src/meson.build#L14 (I'm copy-pasting it in Hydra too, which is the trigger for me filing this bug...)
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/1722 ("fix: stop using dirent d_type DT_* constants as API internally")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/1722", "number": 1722, "kind": "commit message"}], "cl_meta": {"1722": {"change_title": "fix: stop using dirent d_type DT_* constants as API internally"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/1722](https://gerrit.lix.systems/c/lix/+/1722) ("fix: stop using dirent d_type DT_* constants as API internally")
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#455
No description provided.