[4.1.0.23] New shell does not execute aliases

REPRODUCIBILITY (% or how often): permanent, 100%
BUILD ID = OS VERSION (Settings > About product): 4.1.0.23
HARDWARE (XA2, Xperia 10…): Xperia 10 single SIM
UI LANGUAGE: german
REGRESSION: (compared to previous public release: Yes, No, ?): yes

DESCRIPTION:
shell aliases are not executed by the bash shell.

PRECONDITIONS:
enter devel-su mode
open terminal
input an alias, that is defined in /etc/bashrc

STEPS TO REPRODUCE:

  1. open terminal
  2. input alias command
  3. output: /bin/bash: ll:not found

EXPECTED RESULT:
ll executed as defined in alias line in /etc/bashrc

================

ACTUAL RESULT:
Output: /bin/bash: ll: not found

The same for all other defined aliases.

==============

ADDITIONAL INFORMATION:
The following aliases are defined in my /etc/bashrc

alias ll=‘ls -l’
alias l=‘ls -alF’
alias …=‘cd …’
alias …=‘cd …/…’

this did work perfect till the last update to SFOS 4.1.0.23. After the update the aliases are still present in the /etc/bashrc file, but not working.

(Please ALWAYS attach relevant data such as logs, screenshots, etc…)

1 Like

I do not know but I would guess this is also due to bash being replaced by busybox?
Did you already remove busybox-symlink-bash package? (which will automatically install full blown bash again)

1 Like

It work for me for real bash, see comment of @peterleinchen.

1 Like

Busybox sh does not read /etc/bashrc or ~/.bashrc, but it does read /etc/profile and ~/.profile.

Put your aliases in there.

Myself I keep a file ~/.aliases and source that from whatever shell rc files are applicable.

4 Likes

Aliases are needed for interactive shells.
As stated in the gnu bash documentation, configuration of interactive shells should be defined in /etc/profile or .profile

2 Likes

Now I did put my aliases into /etc/profile , after the existing code there - it works, aliases are available, problem is solved. Thank you very much! :smile:

edit: Also I did not know that the new shell is no more the bash but another (busybox). Therefore I modified the title of the bug report.

Glad it is working for you now.

Note that unless you need your aliases for all users (if you actually use that feature), its good practice not to edit /etc files but rather the dotfiles in your home.

For one, not all users will need/want your alias definitions, but the ~ files also will not get overridden by updates.

Aaand you dont need root to edit them.

2 Likes

I’m the only user of the phone and if I install more user on it for some experiments I’m happy if the aliasses are available for all in the same way, including devel-su. So I wrote the aliasses to the end of the /etc/profile file. As user nemo they are available, but not as devel-su or root!
What can be the reason? Have I done something wrong? Is there another config file for the devel-su user?