Bug 181544 - [patch] file(1) fails to respect -L with --mime-type
Summary: [patch] file(1) fails to respect -L with --mime-type
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.4-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-26 11:30 UTC by sec
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Attachments
file.diff (614 bytes, patch)
2013-08-26 11:30 UTC, sec
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sec 2013-08-26 11:30:06 UTC
file (as in /usr/bin/file) does not honor "-L" when using mime type output.

As the ports makefile checks for shared library existance vie "file -L
--mime-type" = "application/x-sharedlib" this results in ports trying to
re-install already existing libraries.

Fix: Honestly, I'm not sure what the "&= MAGIC_MIME_TYPE" is supposed to do here,
but it actually deletes all other options from flags.

Someone with a better understanding of the code might want to check if the
code maybe was actually supposed to be "ms->flags |= MAGIC_MIME_TYPE" here?

I just added MAGIC_SYMLINK here to keep it from being deleted to fix the
problem at hand.
How-To-Repeat: 
run file with "-L" and "--mime-type" on a symlink.

without "-L" it's ok:

ice:~>file -b --mime-type /usr/local/lib/libdb-4.2.so.2 
application/x-symlink

actual output:

ice:~>file -b -L --mime-type /usr/local/lib/libdb-4.2.so.2                   :(
application/x-symlink

expected output:

ice:~>LD_LIBRARY_PATH=/usr/obj/usr/src/lib/libmagic file -b -L --mime-type /usr/local/lib/libdb-4.2.so.2
application/x-sharedlib
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:37 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped