Commit Graph

6 Commits

Author SHA1 Message Date
Johannes Altmanninger
407c72d90a Clear unwanted environment variable
This adds two things I forgot in
9a7d8df4 (Avoid accidentally using environment variables in sh scopes)

Mea culpa, the problem was that I was skipping matches with "filetype"
because that's usually just a hook parameter as in "WinSetOption filetype=.."

	rg --pcre2 '\b(?!filetype=)\w+=' rc/

So I missed these two cases where a shell variable is actually called "filetype".

The one in git.kak was not a problem because show_git_cmd_output is only
ever called with sane inputs.  However, file.kak does use the filetype
environment variable for many mime types, for example:

	filetype=somefiletype\''; echo -debug injection; nop '\' kak /dev/null

Will run the echo since /dev/null has mime type "inode/chardevice"
2020-09-02 06:54:19 +02:00
Jason Felice
bdd7ea6a03 Detect text/x-script.* and application/x-* types 2020-06-12 11:29:55 -04:00
Matthias Margush
99c09daec3 Fix filetype detection
The -i flag on Mac OS means:
    ჻ man file | grep -i -- -i
    -i      If the file is a regular file, do not classify its contents.

The --mime-type option is (mostly) portable:
- Linux uses --mime-type
- macOS uses --mime-type
- FreeBSD uses --mime-type
- NetBSD uses --mime-type
- OpenBSD uses --mime-type and does not use the same implementation as everybody else
- Solaris does not support MIME types at all
2020-02-21 21:25:57 -08:00
Alex Leferry 2
ba1274f73c file.kak: Dereference symlinks 2019-04-17 12:37:54 +02:00
Alex Leferry 2
313c6eadc7 file.kak: Use -i POSIX option name
https://ss64.com/osx/file.html
https://freebsd.org/cgi/man.cgi?query=file
2019-04-17 12:37:17 +02:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00