fixes for glibc time/gettimeofday issue; fix issue with history file containing one line too few if saving timestamps; fix for signal arriving while displaying readline completions

This commit is contained in:
Chet Ramey
2023-03-27 09:28:12 -04:00
parent f539a75606
commit 64b2b7c08d
25 changed files with 344 additions and 125 deletions
+44
View File
@@ -297,3 +297,47 @@ out of range 4
7 echo 9
8 echo 10
5 echo 10
$ 1
$ 2
$ 3
$ exit
6
$ 1
$ 2
$ 3
$ 4
$ 5
$ exit
6
$ 1
$ 2
$ exit
4
$ e 1
$ e 2
$ e 3
$ exit
3
e 1
e 2
e 3
$ x 1
$ x 2
$ x 3
$ x 4
$ x 5
$ exit
3
x 3
x 4
x 5
$ y 1
$ y 2
$ exit
2
y 1
y 2
$ 1
$ 2
$ exit
0
+1
View File
@@ -131,3 +131,4 @@ ${THIS_SH} ./history3.sub
${THIS_SH} ./history4.sub
${THIS_SH} ./history5.sub
${THIS_SH} ./history6.sub
${THIS_SH} ./history7.sub
+73
View File
@@ -0,0 +1,73 @@
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
# test history file truncation for various values of $HISTFILESIZE
: ${THIS_SH:=./bash}
: ${TMPDIR:=/var/tmp}
export HISTTIMEFORMAT=
export HISTFILESIZE=3
export HISTFILE=$TMPDIR/hist-$$
export PS1='$ '
rm -f $HISTFILE
# exactly the number of lines
${THIS_SH} --norc -in <<<$'1\n2\n3'
wc -l < $HISTFILE
rm -f $HISTFILE
# truncating to fewer lines
${THIS_SH} --norc -in <<<$'1\n2\n3\n4\n5'
wc -l < $HISTFILE
rm -f $HISTFILE
# the history file contains fewer lines than $HISTFILESIZE
${THIS_SH} --norc -in <<<$'1\n2'
wc -l < $HISTFILE
rm -f $HISTFILE
# now we try it without timestamps
unset HISTTIMEFORMAT
# exactly the number of lines
${THIS_SH} --norc -in <<<$'e 1\ne 2\ne 3'
wc -l < $HISTFILE
cat $HISTFILE
rm -f $HISTFILE
# truncating to fewer lines
${THIS_SH} --norc -in <<<$'x 1\nx 2\nx 3\nx 4\nx 5'
wc -l < $HISTFILE
cat $HISTFILE
rm -f $HISTFILE
# the history file contains fewer lines than $HISTFILESIZE
${THIS_SH} --norc -in <<<$'y 1\ny 2'
wc -l < $HISTFILE
cat $HISTFILE
rm -f $HISTFILE
# we want to truncate the history file to zero length
HISTFILESIZE=0
${THIS_SH} --norc -in <<<$'1\n2'
wc -l < $HISTFILE
rm -f $HISTFILE