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

tar: Failed to set default locale error while loading the signal pkg #227

Open
ruchitrajhansa opened this issue Jul 15, 2021 · 8 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@ruchitrajhansa
Copy link

ruchitrajhansa commented Jul 15, 2021

I was looking to instal the signal pkg for octave 6.0.90 for my MacBook Air M1, running Mac OS Big Sur,
Replace this section with a description of the problem, including:

  • What you did: used the cmd -'pkg install -forge control signal ' in the cmd window
  • What you expected to happen: successful installation of pkg
  • What actually happened: error message revived regarding default locale and I am guessing an loop of octave trying to set and fallback the locale settings but to no use

Environment and Diagnostics

Please run system env in Octave.app, and copy & paste the output

SHELL=/bin/zsh
TERM=xterm
TMPDIR=/var/folders/s7/q2mkmjnx6y36w4lf46p18l180000gn/T/
LC_NUMERIC=C
USER=ruchitrajhansa
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.n64Q5GyZnh/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
COLUMNS=116
PATH=/Applications/Octave-6.0.90.app/Contents/Resources/usr/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Octave-6.0.90.app/Contents/Resources/usr/Cellar/octave-octave-app@6.0.90/6.0.90/libexec/octave/6.0.90/site/exec/x86_64-apple-darwin18.7.0:/Applications/Octave-6.0.90.app/Contents/Resources/usr/Cellar/octave-octave-app@6.0.90/6.0.90/libexec/octave/api-v55/site/exec/x86_64-apple-darwin18.7.0:/Applications/Octave-6.0.90.app/Contents/Resources/usr/Cellar/octave-octave-app@6.0.90/6.0.90/libexec/octave/site/exec/x86_64-apple-darwin18.7.0:/Applications/Octave-6.0.90.app/Contents/Resources/usr/Cellar/octave-octave-app@6.0.90/6.0.90/libexec/octave/6.0.90/exec/x86_64-apple-darwin18.7.0:/Applications/Octave-6.0.90.app/Contents/Resources/usr/Cellar/octave-octave-app@6.0.90/6.0.90/bin
_=/usr/bin/env
__CFBundleIdentifier=org.octave-app.Octave
PWD=/Users/ruchitrajhansa
GS_OPTIONS=-sICCProfilesDir=/Applications/Octave-6.0.90.app/Contents/Resources/usr/opt/ghostscript/share/ghostscript/9.52/iccprofiles/ -sGenericResourceDir=/Applications/Octave-6.0.90.app/Contents/Resources/usr/opt/ghostscript/share/ghostscript/9.52/Resource/ -sFontResourceDir=/Applications/Octave-6.0.90.app/Contents/Resources/usr/opt/ghostscript/share/ghostscript/9.52/Resource/Font
LANG=en_IN.UTF-8
XPC_FLAGS=0x0
F77=/Applications/Octave-6.0.90.app/Contents/Resources/usr/bin/gfortran
LINES=5
XPC_SERVICE_NAME=0
HOME=/Users/ruchitrajhansa
SHLVL=2
FC=/Applications/Octave-6.0.90.app/Contents/Resources/usr/bin/gfortran
GNUTERM=qt
LOGNAME=ruchitrajhansa
DISPLAY=/private/tmp/com.apple.launchd.D3rgcoHlHY/org.macosforge.xquartz:0
LC_TIME=C
ans = 0
@ruchitrajhansa
Copy link
Author

FIXED:

Used- pkg load signal
Instead of pkg install -forge control signal

Also had to change Locale Settings using terminal by updating ~/.zprofile and adding these lines to the file:

export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"

This seemed to fix the problem of loading the package.

@apjanke
Copy link
Contributor

apjanke commented Jul 16, 2021

Hmm. That should have worked, actually! I'm going to reopen this because Octave.app needs to handle this case better.

Could you paste the output of system('locale') run from within your Octave.app session here? Are you launching Octave.app by double-clicking the Octave icon in /Applications, or are you launching it from the command line somehow? And could you also show me the output of locale run from a terminal session when you don't have those LC_ALL/LANG/LANGUAGE variables explicitly set in your ~/.zprofile?

I'm guessing what's going on is this: Octave is calling out to zsh when you run system (which pkg does), because zsh is the default interactive shell on newer versions of macOS. That might actually be a problem: most programmatic stuff for running commands should not be sensitive to the user's default interactive shell choice, and is probably assuming bash behavior instead of zsh. This might actually be a bug in Octave itself.

@apjanke apjanke reopened this Jul 16, 2021
@apjanke apjanke self-assigned this Jul 16, 2021
@apjanke apjanke added the bug Something isn't working label Jul 16, 2021
@ruchitrajhansa
Copy link
Author

Output of system('locale'):

LANG="en_IN.UTF-8"

LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
ans = 0

I am launching octave from applications, and not command line.
Before changing the ~/.zprofile the output of locale gave me:

`LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=`

I tried to experiment a lot of things with the zsh script but only editing the profile seemed to have worked.

Thanks.

@apjanke
Copy link
Contributor

apjanke commented Jul 16, 2021

Yeah, I don't think this is your fault; I think this is a problem between the locale definition at the macOS level versus the locale support at the Unix level + GNU tools that Octave uses. I suspect that the GNU tar and its stuff is not aware of the en_IN.UTF-8 locale, so it's falling back to the C (POSIX) locale, which is... well, it's not ideal, but it should work just fine for tar? Hmmm...

@ruchitrajhansa
Copy link
Author

Yes I actually encountered somewhat of a loop of octave trying to fall back to POSIX locale. I saw this issue #203 which I thought was similar to my problem because of en_IN.UTF-8 being an 'exotic' LANG as mentioned there (lol). I also tried to hardcode the locale with script editor and changed:

on export_lang()
return "default_lang=$(osascript -e 'user locale of (get system info)'); export LANG=$default_lang.UTF-8;"
end export_lang

to

on export_lang()
return "default_lang=en_US; export LANG=$default_lang.UTF-8;"
end export_lang

But it didn't really work for me.
Thanks :)

@apjanke
Copy link
Contributor

apjanke commented Jul 16, 2021

Hmmmm. I think you're on the right track here, but I don't have an answer off the top of my head. I'll try to get to this some time next week, as I have a busy weekend coming up, and your other workaround has Octave.app working for you now, right?

@ruchitrajhansa
Copy link
Author

Yeah, wanted the signal pkg to work for my signal processing class XD. But this workaround is working for me.

Cheers. :)

@AryanBagade
Copy link

Hey im getting same error and updating profile isnt working for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants