Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTI registrations are wrong #1169

Open
hofman opened this issue Jan 25, 2021 · 3 comments
Open

UTI registrations are wrong #1169

hofman opened this issue Jan 25, 2021 · 3 comments
Milestone

Comments

@hofman
Copy link

hofman commented Jan 25, 2021

Instructions: Replace the template text and remove irrelevant text (including this line)

Describe the bug
The registration of UTIs in Info.plist is done wrong. This messes up the launch services database for the users, which can lead to all kind of problems when handling files, not just in MacVim, but any app that may need to handle any of the types declared by MacVim. In particular, the Exported Types should only contain custom types owned by MacVim. All third party types and built in types should only be declared as Imported Types. Otherwise MacVim takes ownership of them, overruling the true owners of the type, which is extremely rude. In fact, standard built-in types should not be declared at all, in particular types starting with public. What is worse, MacVim declares some types with errors. In particular, com.adobe.postscript is declared as inheriting from public.plain-text. This is absolutely wrong, as PostScript it is not plain text. It only inherits from public.data. This makes the postscript type unusable for any app that wants to use the type, and breaks the system of your users.

Environment (please complete the following information):

  • Vim version 8.2.2156

Additional context
Add any other context about the problem here.

@ychin
Copy link
Member

ychin commented Feb 5, 2021

Yeah I think this is the same as #916. This should probably be fixed as this as it's kind of broken. I'll look into this.

@jgvanwyk
Copy link

jgvanwyk commented Aug 7, 2023

I’ve taken a look at this. The available documentation for Uniform Type Identifiers appears to be the out of date Uniform Type Identifiers Overview, the out of date System Declared Uniform Type Identifiers and the up to date Uniform Type Identifiers Framework Documentation. The gist is this. An app should export a type only if it is the source of the type; any other types it must import. The system declares various types by default, which the app doesn’t need to import.

Note that The list of system declared types in the document linked above is for OS X 10.4, and is quite out of date (10.4 saw its last release in 2007). macOS now exports additional many additional types, of which public.fortran-{,77-,90-,95-}source, public.ada-source, public.yacc-source and public.pascal-source are relevant to MacVim.

Resetting, seeding and display the type identifiers database on your machine can done with the lsregister program, which lives at /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister. For example, to get a list of the declared types on your machine, run lsregister -dump | grep uti: | cut -c 29- | sort | uniq.

MacVim currently exports 75 type identifiers. I’ve listed these type identifiers below along with proposed changes for most of them. I’m not sure what to do with .cfg, .ini and .io files, as these are just common file extensions used for different purposes by different apps and programs, and I’m not sure what to do with .cdfg, .v, .vh, .vhdl, .scm and .gtd files as it’s just not clear to me what these file types are.

I’m happy to submit a pull request with the relevant changes once we’ve figured out what should be done with all these type identifiers.

Current (exported) Proposed
org.vim.vim-script export org.vim.vim-script
public.plain-text system declared
org.vim.tex-file import org.tug.tex-source
public.c-header system declared
org.vim.pch-file system declared public.precompiled-c-header
public.c-plus-plus-header system declared
org.vim.pch++-file system declared public.precompiled-c-plus-plus-header
public.c-source system declared
public.objective-c-source system declared
public.objective-c-plus-plus-source system declared
public.c-plus-plus-source system declared
public.assembly-source system declared
com.apple.rez-source system declared
com.sun.java-source system declared
com.apple.xcode.lex-source system declared public.lex-source
com.apple.xcode.yacc-source system declared public.yacc-source
public.mig-source system declared
com.apple.symbol-export system declared
com.apple.xcode.fortran-source system declared public.fortran-{,77-,90-,95-}source
com.apple.xcode.pascal-source system declared public.pascal-source
com.apple.xcode.ada-source system declared public.ada-source
public.html system declared
public.xml system declared
com.netscape.javascript-source system declared
public.perl-script system declared
public.python-script system declared
public.php-script system declared
public.ruby-script system declared
public.shell-script system declared
com.sun.java-class system declared
org.vim.patch-file system declared public.patch-file
com.apple.xcode.strings-text import com.apple.xcode.strings-text
com.apple.applescript.text system declared
org.vim.as-file import com.adobe.action-script
org.vim.asp-file import com.microsoft.active-server-pages-script
org.vim.aspx-file import com.microsoft.active-server-pages-script
org.vim.bib-file import org.tug.bib
org.vim.cs-file import com.microsoft.c-sharp-source
org.vim.cdfg-file
org.vim.csv-file system declared public.comma-separated-values-text
org.vim.tsv-file system declared public.tab-separated-values-text
org.vim.cgi-file import org.ietf.common-gateway-interface-source
org.vim.cfg-file
org.vim.css-file system declared public.css
org.vim.dtd-file import org.w3.document-type-definition-text
org.vim.dylan-file import org.opendylan.dylan-soure
org.vim.erl-file import org.erlang.erlang-source
org.vim.f-script-file
org.vim.hs-file org.haskell.haskell-source
org.vim.inc-file
org.vim.ics-file system-declared com.apple.ical.ics
org.vim.ini-file
org.vim.io-file
org.vim.bsh-file org.beanshell.beanshell-script
org.vim.properties-file
org.vim.jsp-file com.sun.jakarta-server-pages-source
org.vim.lisp-file
org.vim.log-file system declared public.log
org.vim.wiki-file export org.vim.vim-wiki-text
com.adobe.postscript system declared
org.vim.scm-file
org.vim.sql-file import org.iso.structured-query-language-source
org.vim.tcl-file import tk.tcl.tcl-script
org.vim.xsl-file import org.w3.extensible-style-sheet-source
public.vcard system declared
org.vim.vb-file import com.microsoft.visual-basic-source
org.vim.yaml-file org.yaml.yaml-text
org.vim.gtd-file
net.darlingfireball.markdown import net.darlingfireball.markdown
org.vim.rst-file import org.python.restructuredtext
org.vim.vba-file import com.microsoft.visual-basic-source
org.vim.vhdl-file
org.lua.lua-source import org.lua.lua-source
org.vim.v-file
org.vim.vh-file

@hofman
Copy link
Author

hofman commented Aug 7, 2023 via email

@ychin ychin modified the milestones: Release 178, Release 179 Sep 9, 2023
@ychin ychin modified the milestones: Release 179, Release 180 Jan 3, 2024
jgvanwyk pushed a commit to jgvanwyk/macvim that referenced this issue Apr 30, 2024
Currently MacVim exports many UTIs for filetypes it doesn't own, and its
UTI definitions for many of these filetypes are incorrect. This patch
aims to correct these UTI registrations and close macvim-dev#1169. The following
lists the UTIs that were changed and how.

export org.vim.vim-script -> export org.vim.vim-script
export org.vim.tex-file -> import org.tug.{tex,sty,cls}
export public.plain-text -> import public.plain-text
export public.c-header -> import public.c-header
export org.vim.pch-file -> import public.precompiled-c-header
export public.c-plus-plus-header -> import public.c-plus-plus-header
export org.vim.pch++-file
        -> import public.precompiled-c-plus-plus-header
export public.c-source -> import public.c-source
export public.objective-c-source -> import public.objective-c-source
export public.objective-c-plus-plus-source
        -> import public.objective-c-plus-plus-source
export public.c-plus-plus-source -> import public.c-plus-plus-source
export public.assembly-source -> import public.assembly-source
export com.apple.rez-source -> import com.apple.rez-source
export com.sun.java-source -> import com.sun.java-source
export com.apple.xcode.lex-source -> import public.lex-source
export com.apple.xcode.yacc-source -> import public.yacc-source
export public.mig-source -> import public.mig-source
export com.apple.symbol-export -> import com.apple.symbol-export
export com.apple.xcode.fortran-source
        -> import public.fortran{,-77,-90,-95}-source
export com.apple.xcode.pascal-source -> import public.pascal-source
export public.html -> import public.html
export public.xml -> import public.xml
export com.netscape.javascript-source
        -> import com.netscape.javascript-source
export public.python-script -> import public.python-script
export public.perl-script -> import public.perl-script
export public.php-script -> import public.php-script
export public.ruby-script -> import public.ruby-script
export public.shell-script
        -> import public.{shell,bash,zsh,csh,ksh,tcsh}-script
export com.sun.java-class -> import com.sun.java-class
export org.vim.patch-file -> import public.patch-file
export com.apple.xcode.strings-text
        -> import com.apple.xcode.strings-text
export com.apple.applescript.text -> import com.apple.applescript.text
export org.vim.as-file -> import com.adobe.actionscript
export org.vim.asp-file -> import com.microsoft.asp
export org.vim.aspx-file -> import com.microsoft.aspx
export org.vim.bib-file -> import org.tug.tex.bibtex
export org.vim.cs-file -> import com.microsoft.c-sharp
export org.vim.cfdg-file -> import org.contextfreeart.contextfree
export org.vim.csv-file -> import public.comma-seperated-values-text
export org.vim.tsv-file -> import public.tab-seperated-values-text
export org.vim.cgi-file -> import org.vim.cgi-script
export org.vim.cfg-file -> import org.vim.config-file
export org.vim.css-file -> import org.w3.css
export org.vim.dtd-file -> import org.w3.xml-dtd
export org.vim.dylan-file -> import public.dylan-source
export org.vim.erl-file -> org.erlang.erlang
export org.vim.fscript-file -> org.fscript.fscript
export org.vim.hs-file -> import org.haskell.haskell
export org.vim.inc-file -> import org.vim.include-file
export org.vim.ics-file -> import com.apple.ical.ics
export org.vim.ini-file -> import com.microsoft.ini
export org.vim.io-file -> import org.iolanguage.io
export org.vim.bsh-file -> import org.beanshell.beanshell
export org.vim.properties-file -> import com.sun.java-properties
export org.vim.jsp-file -> import com.sun.java-server-pages
export org.vim.lisp-file -> import org.vim.lisp-source
export org.vim.log-file -> import com.apple.log
export org.vim.wiki-file -> import org.mediawiki.wiki-source
export org.vim.ps-file -> import com.adobe.postscript
export org.vim.scm-file -> import org.vim.scheme-source
export org.vim.sql-file -> import org.iso.sql
export org.vim.tcl-file -> import tk.tcl.tcl
export org.vim.xsl-file -> import org.w3.xsl
export public.vcard -> import public.vcard
export org.vim.vb-file -> import com.microsoft.visual-basic
export org.vim.yaml-file -> import org.yaml.yaml
export org.vim.gtd-file -> import org.vim.gtd
export net.darlingfireball.markdown
        -> import net.darlingfireball.markdown
export org.vim.rst-file -> import org.python.restructuredtext
export org.vim.vba-file -> export org.vim.vimball-archive
export org.vim.vhdl-file -> remove
export org.lua.lua-source -> import org.lua.lua
export org.vim.v-file -> import org.ieee.vhdl
export org.vim.vh-file -> import org.ieee.vhdl-header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants