Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -Wall
uname output: Linux daedalus 6.1.0-34-amd64 #1 SMP PREEMPT_DYNAMIC Debian
6.1.135-1 (2025-04-25) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.2
Patch Level: 15
Release Status: release
Description:
If MAILPATH and MAILCHECK are set to enable mail notification, then
when activating programmable completion, the mail notification message
will interrupt the partially complete command line.
NOTE: This problem does NOT occur with just the default bash/readline
completion.
I've only found one forum post describing this problem, so I must be
one of the few who regularly use bash, and also have mail delivered
locally.
https://unix.stackexchange.com/questions/788380/how-can-i-disable-the-you-have-new-mail-in-message-in-bash-complete
Repeat-By:
Programmable completion for "ls" is :
$ complete -p ls ;
complete -F _longopt ls
Programmable completion provided by the "bash-completion" package :
$ dpkg -l bash-completion
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============-============-============-==========================================
ii bash-completion 1:2.11-6 all programmable
completion for the bash shell
Nothing esoteric up readline's inputrc sleeve :
$ cat ~/.inputrc ;
set editing-mode vi
$ echo $INPUTRC ;
1. Enable mail notification :
$ MAILPATH=$MAIL ;
$ MAILCHECK=5 ;
2. Cause new mail to appear in $MAIL :
$ echo "Hello, world." | mailx -s test $USER
3. Type a partial command, wait until the MAILCHECK time has
elapsed, then initiate completion by pressing the Tab key.
NOTE: Step #2 above was performed prior to each of the examples
below. Also, the string "<TAB>" indicates the cursor position
when the Tab key was pressed to initiate completion, while "_"
indicates the cursor position after completion.
# Completion with unique candidate name :
$ ls -d Docu<TAB>You have new mail in /var/mail/troyl
ments/_
# Completion with multiple candidate names :
$ ls -d P<TAB>You have new mail in /var/mail/troyl
<TAB>
Pictures/ Podcasts/ Public/
$ ls -d P_
# Completion with a large number of candidate names :
$ ls -d <TAB>You have new mail in /var/mail/troyl
<TAB>
Display all 220 possibilities? (y or n)
$ ls -d _
# Disable programmable command completion :
$ complete -r ; complete -p ls ;
-bash: complete: ls: no completion specification
# Completion with unique candidate name :
$ ls -d Docu<TAB>ments/_
# Completion with multiple candidate names :
$ ls -d P<TAB><TAB>
Pictures/ Podcasts/ Public/
$ ls -d P_
# Completion with a large number of candidate names :
$ ls -d <TAB><TAB>
Display all 220 possibilities? (y or n)
$ ls -d _