View Issue Details

IDProjectCategoryView StatusLast Update
0000455fileGeneralpublic2023-06-16 19:40
Reporterraf Assigned Tochristos  
Status resolvedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product Version5.44 
Fixed in Version5.45 
Summary0000455: Incomplete documentation for magic_getpath in
DescriptionThe libmagic manual entry only mentions magic_getpath() in relation to its return value. It doesn't include it in the list of available functions, and it doesn't explain what it does. Below, in the additional information section, is a patch to fix that. Technically, the existing statement that magic_getpath() returns NULL on error isn't true. It returns the system default path whenever there is an error, but it's probably harmless to leave that.
Steps To ReproduceRun "man libmagic" then search for "magic_getpath".
Additional Informationdiff --git a/doc/ b/doc/
index f006c828..ec5cca0c 100644
--- a/doc/
+++ b/doc/
@@ -84,6 +84,8 @@
 .Fn magic_setparam "magic_t cookie" "int param" "const void *value"
 .Ft int
 .Fn magic_version "void"
+.Ft const char *
+.Fn magic_getpath "const char *magicfile" "int action"
 These functions
 operate on the magic database file
@@ -347,6 +349,18 @@ from
 .In magic.h .
 This can be used by client programs to verify that the version they compile
 against is the same as the version that they run against.
+.Fn magic_getpath
+command returns the colon separated list of magic database locations. If the
+.Fa filename
+is non-NULL, then it is returned. Otherwise, if the
+environment variable is defined, then it is returned.
+Otherwise, if
+.Fa action
+is 0 (meaning "file load"), then any user-specific magic database file is included.
+Otherwise, only the system default magic database path is included.
 The function
 .Fn magic_open



2023-06-16 19:40

manager   ~0003949

Committed, many thanks!

Issue History

Date Modified Username Field Change
2023-06-02 02:13 raf New Issue
2023-06-02 02:13 raf Tag Attached: patch
2023-06-16 19:39 christos Assigned To => christos
2023-06-16 19:39 christos Status new => assigned
2023-06-16 19:40 christos Status assigned => resolved
2023-06-16 19:40 christos Resolution open => fixed
2023-06-16 19:40 christos Fixed in Version => 5.45
2023-06-16 19:40 christos Note Added: 0003949