Closed dongxi8 closed 8 months ago
What kind of system do you use? This error is caused by an extremely old mawk
bug. The mawk bug is fixed in mawk version 1.3.3-20090710.
What kind of system do you use? This error is caused by an extremely old
mawk
bug. The mawk bug is fixed in mawk version 1.3.3-20090710.
ubuntu 16.04 LTS
mawk
how to update mawk version?
mawk is already the newest version (1.3.3-17ubuntu2).
I would recommend to update to at least ubuntu 18.04.
the old issuse solved, but another new issuse happens :
ble/term.sh: updating tput cache for TERM=xterm-256color... done
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked.
ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
how to solve it ?
I would recommend to update to at least ubuntu 18.04.
we do not have this choice~~
Thanks for the information. I didn't know Ubuntu 16.04 LTS has been using mawk
of the version in 2008. Maybe I'd later think about detecting it on the startup of ble.sh, but it will actually slow down the startup. I wouldn't like to slow down the startup just for an old buggy environment, I'll think about it more.
the old issuse solved,
How did you solve the issue? Have you installed a newer version of mawk? Or was the issue just because of your specific setup?
I'm asking this to know if the problem arises in Ubuntu 16.04 LTS in general. If the problem only happens in your specific setup, ble.sh doesn't need to be fixed, but if the problem consistently arises in Ubuntu 16.04 LTS, I'd need to think about it.
but another new issuse happens :
It didn't reproduce in my environment, but I found that it reproduces with shopt -s nocaseglob
. I'll later fix it.
the old issuse solved,
I used a new version of mawk. And then make install ble.sh
the old issuse solved, but another new issuse happens :
ble/term.sh: updating tput cache for TERM=xterm-256color... done ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
how to solve it ?
wait for your bugfix
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
wait for your bugfix
I've fixed it in 1f3cbc01. Could you update ble.sh by ble-update
and check the latest devel branch?
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
wait for your bugfix
I've fixed it in 1f3cbc0. Could you update ble.sh by
ble-update
and check the latest devel branch?
not work
ble update
cd into /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 24 (delta 17), reused 24 (delta 17), pack-reused 0
Unpacking objects: 100% (24/24), 8.07 KiB | 81.00 KiB/s, done.
From https://github.com/akinomyoga/ble.sh
f16c0d80..1afc616b master -> origin/master
Updating f16c0d80..1afc616b
Fast-forward
docs/ChangeLog.md | 15 ++++++--
lib/core-syntax.sh | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
memo/D2051.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++++
note.txt | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/edit.sh | 5 ++-
src/util.sh | 9 ++++-
6 files changed, 386 insertions(+), 39 deletions(-)
create mode 100755 memo/D2051.sh
DEPENDENCIES_PHONY=1 DEPENDENCIES_OUTPUT="out/ble.dep" DEPENDENCIES_TARGET="out/ble.sh" \
FULLVER=0.4.0-devel4 \
BUILD_GIT_VERSION="git version 2.40.1" \
BUILD_MAKE_VERSION="GNU Make 4.1" \
BUILD_GAWK_VERSION="GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0)" \
/usr/bin/gawk -f make/mwg_pp.awk ble.pp >/dev/null
bash make_command.sh install "out/ble.sh" "/home/xxx/.local/share/blesh/ble.sh"
/usr/bin/gawk -f make/mwg_pp.awk lib/core-syntax.sh > out/lib/core-syntax.sh
bash make_command.sh install "out/lib/core-syntax.sh" "/home/xxx/.local/share/blesh/lib/core-syntax.sh"
cp -p docs/ChangeLog.md out/doc/ChangeLog.md
bash make_command.sh install "out/doc/ChangeLog.md" "/home/xxx/.local/share/blesh/doc/ChangeLog.md"
[ble: reload]
not work
Thank you, but could you tell me how it doesn't work? The above log you provided seems to show that it does work, i.e., the error message of "An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked." is not output anymore.
When I start a new terminal, it still apears:
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked.
ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
not work
Thank you, but could you tell me how it doesn't work? The above log you provided seems to show that it does work, i.e., the error message of "An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked." is not output anymore.
Now , if I type "end" key, the teminal appers:
Thanks. Could you give me the results of the following commands?
$ echo "$BASHOPTS"
$ echo "$SHELLOPTS"
$ ble/widget/display-shell-version
$ time ble/util/msleep 5
I get the same error above when I source ble.sh/out/ble.sh
but it was fixed when I reverted to v0.3.4
@reubenjohn Thanks, but three different errors are reported in this issue. Which error did you experience? mawk error, readonly error, or end-key error?
time ble/util/msleep 5
result:
xxx ❲c❳ base ~ echo "$BASHOPTS"
autocd:cdable_vars:cdspell:checkwinsize:cmdhist:complete_fullquote:dirspell:expand_aliases:extglob:extquote:force_fignore:globstar:histappend:histreedit:histverify:interactive_comments:lithist:nocaseglob:nocasematch:progcomp:promptvars:sourcepath
xxx ❲c❳ base ~ echo "$SHELLOPTS"
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:noclobber
xxx ❲c❳ base ~ ble/widget/display-shell-version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu) [Ubuntu 16.04.7 LTS]
ble.sh, version 0.4.0-devel4+1afc616b (noarch) [git 2.40.1, GNU Make 4.1, GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0)]
oh-my-bash (powerline), version 1.0.0+117e203d (noarch), aliases(general), completions(git composer ssh), plugins(git bashmarks)
locale: LANG=en_US.UTF-8 LC_ADDRESS=zh_CN.UTF-8 LC_CTYPE=en_US.UTF-8 LC_IDENTIFICATION=zh_CN.UTF-8 LC_MEASUREMENT=zh_CN.UTF-8 LC_MONETARY=zh_CN.UTF-8 LC_NAME=zh_CN.UTF-8 LC_NUMERIC=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_TELEPHONE=zh_CN.UTF-8 LC_TIME=zh_CN.UTF-8
terminal: TERM=xterm wcwidth=8.0-west/15.0-2+ri, vte:2802 (1;2802;0)
xxx ❲c❳ base ~ time ble/util/msleep 5
0.005 0.005 0.000
time ble/util/msleep 5
result:
xxx ❲c❳ base ~ echo "$BASHOPTS" autocd:cdable_vars:cdspell:checkwinsize:cmdhist:complete_fullquote:dirspell:expand_aliases:extglob:extquote:force_fignore:globstar:histappend:histreedit:histverify:interactive_comments:lithist:nocaseglob:nocasematch:progcomp:promptvars:sourcepath xxx ❲c❳ base ~ echo "$SHELLOPTS" braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:noclobber xxx ❲c❳ base ~ ble/widget/display-shell-version GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu) [Ubuntu 16.04.7 LTS] ble.sh, version 0.4.0-devel4+1afc616b (noarch) [git 2.40.1, GNU Make 4.1, GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0)] oh-my-bash (powerline), version 1.0.0+117e203d (noarch), aliases(general), completions(git composer ssh), plugins(git bashmarks) locale: LANG=en_US.UTF-8 LC_ADDRESS=zh_CN.UTF-8 LC_CTYPE=en_US.UTF-8 LC_IDENTIFICATION=zh_CN.UTF-8 LC_MEASUREMENT=zh_CN.UTF-8 LC_MONETARY=zh_CN.UTF-8 LC_NAME=zh_CN.UTF-8 LC_NUMERIC=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_TELEPHONE=zh_CN.UTF-8 LC_TIME=zh_CN.UTF-8 terminal: TERM=xterm wcwidth=8.0-west/15.0-2+ri, vte:2802 (1;2802;0) xxx ❲c❳ base ~ time ble/util/msleep 5 0.005 0.005 0.000
I use
Now , if I type "end" key, the teminal appers:
this only happens when I use terminator
It is not happens in system's default GNOME Terminal
I had the same problem with ubuntu18.04 LTS。But I was able to work fine on ubuntu 20.04 LTS First run:
xxx@xxx:~$ source ble.sh/out/ble.sh
ble/term.sh: updating tput cache for TERM=xterm-256color... mawk: line 37: regular expression compile failed (missing operand)
^('[^']*'|\$'([^\\']|\\.)*'|\$?"([^\\"]|\\.)*"|\\.|[^[:space:]"'`;&|()])*
ble/term.sh: updating tput cache for TERM=xterm-256color... done
xxx@xxx:~$ mawk: line 37: regular expression compile failed (missing operand)e/lib/init-cmap.sh: updating key sequences... done
^('[^']*'|\$'([^mawk: line 37: regular expression compile failed (missing operand)e.sh: updating cache/keymap.emacs...
^('[^']*'|\$'([^\\']|\\.)*'|\$?"([^\\"]|\\.)*"|\\.|[^[:space:]"'`;&|()])*
mawk: line 37: regular expression compile failed (missing operand)
^('[^']*'|\$'([^\\']|\\.)*'|\$?"([^\\"]|\\.)*"|\\.|[^[:space:]"'`;&|()])*
mawk: line 37: regular expression compile failed (missing operand)
xxx@xxx:~$ echo "$BLE_VERSION"
0.4.0-devel4+e5cea28
xxx@xxx:~$ echo "$BASH_VERSION ($MACHTYPE)"
4.4.20(1)-release (x86_64-pc-linux-gnu)
xxx@xxx:~$
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu) [Ubuntu 18.04.6 LTS]
ble.sh, version 0.4.0-devel4+e5cea28 (noarch) [git 2.17.1, GNU Make 4.1, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)]
bash-completion, version 2.8 (hash:ada42da96765409bcc301210eb17bab248f79f5a, 72566 bytes) (noarch)
locale: LANG=en_US.UTF-8 LC_ADDRESS=zh_CN.UTF-8 LC_IDENTIFICATION=zh_CN.UTF-8 LC_MEASUREMENT=zh_CN.UTF-8 LC_MONETARY=zh_CN.UTF-8 LC_NAME=zh_CN.UTF-8 LC_NUMERIC=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_TELEPHONE=zh_CN.UTF-8 LC_TIME=zh_CN.UTF-8
terminal: TERM=xterm-256color wcwidth=10.0-west/15.0-2+ri, vte:5202 (1;5202;0)
exit bash, run again:
xxx@xxx:~$ source ble.sh/out/ble.sh
ble/term.sh: updating tput cache for TERM=xterm-256color... mawk: line 37: regular expression compile failed (missing operand)
^('[^']*'|\$'([^\\']|\\.)*'|\$?"([^\\"]|\\.)*"|\\.|[^[:space:]"'`;&|()])*
ble/term.sh: updating tput cache for TERM=xterm-256color... done
xxx@xxx:~$ mawk: line 37: regular expression compile failed (missing operand)e/lib/init-cmap.sh: updating key sequences... done
^('[^']*'|\$'([^\\']|\\.)*'|\$?"([^\\"]|\\.)*"|\\.|[^[:space:]"'`;&|()])*
xxx@xxx:~$
Now, I can't type any commands.
OK. If Ubuntu 18.04 LTS uses this 15-year-old version of mawk
, maybe I need to rethink how to work around it.
mawk
at the startup and disable the use of mawk
when the mawk
version is too old. However, this adds a fork cost at the startup because we need to run mawk
command in order to check its version. This is too much cost just for testing the broken implementation of a rare and very old mawk
. I'd like to avoid it.I'll check the possibility of using the second option.
It turned out that mawk 1.3.3-20090705 hasn't supported POSIX brackets in the regular expressions at all. I added a workaround in commit 4089c4e1. @dongxi8 @Frezrik Could you check if it works with the latest master
? You would probably need to clear the cache before starting the ble.sh session.
$ bash /path/to/ble.sh --update # update ble.sh
$ bash /path/to/ble.sh --clear-cache # clear broken cache
$ bash # start a new bash session with ble.sh
I tried it and it works, thank you very much!
@Frezrik Thank you for checking!
@akinomyoga
still have this issue:
when I start a new terminal, it appears:
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked.
ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
It turned out that mawk 1.3.3-20090705 hasn't supported POSIX brackets in the regular expressions at all. I added a workaround in commit 4089c4e. @dongxi8 @Frezrik Could you check if it works with the latest
master
? You would probably need to clear the cache before starting the ble.sh session.$ bash /path/to/ble.sh --update # update ble.sh $ bash /path/to/ble.sh --clear-cache # clear broken cache $ bash # start a new bash session with ble.sh
It doesn't reproduce with the latest version in my environment even though I tried to check it in a similar environment (Ubuntu 16.04 LTS, bash-4.3).
~/.bash_profile
? What is the content of ~/.bash_profile
?ble.sh
in ~/.bashrc
look? Could you paste the corresponding line in ~/.bashrc
?It doesn't reproduce with the latest version in my environment even though I tried to check it in a similar environment (Ubuntu 16.04 LTS, bash-4.3).
- Q1: Does the problem reproduce when you start a child Bash session inside a Bash session?
- Q2: Do you have
~/.bash_profile
? What is the content of~/.bash_profile
?- Q3: How does the line that sources
ble.sh
in~/.bashrc
look? Could you paste the corresponding line in~/.bashrc
?
Q1: not inside a Bash session. I open a new window
Q2:
[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --rcfile /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh/blerc
case $- in
*i*) ;;
*) return;;
esac
export OSH=/home/xxx/.oh-my-bash
OSH_THEME="powerline"
OMB_USE_SUDO=true
completions=(
git
composer
ssh
)
aliases=(
general
)
plugins=(
git
bashmarks
)
source "$OSH"/oh-my-bash.sh
[[ ${BLE_VERSION-} ]] && ble-attach
@akinomyoga
Thank you for your reply.
Q1: not inside a Bash session. I open a new window
Sorry, but I'm asking you to check the behavior inside a child Bash session. I know that you originally experience the problem in a new window, but in addition to that, to identify the problem, I'd like to know if the same problem happens in a slightly different situation, i.e., inside a child Bash session.
You can start a child Bash session by (1) first opening a new window. This starts a Bash session which is not a child of any other Bash sessions. In this stage, as you reported, the error message is output. (2) Then, typing bash
inside the Bash session. This starts a child Bash session inside the original Bash session. Could you check if the same error message is output also in stage (2)?
Q2:
[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --rcfile /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh/blerc [...]
Is this your ~/.bash_profile
? Those contents should not be placed in ~/.bash_profile
but should be placed in ~/.bash_profile
~/.bashrc
(edit: sorry, it is a typo). Or, do you have the same contents of ~/.bash_profile
and ~/.bashrc
? In either case, your Bash configuration would not be quite correct.
The reason that I asked Q2 and Q3 is that I wanted to check the consistency or the relationship between your ~/.bash_profile
and ~/.bashrc
. Could you give me the contents of both ~/.bash_profile
and ~/.bashrc
(with information of which one is ~/.bash_profile
and which one is ~/.bashrc
)?
Thank you for your reply.
Q1: not inside a Bash session. I open a new window
Sorry, but I'm asking you to check the behavior inside a child Bash session. I know that you originally experience the problem in a new window, but in addition to that, to identify the problem, I'd like to know if the same problem happens in a slightly different situation, i.e., inside a child Bash session.
You can start a child Bash session by (1) first opening a new window. This starts a Bash session which is not a child of any other Bash sessions. In this stage, as you reported, the error message is output. (2) Then, typing
bash
inside the Bash session. This starts a child Bash session inside the original Bash session. Could you check if the same error message is output also in stage (2)?Q2:
[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --rcfile /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh/blerc [...]
Is this your
~/.bash_profile
? Those contents should not be placed in~/.bash_profile
but should be placed in ~~/.bash_profile
~~/.bashrc
(edit: sorry, it is a typo). Or, do you have the same contents of~/.bash_profile
and~/.bashrc
? In either case, your Bash configuration would not be quite correct.The reason that I asked Q2 and Q3 is that I wanted to check the consistency or the relationship between your
~/.bash_profile
and~/.bashrc
. Could you give me the contents of both~/.bash_profile
and~/.bashrc
(with information of which one is~/.bash_profile
and which one is~/.bashrc
)?
Q1: yes, if I type bash
in a already exsited bash window, it still outputs:
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
if I type zsh
, it outputs nothing. it works as expected.
Q2: I do not have .bash_profile
Q3:
~/.bashrc
contents :
[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --rcfile /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh/blerc
# Enable the subsequent settings only in interactive sessions
case $- in
*i*) ;;
*) return;;
esac
# Path to your oh-my-bash installation.
export OSH=/home/xxx/.oh-my-bash
OSH_THEME="powerline"
OMB_USE_SUDO=true
completions=(
git
composer
ssh
)
aliases=(
general
)
plugins=(
git
bashmarks
)
source "$OSH"/oh-my-bash.sh
source /opt/ros/kinetic/setup.bash
export ROS_HOME=/media/xxx/Data/.ros
complete -C /usr/bin/mc mc
complete -C /usr/bin/di-mc mc
alias fuckcodex="git add . && git commit -m \"codex\" && git push"
alias fuckprint="rosservice call \/_node\/get_loggers && rosservice call \/_node\/set_logger_level ros debug"
alias rmbd="sudo rm -rf .\/build\/ && sudo rm -rf .\/devel\/"
alias cm="catkin_make"
alias gs="git status"
alias gc="git checkout"
alias gf="git fetch"
alias gp="git pull"
alias gl="git log"
alias ga="git add"
alias gps="git push"
alias gpss="git push --set-upstream origin"
alias gcm="git commit -m"
__conda_setup="$('/home/xxx/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/xxx/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/xxx/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/xxx/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
[[ ${BLE_VERSION-} ]] && ble-attach
????
Thanks for the reply, but I don't have an idea about what causes the problem based on the provided information. Also, I still cannot reproduce the problem with the provided .bashrc
, though I haven't installed ros/kinetics and anaconda3. I need a minimal configuration that reproduces the problem.
$ echo "$BASH"
$ "$BASH" --version
$ bash --version
$ type -a bash
As far as I see the previous report https://github.com/akinomyoga/ble.sh/issues/335#issuecomment-1683437934, can I assume the problem arises even when you comment out all the settings related to ros/kinetics and anaconda-related settings?
.bashrc
? Before trying this, please back up your original ~/.bashrc
and the command history ~/.bash_history
. After testing this, you can restore the original settings and the command history.# single line .bashrc
source ~/.local/share/blesh/ble.sh --norc
~/.bashrc
?[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --norc
[[ ${BLE_VERSION-} ]] && ble-attach
~/.bashrc
?[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --rcfile /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh/blerc
[[ ${BLE_VERSION-} ]] && ble-attach
Q4:
xxx ❲c❳ base ~ "$BASH" --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
xxx ❲c❳ base ~ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
xxx ❲c❳ base ~ type -a bash
bash is /bin/bash
xxx ❲c❳ base ~
Q5:
xxx@gg:~$
Q5-2:
xxx@gg:~$
Q5-3:
xxx@gg:~$
I find an interesting thing .
If I delete
source "$OSH"/oh-my-bash.sh
in ~/.bashrc, it works correct.
Thanks for testing.
If I delete
source "$OSH"/oh-my-bash.sh
in ~/.bashrc, it works correct.
OK, that is a big hint.
~/.bashrc
? completions=(
- git
- composer
- ssh
+ #git
+ #composer
+ #ssh
)
aliases=(
- general
+ #general
)
plugins=(
- git
- bashmarks
+ #git
+ #bashmarks
)
Another possibility is that only bash_completion + ble.sh causes the problem.
~/.bashrc
?# bashrc
[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --rcfile /home/xxx/.local/share/blesh/ble-0.4.0-devel3-2023-04-03_2/ble.sh/blerc
source /usr/share/bash-completion/bash_completion
[[ ${BLE_VERSION-} ]] && ble-attach
Q6:
not work.
Q7:
not work
Thank you for your reply.
~/.bashrc
?# bashrc
[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none --norc
source /usr/share/bash-completion/bash_completion
[[ ${BLE_VERSION-} ]] && ble-attach
~/.bashrc
?source ~/.local/share/blesh/ble.sh --norc
source /usr/share/bash-completion/bash_completion
I'm now suspecting that some other system configuration might interfere.
~/.bashrc
of Q8-2 in testing this.$ INPUTRC=/dev/null bash --noprofile
$ # <-- Does the error message reproduce?
Q8:
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
Q8-2
ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
Q9
xxx@xx:~$ INPUTRC=/dev/null bash --noprofile ble.sh (/usr/share/bash-completion/bash_completion:44): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
Thank you for being so patient. Hmm, that is a mystery.
~/.bashrc
? I.e., what is output by the line declare -p ...
, and whether the error message reproduces.# bashrc
source ~/.local/share/blesh/ble.sh --norc
declare -p BLE_VERSION BASH_COMPLETION_COMPAT_DIR >&2
readonly BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d
- declare -p ...
declare -- BLE_VERSION="0.4.0-devel4+acf3b091" bash: declare: BASH_COMPLETION_COMPAT_DIR: not found ble.sh (/home/xxx/.bashrc:4): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
xxx@xxx:~$ bash declare -- BLE_VERSION="0.4.0-devel4+acf3b091" bash: declare: BASH_COMPLETION_COMPAT_DIR: not found ble.sh (/home/xxx/.bashrc:4): An attempt to make variable `BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d' readonly was blocked. ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.
Thank you. Probably I found the culprit, though I still cannot reproduce it. Hopefully, this would be the last question:
~/.bashrc
?# bashrc
source ~/.local/share/blesh/ble.sh --norc
ble/builtin/readonly/.check-variable-name BASH_COMPLETION_COMPAT_DIR
echo "stat1=$?"
ble/builtin/readonly/.initialize-blacklist
type ble/gdict#get
declare -p _ble_builtin_readonly_blacklist
ble/gdict#get _ble_builtin_readonly_blacklist
echo "stat2=$?"
stat1=1
ble/gdict#get is a function
ble/gdict#get ()
{
ble/dict#get "$@"
}
declare -A _ble_builtin_readonly_blacklist='([xBASH_XTRACEFD]="1" [xLINES]="1" [xPRETTY_NAME]="1" [xDMAX0]="1" [xPATH]="1" [xBASHPID]="1" [xACTION]="1" [xDMAX]="1" [xDRAW_BUFF]="1" [xPREV_UMAX]="1" [xDMIN]="1" [xINPUTRC]="1" [xFILE]="1" [xLEVEL]="1" [xPIPESTATUS]="1" [xLASTWIDGET]="1" [xCOMP2]="1" [xKEYMAP]="1" [xCOMP1]="1" [xMANOPT]="1" [xDATA]="1" [xPS1]="1" [xFUNCNEST]="1" [xLAYER_UMIN]="1" [xHISTIGNORE]="1" [xREPLY]="1" [xPS4]="1" [xREG]="1" [xPREV_BUFF]="1" [xMANPATH]="1" [xLESS]="1" [xLINENO]="1" [xARG]="1" [xINSERT]="1" [xHISTSIZE]="1" [xHISTINDEX_NEXT]="1" [xPROMPT_COMMAND]="1" [xPAGER]="1" [xCOLUMNS]="1" [xKEYS]="1" [xOLDPWD]="1" [xMANPAGER]="1" [xLINE]="1" [xMAPFILE]="1" [xNAME]="1" [xCOMPV]="1" [xBASH_REMATCH]="1" [xPWD]="1" [xTIMEFORMAT]="1" [xCOMPS]="1" [xINDEX]="1" [xWIDGET]="1" [xHISTCMD]="1" [xGLOBIGNORE]="1" [xFLAG]="1" [xLAYER_UMAX]="1" [xPOSIXLY_CORRECT]="1" [xIGNOREEOF]="1" [xCC]="1" [xBUFF]="1" [xHISTCONTROL]="1" [xHIGHLIGHT_UMIN]="1" [xHIGHLIGHT_BUFF]="1" [xHISTTIMEFORMAT]="1" [xPREFIX_LEN]="1" [xBASH_COMMAND]="1" [xCDPATH]="1" [xPREV_UMIN]="1" [xHIGHLIGHT_UMAX]="1" [xVERSION]="1" [xIFS]="1" [xINDEX_FILE]="1" [xCAND]="1" [xTMOUT]="1" )'
stat2=1
Thanks for the results. Hmm, my hypothesis was broken.
Ah, maybe it is the locale. Your locale seems to be zh_CN.UTF-8
according to https://github.com/akinomyoga/ble.sh/issues/335#issuecomment-1619840559. In the collation order for alphabets in zh_CN, the capital letters and lowercase letters might be interleaved.
$ locale
$ shopt -u nocaseglob
$ [[ B == [a-c] ]]; echo "stat=$?"
[[ B == [a-c] ]]; echo "stat=$?"
xxx ❲c❳ base ~ locale LANG=en_US.UTF-8 LANGUAGE=en_US LC_CTYPE=en_US.UTF-8 LC_NUMERIC=zh_CN.UTF-8 LC_TIME=zh_CN.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES="en_US.UTF-8" LC_PAPER=zh_CN.UTF-8 LC_NAME=zh_CN.UTF-8 LC_ADDRESS=zh_CN.UTF-8 LC_TELEPHONE=zh_CN.UTF-8 LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=zh_CN.UTF-8 LC_ALL= xxx ❲c❳ base ~ shopt -u nocaseglob xxx ❲c❳ base ~ [[ B == [a-c] ]]; echo "stat=$?" stat=0 xxx ❲c❳ base ~
Thanks. Again, my hypothesis was rejected, but now I can reproduce the problem with LC_COLLATE=en_US.UTF-8
in Ubuntu 16.04 LTS. It doesn't reproduce with LC_COLLATE=ja_JP.UTF-8
. These are the results in Ubuntu 16.04:
$ LC_COLLATE=en_US.UTF-8; [[ B == [a-c] ]]; echo $?
0
$ LC_COLLATE=zh_CN.UTF-8; [[ B == [a-c] ]]; echo $?
0
$ LC_COLLATE=ja_JP.UTF-8; [[ B == [a-c] ]]; echo $?
1
This behavior is not reproduced in any other operating systems I try. For example, in Ubuntu 20.04 LTS and Ubuntu 22.04 LTS, the above test always produces "1". As far as I test the other distributions, all produce the result 1
. It seems Ubuntu introduced this collation order in 2007 and then reverted it in 2018 LTS or 2020 LTS.
I'll fix the problem later.
I added a fix and similar adjustments in commit a3b94bb3b1f1e1d8e17ba2c02b3d4cf17bf10a8d. @dongxi8 Could you update ble.sh by running ble-update
in a ble.sh session and check if the problem is solved?
ble-update
great! it works!
thanks a lot for your kindly help
I am now facing a new problem. But it need ROS environment. Do you have ROS? https://www.ros.org/blog/getting-started/
ble version: latest master version & ble-0.4.0-devel3 (2023-04-03) Bash version: 4.3.48(1)-release
I use this method to install:
then, when I type 'source ble.sh/out/ble.sh', something strange happens;