bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange floating error with function in .bashrc


From: oxyd76
Subject: Strange floating error with function in .bashrc
Date: Tue, 26 Jul 2022 01:00:20 +0300

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   
      -fstack-clash-protection -fcf-protection -flto 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS 
uname output: Linux dell-lnx 4.19.251-1-MANJARO #1 SMP Thu Jul 7 16:57:35 UTC 
2022 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:

        Hi everyone!
        I create function for interact with termbin.com (pastebin like) service 
in my .bashrc:

termbin-clip() {
    nc termbin.com 9999 | xclip -sel clip
}

        Example usage:

$ cat ~/.bashrc|termbin-clip

        This example must be send content of .bashrc to the terrmbin.com and 
copy result url to the clipboard
        but... MAY does'nt work. This is a "floating" error :(
        
        For testing purpose i run bash without .basrc & .profile:

$ env -i bash --norc --noprofile
$ termbin-clip() { nc termbin.com 9999 | tee; }
$ cat ~/.bashrc | termbin-clip

        and it works!
        As a result of the study, it turned out that there was a "source" line 
in .bashrc 
        that led to a non-existent file:

# >>>> Vagrant command completion (start)
. 
/opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/contrib/bash/completion.sh
# <<<<  Vagrant command completion (end)

        I commented out the line, the function worked. After I registered the 
actual 
        path to the file (2.2.19 version of vagrant) the function also 
continued to work.

Repeat-By:

        Add to ~/.bashrc:
        
. /path/to/non/existent/file
termbin.clip() {
        nc termbin.com 9999 | tee
}
        
        For testing:

$ echo "FooBar"|termbin-clip

        and result link MAY does not get.
        For get link you must remove or comment bad "source" line
        from your .bashrc and repeat test.

--- BR Vadim "Oxyd" Priluzkiy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]