You are not logged in.

#1 2021-02-18 20:22:29

chrberrig
Member
Registered: 2021-02-18
Posts: 8

/etc/profile.d/locale.sh not sourced, and no special chars [Solved]

/etc/profile.d/locale.sh not sourced, only POSIX locale in X.org, and no special chars in vim.

so, my issue is the following; currently when i run "locale" from st, the output is "POSIX" only and LANG is unset, which led me to believe, from this post:
https://bbs.archlinux.org/viewtopic.php?id=248589
that /etc/profile.d/locale.sh is not being sourced.

I attempted to source manually, and got the expected output from "locale" afterwards:

LANG=da_DK.UTF-8
LC_CTYPE="da_DK.UTF-8"
LC_NUMERIC="da_DK.UTF-8"
LC_TIME="da_DK.UTF-8"
LC_COLLATE="da_DK.UTF-8"
LC_MONETARY="da_DK.UTF-8"
LC_MESSAGES=
LC_PAPER="da_DK.UTF-8"
LC_NAME="da_DK.UTF-8"
LC_ADDRESS="da_DK.UTF-8"
LC_TELEPHONE="da_DK.UTF-8"
LC_MEASUREMENT="da_DK.UTF-8"
LC_IDENTIFICATION="da_DK.UTF-8"
LC_ALL=

Which seems to be telling that the underlying problem is  /etc/profile.d/locale.sh is not being sourced.
However, it does not solve the problem since i still don't know WHY  /etc/profile.d/locale.sh is not being sourced, nor how to figure it out.

This is the first part of my problem.
The second part which is (I believe) related to this, is that when I am using vim, both in xterm and st gets <ffffffff> when I attempt to write æ,ø or å (danish chars). This is also the case when i write in the st term, but not when writing in xterm.
A strange behavior i have noted is that when i have manually sourced /etc/profile.d/locale.d, it takes two keypresses to produce the <ffffffff> value, whereas it only takes one, if it isn't sourced.

I would be very grateful for any suggestions, since i have been struggling with this on/off for half a year.
Sorry for my broken english.

Last edited by chrberrig (2021-03-31 07:22:25)

Offline

#2 2021-02-18 20:52:00

seth
Member
Registered: 2012-09-03
Posts: 51,679

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

pacman -Qkk filesystem
cat /etc/profile

/etc/profile.d/locale.sh is supposed to be sourced by /etc/profile which is supposed to be sourced by your login shell, what gets you to the final question: what's your login shell? How do you login/start X11?

Offline

#3 2021-02-19 16:02:50

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

The "pacman -Qkk filesystem" yields:

backup file: filesystem: /etc/fstab (Modification time mismatch)
backup file: filesystem: /etc/fstab (Size mismatch)
backup file: filesystem: /etc/group (Modification time mismatch)
backup file: filesystem: /etc/group (Size mismatch)
backup file: filesystem: /etc/gshadow (Modification time mismatch)
backup file: filesystem: /etc/gshadow (Size mismatch)
backup file: filesystem: /etc/hosts (Modification time mismatch)
backup file: filesystem: /etc/hosts (Size mismatch)
backup file: filesystem: /etc/passwd (Modification time mismatch)
backup file: filesystem: /etc/passwd (Size mismatch)
backup file: filesystem: /etc/profile (Modification time mismatch)
backup file: filesystem: /etc/resolv.conf (Modification time mismatch)
backup file: filesystem: /etc/resolv.conf (Size mismatch)
backup file: filesystem: /etc/shadow (Modification time mismatch)
backup file: filesystem: /etc/shadow (Size mismatch)
backup file: filesystem: /etc/shells (Modification time mismatch)
backup file: filesystem: /etc/shells (Size mismatch)
filesystem: 118 total files, 0 altered files

The cat /etc/profile yields:

# /etc/profile

# Set our umask
umask 022

# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

# Append our default paths
append_path '/usr/local/sbin'
append_path '/usr/local/bin'
append_path '/usr/bin'

# Force PATH to be environment
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
        for profile in /etc/profile.d/*.sh; do
                test -r "$profile" && . "$profile"
        done
        unset profile
fi

# Unload our profile API functions
unset -f append_path

# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
   test "$PS1" &&\
   test -z "$POSIXLY_CORRECT" &&\
   test "${0#-}" != sh &&\
   test -r /etc/bash.bashrc
then
        . /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

I use zsh as shell

I am not 100% sure what you mean by how i login/start X11, but i got this bit of code in the .xinitrc:

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile

slstatus &
nm-applet &
unclutter &
$HOME/.fehbg &
exec dwm

is this what you asked?
Thank you for the quick reply btw

Last edited by chrberrig (2021-02-19 16:07:25)

Offline

#4 2021-02-19 16:11:00

seth
Member
Registered: 2012-09-03
Posts: 51,679

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

Please use code tags, not quote tags.

What executes xinitrc? xinit/startx? XDM? Some xsession script from a different DM?
Is the locale also broken when you boot the multi-user.target (login to a console, don't start X11 - in doubt see http://wiki.archlinux.org/index.php/Sys … _boot_into )

What does your ~/.zprofile and ~/.zshrc look like?

You forgot to post the output of "pacman -Qkk filesystem"

Last edited by seth (2021-02-19 16:11:31)

Offline

#5 2021-03-07 16:20:33

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

No .zshrc or .zshprofile, only have a .zshenv

content of .zshenv is:


  1 # Lines configured by zsh-newuser-install
  2 HISTFILE=~/.histfile
  3 HISTSIZE=1000
  4 SAVEHIST=1000
  5 bindkey -v
  6 # End of lines configured by zsh-newuser-install
  7 # The following lines were added by compinstall
  8 zstyle :compinstall filename '/home/USERNAME/.zshrc'
  9
 10 autoload -Uz compinit
 11 compinit
 12 # End of lines added by compinstall
 13 #
 14 # === Env. Variables ===
 15 # --- TeX ---
 16 export PATH=/usr/local/texlive/2019/bin/x86_64-linux:$PATH
 17 export MANPATH=/usr/local/texlive/2019/texmf-dist/doc/man:$MANPATH
 18 export INFOPATH=/usr/local/texlive/2019/texmf-dist/doc/info:$INFOPATH
 19
 20 # --- Dotfiles manager ---
 21 # alias dfmgr='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
 22 export PATH="$PATH:$(du "$HOME/.scripts" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" # Adds .scripts and all its subfolders to path.
 23
 24 # === Git in Prompt ===
 25 # --- This formats the promt, to show current check out'd git branch and changes promt format to linux standard format. ---
 26 # --- git integration ---
 27 autoload -Uz vcs_info
 28 precmd_vcs_info() { vcs_info }
 29 precmd_functions+=( precmd_vcs_info )
 30 setopt prompt_subst
 31 # RPROMPT=\$vcs_info_msg_0_
 32 zstyle ':vcs_info:git:*' formats '%F{202}%r(%b) %f'
 33 zstyle ':vcs_info:*' enable git
 34
 35 # --- colours ---
 36 # autoload -U colors && colors
 37 # PS1="[%{fg[green]%}%n@%M %{fg[orange]%}%~] %{fg[magenta]%}%#%{$reset_color%}% "
 38 PS1="[%F{green}%n%f@%F{cyan}%m%f %F{blue}%~%f] \$vcs_info_msg_0_%F{magenta}%#%f"
 39
 40 # === Starts X11 at login ===
 41 if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
 42         exec startx
 43 fi
 44
 45 # --- This is for making new/modified commands and folder shortcuts, sourced from .config folder ---
 46 # [ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc" # Load shortcut aliases
 47 [ -f "$HOME/.scripts/aliasrc" ] && source "$HOME/.scripts/aliasrc"
 48 [ -f "$HOME/.scripts/envsrc" ] && source "$HOME/.scripts/envsrc"

Last edited by chrberrig (2021-03-31 07:29:55)

Offline

#6 2021-03-07 16:57:15

loqs
Member
Registered: 2014-03-06
Posts: 17,439

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

What is the contents of /etc/zsh/zprofile

Offline

#7 2021-03-07 17:29:37

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

emulate sh -c 'source /etc/profile'

Offline

#8 2021-03-07 17:33:13

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

the content of /etc/profile is

  1 # /etc/profile
  2
  3 # Set our umask
  4 umask 022
  5
  6 # Append "$1" to $PATH when not already in.
  7 # This function API is accessible to scripts in /etc/profile.d
  8 append_path () {
  9     case ":$PATH:" in
 10         *:"$1":*)
 11             ;;
 12         *)
 13             PATH="${PATH:+$PATH:}$1"
 14     esac
 15 }
 16
 17 # Append our default paths
 18 append_path '/usr/local/sbin'
 19 append_path '/usr/local/bin'
 20 append_path '/usr/bin'
 21
 22 # Force PATH to be environment
 23 export PATH
 24
 25 # Load profiles from /etc/profile.d
 26 if test -d /etc/profile.d/; then
 27         for profile in /etc/profile.d/*.sh; do
 28                 test -r "$profile" && . "$profile"
 29         done
 30         unset profile
 31 fi
 32
 33 # Unload our profile API functions
 34 unset -f append_path
 35
 36 # Source global bash config, when interactive but not posix or sh mode
 37 if test "$BASH" &&\
 38    test "$PS1" &&\
 39    test -z "$POSIXLY_CORRECT" &&\
 40    test "${0#-}" != sh &&\
 41    test -r /etc/bash.bashrc
 42 then
 43         . /etc/bash.bashrc
 44 fi
 45
 46 # Termcap is outdated, old, and crusty, kill it.
 47 unset TERMCAP
 48
 49 # Man is much better than us at figuring this out
 50 unset MANPATH

Offline

#9 2021-03-07 19:43:30

seth
Member
Registered: 2012-09-03
Posts: 51,679

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

man zshall wrote:

STARTUP/SHUTDOWN FILES
       Commands are first read from /etc/zshenv; this cannot be overridden.  Subsequent behaviour
       is modified by the RCS and GLOBAL_RCS options; the former affects all startup files, while
       the second only affects global startup files (those shown here with an path starting  with
       a  /).  If one of the options is unset at any point, any subsequent startup file(s) of the
       corresponding type will not be read.  It is also possible for a file in $ZDOTDIR to re-en‐
       able GLOBAL_RCS. Both RCS and GLOBAL_RCS are set by default.

       Commands are then read from $ZDOTDIR/.zshenv.  If the shell is a login shell, commands are
       read from /etc/zprofile and then $ZDOTDIR/.zprofile.  Then, if the shell  is  interactive,
       commands  are  read  from /etc/zshrc and then $ZDOTDIR/.zshrc.  Finally, if the shell is a
       login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.

The answer is in this. Read it until you find it ;-)

Offline

#10 2021-03-07 20:24:46

loqs
Member
Registered: 2014-03-06
Posts: 17,439

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

@seth is the second note block from Zsh#Startup/Shutdown_files out dated? (bash user so no personal experience)
Edit this note:

The paths used in Arch's zsh package are different from the default ones used in the man pages (FS#48992).

Last edited by loqs (2021-03-07 20:26:29)

Offline

#11 2021-03-07 20:31:44

seth
Member
Registered: 2012-09-03
Posts: 51,679

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

No, but the global paths are not relevant here smile

Edit: helpful comment, though - I didn't even realize that the paths are off… so could have been a red herring.

Last edited by seth (2021-03-07 20:33:26)

Offline

#12 2021-03-07 20:59:02

loqs
Member
Registered: 2014-03-06
Posts: 17,439

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

Is the key line 42 of .zshenv?

Offline

#13 2021-03-07 21:03:21

seth
Member
Registered: 2012-09-03
Posts: 51,679

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

Offline

#14 2021-03-27 17:53:09

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

I am appearently to ignorant for this: I don't get it.
it is something that has to do w the non-global paths, and from the order in which zsh is sourcing.
To clearify, I tried to find out about line 42 in .zshenv, but I have a suspicion that it fails even before this point, since:

echo $BASH

and

echo $ZDOTDIR

both return nothing.
Can i buy an extra hint, ask the audience, call a friend etc.?

Offline

#15 2021-03-27 18:03:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

What are these doing in your .xinitrc?

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#16 2021-03-27 18:09:16

loqs
Member
Registered: 2014-03-06
Posts: 17,439

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

From .zshenv

 41 if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
 42         exec startx
 43 fi
 44
 45 # --- This is for making new/modified commands and folder shortcuts, sourced from .config folder ---
 46 # [ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc" # Load shortcut aliases
 47 [ -f "$HOME/.scripts/aliasrc" ] && source "$HOME/.scripts/aliasrc"
 48 [ -f "$HOME/.scripts/envsrc" ] && source "$HOME/.scripts/envsrc"

If lines 42 is executed then the exec replaces the current process with startx.  So lines 47 and 48 will not be reached.
However more importantly for your issue the sourcing of .zshenv which is now executing startx is as far as startup file sourcing will progress.  If you moved it to .zshrc or .zshlogin then the start up files between those two points will be sourced.

Last edited by loqs (2021-03-27 18:12:14)

Offline

#17 2021-03-31 07:11:47

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

Holy cuttlefish, It worked smile

So all i did were to make a .zshrc move the lines:

if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
        exec startx
fi

from .zshenv to .zshrc

Now i get all the expected results from locale and access to æøå in both vim and terminal smile

I still feel that the mystery is only 95% solved however, since I in terminal sessions still had access to both envsrc and aliasrc that were sourced after the

exec startx 

If anyone have a suggestion to why this is the case you are more than more than welcome to provide me with this insight, but the main issue I had is resolved smile

Thank you all!

Last edited by chrberrig (2021-03-31 07:24:56)

Offline

#18 2021-03-31 07:28:31

seth
Member
Registered: 2012-09-03
Posts: 51,679

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

The interactive non-login shells will still source zshenv but not meet the  conditions to "exec startx" (cause DISPLAY is set)
Also please nb.

man zshall wrote:

As /etc/zshenv is run for all instances of zsh, it is important that it be kept as small as possible. In particular, it is a good idea to put code that does not need to be run for every single shell behind a test of the form `if [[ -o rcs ]]; then ...' so that it will not be executed when zsh is invoked with the `-f' option.

Don't crowd your zshenv w/ shit and distribute the requirements to zprofile and zshrc accordingly.

Offline

#19 2021-03-31 07:33:35

chrberrig
Member
Registered: 2021-02-18
Posts: 8

Re: /etc/profile.d/locale.sh not sourced, and no special chars [Solved]

Thank you smile

Note taken, digital spring cleaning is now initiated wink

Offline

Board footer

Powered by FluxBB