martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.2k stars 258 forks source link

filetype: Depends on non-POSIX file(1) options #960

Open lanodan opened 3 years ago

lanodan commented 3 years ago

Command used in filetype.lua: file -bL --mime-type -- '%s'

As usual, POSIX doesn't have long options on file(1) and sadly there isn't an equivalent option in POSIX (-i in POSIX is for something entirely different btw), the other options are also absent.

That said https://www.darwinsys.com/file/ is basically the de-facto implementation of file(1) on libre unixes (OpenBSD seems to have forked it some years ago) so it's not a big issue but I think it should be noted for packagers.

An annoying part is that popen doesn't seems to allow checking the return value, so if you ended up replacing darwinsys's file(1) with plan9port's file(1) you get a broken vis, I think it should check if the output seems like a correct mime type.

mcepl commented 1 year ago

Are there any real platforms (real platforms doesn’t include Plan 9 ;)), which doesn’t have darwinsys’s file(1)? Is this actually an issue?

lanodan commented 1 year ago

[2022-11-29 16:07:09-0800] Matěj Cepl:

Are there any real platforms (real platforms doesn’t include Plan 9 ;)), which doesn’t have darwinsys’s file(1)? Is this actually an issue?

Not that I'm aware, it's more of a packaging/documentation issue than a portability issue. I think virtually all unixes have darwinsys's file(1) (or compatible for OpenBSD) available, but it's not always installed by default.

mcepl commented 1 year ago

So, is this an issue at all? This is supposed to be an issue tracker not just a place to contemplate mysteries of life.