-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
dietpi-unsupported_terminal.sh | Support for non-bash terminal sessions #2347
Comments
@Elijahg Very strange, just tested the current script and it works as expected here, no syntax errors, whiptail menu pops up, if $TERM variable is unsupported, also https://www.shellcheck.net/ does not show any real syntax error. Strange that First check, if your script is as it should be: If it is due to somehow with bad user/permissions/incomplete environment, workaround is to temporary rename the script to run the APT update: |
Thanks for the quick reply @MichaIng! My version doesn't match the one in v6.19.7, but is identical to the 6.17.12. Perhaps the updater script should have replaced this file by the time it had tried to install spamassasin? If there's any further investigation you'd like me to do I'll hold off updating for a bit! Thanks again! |
@Elijahg Actually, since it appears during update, easiest is to simply remove the script. The updater will anyway put the new one in place. It is a non-essential script that just works around an issue, if your SSH client ships a terminal variable $TERM that is not supported by the system. In this cases the SSH terminal usually still opens, but several binaries will throw error messages (e.g. estimating terminal size, capabilities, tput and such) and/or fail. But we just had a single case where this was the case 😉. |
Something actually that I forgot to mention @MichaIng is I use zsh instead of Bash as my shell. That shouldn't in theory make any difference though since the scripts run under Bash. I've removed it and updated successfully :) Many thanks for your help! |
@Elijahg
I think the arrays are the issue here. And the shebang So there are two solutions:
Sadly an additional Perhaps there is another way to completely skip parsing when not sourcing with bash. |
@Fourdee On the one hand, keeping everything bash-only code is the consistent way here. So all terminal session related scripts/globals require bash and we don't need to take care different compatibilities/syntax. No big deal to move the above script to bashrc.d. It is only loaded on interactive shells and theoretically not only the SSH client but as well some broken/wrong terminal emulator could ship a wrong $TERM variable, that could be included into the check (leave out SSH session check, similar to LANG=POSIX check we do). On the other hand, I like to allow users some flexibility. So where applicable and not too much effort, we can make these login scripts bourne shell compatible, which is intended for scripts in profile.d/. Okay had another though about it and simply moved the script to /etc/bashrc.d:
|
Close, since this has been resolved with above PRs. |
@MichaIng, apologies for not replying before - I for some reason only got an email notification when you closed the issue 🤔 I realise it's no longer a problem but for completeness here's that I would have said!
I was actually sourcing /etc/bashrc.d/dietpi-login.sh when logging in - it's in my .zshrc.
That would explain why when sourcing it via my .zshrc it was being executed with zsh, not bash.
I've never had a problem with the whiptail menus, I presumably everything was running purely under bash once zsh had actually launched any of the Dietpi scripts.
I'll look forward to giving it a go, if you'd like me to test anything please let me know :) Thanks again for the awesome distro and for your help! |
Interesting, This made me reading a bid about So it seems that However issue solved by moving the script to /etc/bashrc.d. It is anyway no good style to place non purge bourne shell scripts into /etc/profile.d. Perhaps we should rename ours to |
Creating a bug report/issue:
Updating from v6.17.12 to v6.19.7 fails. There seems to be a problem with the /etc/profile.d/unsupported_terminal.sh script, I've had a peek in it but it seems fine so not really sure what's going on!
Required Information:
G_DIETPI_VERSION_CORE=6
G_DIETPI_VERSION_SUB=17
G_DIETPI_VERSION_RC=12
Linux jaffa 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux
Additional Information (if applicable):
dietpi-bugreport
ID | 04ebad78-518e-403e-8c90-4cbeecb52127Steps to reproduce:
Run dietpi-update on a 6.17.12 install. The installation errors with
-su: 19: /etc/profile.d/dietpi-unsupported_terminal.sh: Syntax error: "(" unexpected (expecting "fi")
Subsequent runs of dietpi-update and apt-get result in the same error.
Expected behaviour:
Installation should complete.
Actual behaviour:
Installation fails
Extra details:
echo $TERM returns xterm-256color
Attempt to apt-get upgrade:
eli@jaffa:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
docker-ce mariadb-client-10.1 mariadb-server mariadb-server-10.1 mariadb-server-core-10.1
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up spamassassin (3.4.2-1~deb9u1) ...
-su: 19: /etc/profile.d/dietpi-unsupported_terminal.sh: Syntax error: "(" unexpected (expecting "fi")
dpkg: error processing package spamassassin (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
spamassassin
E: Sub-process /usr/bin/dpkg returned an error code (1)
The text was updated successfully, but these errors were encountered: