wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.77k stars 816 forks source link

Package Control bails out in Sublime if system uses non-English language #1632

Closed mdziczkowski closed 7 months ago

mdziczkowski commented 1 year ago

Environment

OS: Debian 11 Sublime version: build 4143

Issue description

After installing Package Control in Sublime and trying to use it, I recieve the message that I need to set system variables related to language (LANG=, LC_CLANG=, etc.) to english (in case if it's set other ways) or it won't work.

Setting the mentioned variables (with messess up in displaying of the content with dialectical characters of my language) and launching then Sublime doesn't have an effect and I still get the message

Expected behaviour

Normal work of Package Control in Sublime

deathaxe commented 1 year ago

This is not about "non-english", but "non-unicode".

The error dialog indicates your filesystem not being able to handle unicode (all non-english!) filenames. Hence it might fail to store some package's files correctly.

The check is implemented at:

https://github.com/wbond/package_control/blob/cfaaeb57612023e3679ecb7f8cd7ceac9f57990d/Package%20Control.py#L103-L129

According to the comment and the possible problematic history, I don't forsee that check to be removed anytime soon.

With regards to all the following issues having been closed, I'd even judge this to be a duplicate of at least one of them:

The only solution seems to be to somehow enable unicode support on your OS.

mdziczkowski commented 1 year ago

The strange thing is that my language (polish) does support unicode and my environment variables for the language are set to:

LANG=pl_PL.UTF-8
LC_CTYPE=pl_PL.UTF-8

I had also set (for test propouses) LC_ALL=C

It seem that none of them was affected thru the Package Control and the message was appearing

deathaxe commented 1 year ago

Package Control just verifies system capabilities. It can't fix existing limitations.

As already stated in one of the other issues, you need to somehow make sure your filesystem/environment can handle non-ascii characters.

My Linux VMs run with non-english locales successfully.

I am however not familiar enough with Linux to give you further advice.

mdziczkowski commented 1 year ago

The case is that my language self uses unicode characters (dialectical characters), so it does already support it.

For the test reasons, I had overwriten it like it was wroten in the message and get it again displayed. Same when I had set the LC_* variables to C

mdziczkowski commented 1 year ago

Hello. Sorry for the delay, but live has heept me busy. I attach the debug log from the "PacketControl":

startup, version: 4143 linux x64 channel: stable
executable: /opt/sublime_text/sublime_text
application: /opt/sublime_text
working dir: /root
packages path: /mnt/hdd/etc/skel/sublime-text/Packages
state path: /mnt/hdd/etc/skel/sublime-text/Local
zip path: /opt/sublime_text/Packages
zip path: /mnt/hdd/etc/skel/sublime-text/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 1.34338
startup time: 2.27556
first paint time: 2.49298
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.html_print
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading python 3.3 plugin 0_package_control_loader.00-package_control
reloading python 3.3 plugin Package Control.1_reloader
reloading python 3.3 plugin Package Control.2_bootstrap
reloading plugin Default.keymap
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading python 3.3 plugin Package Control.Package Control
plugins loaded
error: Package Control

Your system's locale is set to a value that can not handle non-ASCII characters. Package Control can not properly work unless this is fixed.

On Linux, please reference your distribution's docs for information on properly setting the LANG and LC_CTYPE environmental variables. As a temporary work-around, you can launch Sublime Text from the terminal with:

LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 sublime_text

I have some adnotations to above:

  1. The PackageControl incorrectly discovers the Unicode and ASCII support (my Linux and language suports both)
  2. exporting the variables:
LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8

doesn't work (still getting the same message).

Does any one have any ideas how to fix this ? Any help would be appreciated :-)

FichteFoll commented 1 year ago

Can you also provide the output of lsblk -f and inside the ST console: import os; [os.environ.get('LANG'), os.environ.get('LC_CTYPE')]?

mdziczkowski commented 1 year ago

Sorry for the delay, but I'm beeing keept busy with getting money for food.

Result of:

deathaxe commented 1 year ago

I've set up a Polish Debian 11.7 VM with GNOME but can't reproduce any issues. Package Control is installing and working fine.

lsblk -f says

grafik

from within Sublime Text LANG is set to

>>> os.environ['LANG']
'pl_PL.UTF-8'`

>>> os.environ['LC_CTYPE']
Traceback (most recent call last):
  File "__main__", line 1, in <module>
  File "./python3.8/os.py", line 675, in __getitem__
KeyError: 'LC_CTYPE'

>>> os.environ['LC_ALL']
Traceback (most recent call last):
  File "__main__", line 1, in <module>
  File "./python3.8/os.py", line 675, in __getitem__
KeyError: 'LC_ALL'
mdziczkowski commented 1 year ago

Have you tryed it with Python 3.11 instead of Python 3.8?

mdziczkowski commented 1 year ago

Maybe my sublime package that was in earlier version got corrupted. After fixing some issues with the hardware, I try to download a fresh installer from the website instead of Debian repo

FichteFoll commented 1 year ago

Have you tryed it with Python 3.11 instead of Python 3.8?

There is no Python 3.11 within ST.

mdziczkowski commented 1 year ago

@FichteFoll Then how come on my Debian (bookworm) I was able to install it? 🤔

deathaxe commented 1 year ago

ST's builtin python interpreter is unrelated with OS's dedicated python.

ST runs a python 3.3 and python 3.8 plugin-host. Plugins such as Package Control run on one of those.

mdziczkowski commented 1 year ago

May I propose that ST uses in the first place the installed on system Python instead of a bundled in and outdated version of it?

Additionally, while running ST, I had seen that the plugin_manager uses both 2.7 and 2.8 version of python in same time, with may cause confusion and bigger memory footprint

deathaxe commented 1 year ago

Yes, you can propose it, but it is technically not possible.

mdziczkowski commented 1 year ago

Yes, you can propose it, but it is technically not possible.

may I ask why do you think so?

if it was able to implement (bungle) in python then there could be technically possible to check places in the PATH variable for installed Python and compare the versions.

I'm not that good in programming (still learning it), but the project got a loot of talented programmers who would for sure find a solution 😉

deathaxe commented 7 months ago

may I ask why do you think so?

ST uses embedded interpreter, which works independently from globally installed python.

Closing this as "not planned" as everything works fine in a polish Debian VM and there's nothing which can be done from plugin's point of view to fix it.

Removing the sanity check is no option.