I was looking into replacing usr/bin/sh
with dash to improve shell performance on my up to date EndeavourOS (x86_64, 5.14.14-arch1-1) installation. However, I seem to have come across a bug of sorts in the usr/bin/yad-settings
file. When I ran the checkbashisms script on all the #!/bin/sh
shebang prefixed files in /usr/bin
to identify any scripts utilizing non-posix compliant bash syntax, this file got basically spammed all over the command’s output log (log provided below).
Large portions of this file’s syntax is incompatible with usr/bin/sh
(or usr/bin/dash
). Since I didn’t remember ever actually using the yad-eos package, I tried removing it, but unfortunately it is a dependency for a lot of the other existing -eos packages. Is there any way to get around this? Why exactly is an official package improperly using shebang’s anyway(although I understand that this may be an issue upstream of this repo and out of EOS’s control). Has anyone else successfully migrated an EOS installation from sh to dash before who could tell me what I am missing; because afaik I can’t proceed without the #!/bin/sh
prefixed files using proper syntax? Thanks.
(Relevant) Cmd-output: `checkbashisms`
$ find /usr/bin/ -type f -perm -o=r -print0 | xargs -0 gawk '/^#!.*( |[/])sh/{printf "%s\0", FILENAME} {nextfile}' | xargs -0 checkbashisms
possible bashism in /usr/bin/yad-settings line 28 ($RANDOM):
KEY=$RANDOM
possible bashism in /usr/bin/yad-settings line 61 ($"foo" should be eval_gettext "foo"):
yad --plug=$KEY --tabnum=1 --bool-fmt=t --quoted-output --separator=" " --form --scroll \
--text=$"Main YAD settings and default values\n\n" \
--field=$"Width of dialog window::NUM" \
--field=$"Height of dialog window::NUM" \
--field=$"Border width around dialog::NUM" \
--field=$"Show remaining time and percentage in timeout progress bar:CHK" \
--field=$"Combo-box in entry dialog is always editable:CHK" \
--field=$"Default terminal command:" \
--field=$"Default open command:" \
--field=$"Default date format:" \
--field=$"Default URI color in text-info dialog::CLR" \
--field=$"Maximum number of tabs in notebook dialog::NUM" \
--field=$"Use large previews in file selection dialogs:CHK" \
--field=$"Search entry width::NUM" \
--field=$"Ignore unknown command-line options:CHK" \
--field=$"Enable debug mode with information about deprecated features:CHK" \
-- \
"$(gsettings get yad.settings width)!-1..32767" \
"$(gsettings get yad.settings height)!-1..32767" \
$(gsettings get yad.settings border) \
$(gsettings get yad.settings show-remain) \
$(gsettings get yad.settings combo-always-editable) \
"$(eval echo $(gsettings get yad.settings terminal))" \
"$(eval echo $(gsettings get yad.settings open-command))" \
"$(eval echo $(gsettings get yad.settings date-format))" \
"$(eval echo $(gsettings get yad.settings uri-color))" \
$(gsettings get yad.settings max-tab) \
$(gsettings get yad.settings large-preview) \
$(gsettings get yad.settings search-width) \
$(gsettings get yad.settings ignore-unknown-options) \
$(gsettings get yad.settings debug) > $res1 &
possible bashism in /usr/bin/yad-settings line 65 ($"foo" should be eval_gettext "foo"):
themes=$"<Empty>!"
possible bashism in /usr/bin/yad-settings line 67 (should be VAR="${VAR}foo"):
[[ $t == $SV_THEME ]] && themes+="^$t!" || themes+="$t!"
possible bashism in /usr/bin/yad-settings line 67 (alternative test command ([[ foo ]] should be [ foo ])):
[[ $t == $SV_THEME ]] && themes+="^$t!" || themes+="$t!"
possible bashism in /usr/bin/yad-settings line 67 (should be 'b = a'):
[[ $t == $SV_THEME ]] && themes+="^$t!" || themes+="$t!"
possible bashism in /usr/bin/yad-settings line 73 (should be VAR="${VAR}foo"):
[[ $b == $HE ]] && homend+="^$b!" || homend+="$b!"
possible bashism in /usr/bin/yad-settings line 73 (alternative test command ([[ foo ]] should be [ foo ])):
[[ $b == $HE ]] && homend+="^$b!" || homend+="$b!"
possible bashism in /usr/bin/yad-settings line 73 (should be 'b = a'):
[[ $b == $HE ]] && homend+="^$b!" || homend+="$b!"
possible bashism in /usr/bin/yad-settings line 92 ($"foo" should be eval_gettext "foo"):
yad --plug=$KEY --tabnum=2 --bool-fmt=t --quoted-output --separator=" " --form --scroll \
--text=$"YAD settings for text editor\nThis settings only usefull when YAD built with GtkSourceView\n\n" \
--field=$"Default theme for text-info dialog::CB" ${themes%?} \
--field=$"Show line numbers:CHK" $(gsettings get yad.sourceview line-num) \
--field=$"Hightlight current line:CHK" $(gsettings get yad.sourceview line-hl) \
--field=$"Enable line mars mode:CHK" $(gsettings get yad.sourceview line-marks) \
--field=$"Color of first type marks::CLR" "$(eval echo $(gsettings get yad.sourceview mark1-color))" \
--field=$"Color of second type marks::CLR" "$(eval echo $(gsettings get yad.sourceview mark2-color))" \
--field=$"Right margin position::NUM" $(gsettings get yad.sourceview right-margin) \
--field=$"Highlight matching brackets:CHK" $(gsettings get yad.sourceview brackets) \
--field=$"Use autoindentation:CHK" $(gsettings get yad.sourceview indent) \
--field=$"Smart Home/End behavior::CB" ${homend%?} \
--field=$"Use smart backspace:CHK" $(gsettings get yad.sourceview smart-bs) \
--field=$"Tabulation width::NUM" $(gsettings get yad.sourceview tab-width) \
--field=$"Indentation width::NUM" $(gsettings get yad.sourceview indent-width) \
--field=$"Insert spaces instead of tabulation:CHK" $(gsettings get yad.sourceview spaces) > $res2 &
possible bashism in /usr/bin/yad-settings line 98 ($"foo" should be eval_gettext "foo"):
yad --title=$"YAD settings" --key=$KEY --width=475 --height=600 --image=preferences-other \
--button=$"Load defaults!view-refresh:3" --button="yad-save:0" --button="yad-close:1" \
--text=$"<span size='xx-large' weight='bold'>YAD settings editor</span>" --text-align=center \
--notebook --stack --expand --tab=$"Main" --tab=$"Editor"
possible bashism in /usr/bin/yad-settings line 100 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ $? -eq 0 ]]; then
possible bashism in /usr/bin/yad-settings line 101 ('$(< foo)' should be '$(cat foo)'):
eval r1=($(< $res1))
possible bashism in /usr/bin/yad-settings line 102 ('$(< foo)' should be '$(cat foo)'):
eval r2=($(< $res2))
possible bashism in /usr/bin/yad-settings line 105 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings width ${r1[0]}
possible bashism in /usr/bin/yad-settings line 106 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings height ${r1[1]}
possible bashism in /usr/bin/yad-settings line 107 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings border ${r1[2]}
possible bashism in /usr/bin/yad-settings line 108 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings show-remain ${r1[3]}
possible bashism in /usr/bin/yad-settings line 109 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings combo-always-editable ${r1[4]}
possible bashism in /usr/bin/yad-settings line 110 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings terminal "${r1[5]}"
possible bashism in /usr/bin/yad-settings line 111 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings open-command "${r1[6]}"
possible bashism in /usr/bin/yad-settings line 112 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings date-format "${r1[7]}"
possible bashism in /usr/bin/yad-settings line 113 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings uri-color ${r1[8]}
possible bashism in /usr/bin/yad-settings line 114 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings max-tab ${r1[9]}
possible bashism in /usr/bin/yad-settings line 115 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings large-preview ${r1[10]}
possible bashism in /usr/bin/yad-settings line 116 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings search-width ${r1[11]}
possible bashism in /usr/bin/yad-settings line 117 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings ignore-unknown-options ${r1[12]}
possible bashism in /usr/bin/yad-settings line 118 (bash arrays, ${name[0|*|@]}):
gsettings set yad.settings debug ${r1[13]}
possible bashism in /usr/bin/yad-settings line 121 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview theme "${r2[0]}"
possible bashism in /usr/bin/yad-settings line 122 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview line-num ${r2[1]}
possible bashism in /usr/bin/yad-settings line 123 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview line-hl ${r2[2]}
possible bashism in /usr/bin/yad-settings line 124 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview line-marks ${r2[3]}
possible bashism in /usr/bin/yad-settings line 125 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview mark1-color ${r2[4]}
possible bashism in /usr/bin/yad-settings line 126 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview mark2-color ${r2[5]}
possible bashism in /usr/bin/yad-settings line 127 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview right-margin ${r2[6]}
possible bashism in /usr/bin/yad-settings line 128 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview brackets ${r2[7]}
possible bashism in /usr/bin/yad-settings line 129 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview indent ${r2[8]}
possible bashism in /usr/bin/yad-settings line 130 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview homend ${r2[9]}
possible bashism in /usr/bin/yad-settings line 131 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview smart-bs ${r2[10]}
possible bashism in /usr/bin/yad-settings line 132 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview tab-width ${r2[11]}
possible bashism in /usr/bin/yad-settings line 133 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview indent-width ${r2[12]}
possible bashism in /usr/bin/yad-settings line 134 (bash arrays, ${name[0|*|@]}):
gsettings get yad.sourceview spaces ${r2[13]}
possible bashism in /usr/bin/yad-settings line 135 (alternative test command ([[ foo ]] should be [ foo ])):
elif [[ $? -eq 3 ]]; then
File-contents: `/usr/bin/yad-settings`
#! /bin/sh
# -*- mode: sh -*-
#
# YAD settings editor. This file is part of YAD
#
# YAD is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# YAD is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# YAD. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2021, Victor Ananjevsky <ananasik@gmail.com>
#
TEXTDOMAIN=yad
TEXTDOMAINDIR=/usr/share/locale
res1=$(mktemp --tmpdir ys-tab1.XXXXXXXX)
res2=$(mktemp --tmpdir ys-tab2.XXXXXXXX)
trap "rm -f $res1 $res2" EXIT
KEY=$RANDOM
# first tab (values at the end due to possible hyphens)
yad --plug=$KEY --tabnum=1 --bool-fmt=t --quoted-output --separator=" " --form --scroll \
--text=$"Main YAD settings and default values\n\n" \
--field=$"Width of dialog window::NUM" \
--field=$"Height of dialog window::NUM" \
--field=$"Border width around dialog::NUM" \
--field=$"Show remaining time and percentage in timeout progress bar:CHK" \
--field=$"Combo-box in entry dialog is always editable:CHK" \
--field=$"Default terminal command:" \
--field=$"Default open command:" \
--field=$"Default date format:" \
--field=$"Default URI color in text-info dialog::CLR" \
--field=$"Maximum number of tabs in notebook dialog::NUM" \
--field=$"Use large previews in file selection dialogs:CHK" \
--field=$"Search entry width::NUM" \
--field=$"Ignore unknown command-line options:CHK" \
--field=$"Enable debug mode with information about deprecated features:CHK" \
-- \
"$(gsettings get yad.settings width)!-1..32767" \
"$(gsettings get yad.settings height)!-1..32767" \
$(gsettings get yad.settings border) \
$(gsettings get yad.settings show-remain) \
$(gsettings get yad.settings combo-always-editable) \
"$(eval echo $(gsettings get yad.settings terminal))" \
"$(eval echo $(gsettings get yad.settings open-command))" \
"$(eval echo $(gsettings get yad.settings date-format))" \
"$(eval echo $(gsettings get yad.settings uri-color))" \
$(gsettings get yad.settings max-tab) \
$(gsettings get yad.settings large-preview) \
$(gsettings get yad.settings search-width) \
$(gsettings get yad.settings ignore-unknown-options) \
$(gsettings get yad.settings debug) > $res1 &
# get list for themes
eval SV_THEME=$(gsettings get yad.sourceview theme)
themes=$"<Empty>!"
for t in $(yad-tools --show-themes); do
[[ $t == $SV_THEME ]] && themes+="^$t!" || themes+="$t!"
done
# get list for home/end
eval HE==$(gsettings get yad.sourceview homend)
for b in never before after always; do
[[ $b == $HE ]] && homend+="^$b!" || homend+="$b!"
done
# second tab
yad --plug=$KEY --tabnum=2 --bool-fmt=t --quoted-output --separator=" " --form --scroll \
--text=$"YAD settings for text editor\nThis settings only usefull when YAD built with GtkSourceView\n\n" \
--field=$"Default theme for text-info dialog::CB" ${themes%?} \
--field=$"Show line numbers:CHK" $(gsettings get yad.sourceview line-num) \
--field=$"Hightlight current line:CHK" $(gsettings get yad.sourceview line-hl) \
--field=$"Enable line mars mode:CHK" $(gsettings get yad.sourceview line-marks) \
--field=$"Color of first type marks::CLR" "$(eval echo $(gsettings get yad.sourceview mark1-color))" \
--field=$"Color of second type marks::CLR" "$(eval echo $(gsettings get yad.sourceview mark2-color))" \
--field=$"Right margin position::NUM" $(gsettings get yad.sourceview right-margin) \
--field=$"Highlight matching brackets:CHK" $(gsettings get yad.sourceview brackets) \
--field=$"Use autoindentation:CHK" $(gsettings get yad.sourceview indent) \
--field=$"Smart Home/End behavior::CB" ${homend%?} \
--field=$"Use smart backspace:CHK" $(gsettings get yad.sourceview smart-bs) \
--field=$"Tabulation width::NUM" $(gsettings get yad.sourceview tab-width) \
--field=$"Indentation width::NUM" $(gsettings get yad.sourceview indent-width) \
--field=$"Insert spaces instead of tabulation:CHK" $(gsettings get yad.sourceview spaces) > $res2 &
# main dialog
yad --title=$"YAD settings" --key=$KEY --width=475 --height=600 --image=preferences-other \
--button=$"Load defaults!view-refresh:3" --button="yad-save:0" --button="yad-close:1" \
--text=$"<span size='xx-large' weight='bold'>YAD settings editor</span>" --text-align=center \
--notebook --stack --expand --tab=$"Main" --tab=$"Editor"
if [[ $? -eq 0 ]]; then
eval r1=($(< $res1))
eval r2=($(< $res2))
# Main settings
gsettings set yad.settings width ${r1[0]}
gsettings set yad.settings height ${r1[1]}
gsettings set yad.settings border ${r1[2]}
gsettings set yad.settings show-remain ${r1[3]}
gsettings set yad.settings combo-always-editable ${r1[4]}
gsettings set yad.settings terminal "${r1[5]}"
gsettings set yad.settings open-command "${r1[6]}"
gsettings set yad.settings date-format "${r1[7]}"
gsettings set yad.settings uri-color ${r1[8]}
gsettings set yad.settings max-tab ${r1[9]}
gsettings set yad.settings large-preview ${r1[10]}
gsettings set yad.settings search-width ${r1[11]}
gsettings set yad.settings ignore-unknown-options ${r1[12]}
gsettings set yad.settings debug ${r1[13]}
# GtkSourceView settings
gsettings get yad.sourceview theme "${r2[0]}"
gsettings get yad.sourceview line-num ${r2[1]}
gsettings get yad.sourceview line-hl ${r2[2]}
gsettings get yad.sourceview line-marks ${r2[3]}
gsettings get yad.sourceview mark1-color ${r2[4]}
gsettings get yad.sourceview mark2-color ${r2[5]}
gsettings get yad.sourceview right-margin ${r2[6]}
gsettings get yad.sourceview brackets ${r2[7]}
gsettings get yad.sourceview indent ${r2[8]}
gsettings get yad.sourceview homend ${r2[9]}
gsettings get yad.sourceview smart-bs ${r2[10]}
gsettings get yad.sourceview tab-width ${r2[11]}
gsettings get yad.sourceview indent-width ${r2[12]}
gsettings get yad.sourceview spaces ${r2[13]}
elif [[ $? -eq 3 ]]; then
# Load default settings
gsettings reset-recursively yad.settings
gsettings reset-recursively yad.sourceview
fi