Por que meu Cygwin Bash sempre lê do terminal quando tento executar um comando externo?

1

Please note that this is NOT the "command not found problem" where the path is incomplete. External commands appear to start OK and immediately seek terminal input instead of producing terminal output.

Suponho que eu tenha usado meus arquivos .profile / .bashrc ou algo assim ... mas não consigo ver a causa do meu problema.

Eu começo o cygwin bash interactive usando o mintty 2.5.1 (i686-pc-cygwin). Alguns scripts são executados e, em seguida, vejo o prompt $. shopt -x está configurado para que eu veja os comandos ecoarem.

(MinGW também é instalado e no caminho do DOS após o cygwin.)

Qualquer comando externo que eu digite responde lendo as linhas do terminal. A única maneira de obter o prompt $ é fazer um número de ctrl-c e entrar.

Aqui está a saída do terminal, começando com os scripts iniciados pelo cygwin. Talvez em algum lugar na frente esteja o meu erro. No final eu tente executar os comandos "mount" e "man mount", que fazem eco do comando com um "+" (de shopt -x) e, em seguida, lê a entrada.

    + '[' -z '' ']'
    + : /usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE
    + '[' addwinpath = addwinpath ']'
    + PATH='/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE'
    + INFOPATH=/usr/local/info:/usr/share/info:/usr/info
    ++ /usr/bin/id -un
    + USER=User
    + unset TMP TEMP
    + TMP=/tmp
    + TEMP=/tmp
    + p='/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device'
    + '[' -e '/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device' ']'
    + read -r PRINTER
    + PRINTER='HP LaserJet Professional P1606dn'
    + unset p
    + umask 022
    + '[' '!' -d '/c/Documents and Settings/User' ']'
    + readonly PROFILEREAD=true
    + PROFILEREAD=true
    + '[' '!' -z '' ']'
    + cd '/c/Documents and Settings/User'
    ++ /usr/bin/hostname
    + HOSTNAME=hej
    + profile_d sh
    + _LC_ALL_SET_=
    + _LC_SAVE_=null
    + LC_ALL=C
    + '[' null = null ']'
    + for file in '/etc/profile.d/*.$1'
    + '[' -e /etc/profile.d/lang.sh ']'
    + . /etc/profile.d/lang.sh
    ++ test -z ''
    +++ /usr/bin/locale -uU
    ++ export LANG=en_US.UTF-8
    ++ LANG=en_US.UTF-8
    + for file in '/etc/profile.d/*.$1'
    + '[' -e /etc/profile.d/tzset.sh ']'
    + . /etc/profile.d/tzset.sh
    ++ test -z ''
    +++ /usr/bin/tzset
    ++ export TZ=America/New_York
    ++ TZ=America/New_York
    + unset LC_ALL
    + unset file
    + unset _LC_ALL_SET_
    + unset _LC_SAVE_
    + '[' '!' 'x4.3.46(6)-release' = x ']'
    + '[' -f /etc/bash.bashrc ']'
    + . /etc/bash.bashrc
    ++ [[ -z '' ]]
    ++ CYG_SYS_BASHRC=1
    ++ [[ himxBH != *i* ]]
    ++ export 'EXECIGNORE=*.dll'
    ++ EXECIGNORE='*.dll'
    ++ PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
    + export PROFILEREAD PATH ORIGINAL_PATH INFOPATH USER TMP TEMP PRINTER HOSTNAME PS1 SHELL
    + echo '.profile in  C:\Documents and Settings\User\.profile'
    .profile in  C:\Documents and Settings\User\.profile
    + set -x
    ++ uname -o
    + [[ Cygwin == \C\y\g\w\i\n ]]
    + export CYGDRIVE=/cygdrive
    + CYGDRIVE=/cygdrive
    + export 'PATH=./://cygdrive/c/bin:/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE:/c/Documents and Settings/User'
    + PATH='./://cygdrive/c/bin:/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE:/c/Documents and Settings/User'
    + export HOME=/cygdrive/g/GNU-GCC/home/User
    + HOME=/cygdrive/g/GNU-GCC/home/User
    + cd /cygdrive/g/GNU-GCC/home/User
    + '[' -f /cygdrive/g/GNU-GCC/home/User/.bashrc ']'
    + . /cygdrive/g/GNU-GCC/home/User/.bashrc
    ++ set -o notify
    ++ set -o noclobber
    ++ set -o ignoreeof
    ++ set -o nounset
    ++ set -o xtrace
    ++ alias 'debug=set -o nounset; set -o xtrace'
    ++ ulimit -S -c 0
    ++ shopt -s checkhash
    ++ shopt -s checkwinsize
    ++ shopt -s sourcepath
    ++ shopt -s no_empty_cmd_completion
    ++ shopt -s cmdhist
    ++ shopt -s histappend histreedit histverify
    ++ shopt -s extglob
    ++ shopt -s nocaseglob
    ++ shopt -s expand_aliases
    ++ shopt -u cdspell
    ++ shopt -u cdable_vars
    ++ shopt -u mailwarn
    ++ unset MAILCHECK
    ++ alias cls=clsb
    ++ set +u
    ++ [[ -z '' ]]
    ++ unalias cls
    ++ alias 'cls=tput reset'
    ++ set -u
    ++ alias 'rm=rm -i'
    ++ alias 'cp=cp -i'
    ++ alias 'mv=mv -i'
    ++ alias h=history
    ++ alias 'j=jobs -l'
    ++ alias 'which=type -a'
    ++ alias '..=cd ..'
    ++ alias 'path=echo -e ${PATH//:/\n}'
    ++ alias 'libpath=echo -e ${LD_LIBRARY_PATH//:/\n}'
    ++ alias 'du=du -kh'
    ++ alias 'df=df -kTh'
    ++ alias 'pushnullglob=local nullglob=$(shopt -p nullglob) ; shopt -s nullglob'
    ++ alias 'popnullglob=$nullglob ; unset nullglob'
    ++ alias 'ls=ls -h --color'
    ++ alias 'lx=ls -lXB'
    ++ alias 'lk=ls -lSr'
    ++ alias 'lt=ls -ltr'
    ++ alias 'lc=ls -ltcr'
    ++ alias 'lu=ls -ltur'
    ++ alias 'll=ls -lv --group-directories-first'
    ++ alias 'lm=ll |more'
    ++ alias 'lr=ll -R'
    ++ alias 'la=ll -A'
    ++ alias 'tree=tree -Csuh'
    ++ alias more=less
    ++ export PAGER=less
    ++ PAGER=less
    ++ export LESSCHARSET=latin1
    ++ LESSCHARSET=latin1
    ++ export 'LESSOPEN=|/usr/bin/lesspipe.sh %s 2>&-'
    ++ LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-'
    ++ export 'LESS=-i -w -s -z-4 -g -M -X -r -f -P%t?f%f \
    :stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'
    ++ LESS='-i -w -s -z-4 -g -M -X -r -f -P%t?f%f \
    :stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'
    ++ export 'LESS_TERMCAP_mb='
    ++ LESS_TERMCAP_mb=''
    ++ export 'LESS_TERMCAP_md='
    ++ LESS_TERMCAP_md=''
    ++ export 'LESS_TERMCAP_me='
    ++ LESS_TERMCAP_me=''
    ++ export 'LESS_TERMCAP_se='
    ++ LESS_TERMCAP_se=''
    ++ export 'LESS_TERMCAP_so='
    ++ LESS_TERMCAP_so=''
    ++ export 'LESS_TERMCAP_ue='
    ++ LESS_TERMCAP_ue=''
    ++ export 'LESS_TERMCAP_us='
    ++ LESS_TERMCAP_us=''
    ++ export -f wcd
    ++ [[ C:\Documents and Settings\User == \C\:\\U\s\e\r\s\\j\a\r\e\d ]]
    ++ export GNUGCC=/cygdrive/g/GNU-GCC
    ++ GNUGCC=/cygdrive/g/GNU-GCC
    ++ alias 'stamp=export STAMP='date +D%Y%m%d.T%H%M%S'; export LOGS='pwd'/logs/${STAMP};  mkdir -pv ${LOGS}'
    ++ alias 'gcd=cd /cygdrive/g/GNU-GCC/toolchain-avr'
    ++ alias 'gcc=cd /cygdrive/g/GNU-GCC/toolchain-avr/gcc-build; stamp; ../gcc/libgcc/configure'
    ++ alias 'avr=gcd; stamp; (build_package-avr-gcc.bash "$STAMP" "$LOGS" 2>&1) | tee $LOGS/_package.log'
    ++ alias 'avo=gcd; stamp; (package-avr-gcc.bash 2>&1) | tee $LOGS/_package.log'
    ++ alias -p
    alias ..='cd ..'
    alias avo='gcd; stamp; (package-avr-gcc.bash 2>&1) | tee $LOGS/_package.log'
    alias avr='gcd; stamp; (build_package-avr-gcc.bash "$STAMP" "$LOGS" 2>&1) | tee $LOGS/_package.log'
    alias cls='tput reset'
    alias cp='cp -i'
    alias debug='set -o nounset; set -o xtrace'
    alias df='df -kTh'
    alias du='du -kh'
    alias gcc='cd /cygdrive/g/GNU-GCC/toolchain-avr/gcc-build; stamp; ../gcc/libgcc/configure'
    alias gcd='cd /cygdrive/g/GNU-GCC/toolchain-avr'
    alias h='history'
    alias j='jobs -l'
    alias la='ll -A'
    alias lc='ls -ltcr'
    alias libpath='echo -e ${LD_LIBRARY_PATH//:/\n}'
    alias lk='ls -lSr'
    alias ll='ls -lv --group-directories-first'
    alias lm='ll |more'
    alias lr='ll -R'
    alias ls='ls -h --color'
    alias lt='ls -ltr'
    alias lu='ls -ltur'
    alias lx='ls -lXB'
    alias more='less'
    alias mv='mv -i'
    alias path='echo -e ${PATH//:/\n}'
    alias popnullglob='$nullglob ; unset nullglob'
    alias pushnullglob='local nullglob=$(shopt -p nullglob) ; shopt -s nullglob'
    alias rm='rm -i'
    alias stamp='export STAMP='date +D%Y%m%d.T%H%M%S'; export LOGS='pwd'/logs/${STAMP};  mkdir -pv ${LOGS}'
    alias tree='tree -Csuh'
    alias which='type -a'

    User@hej ~
    $ shopt
    + shopt
    autocd          off
    cdable_vars     off
    cdspell         off
    checkhash       on
    checkjobs       off
    checkwinsize    on
    cmdhist         on
    compat31        off
    compat32        off
    compat40        off
    compat41        off
    compat42        off
    complete_fullquote      on
    direxpand       off
    dirspell        off
    dotglob         off
    execfail        off
    expand_aliases  on
    extdebug        off
    extglob         on
    extquote        on
    failglob        off
    force_fignore   on
    globstar        off
    globasciiranges off
    gnu_errfmt      off
    histappend      on
    histreedit      on
    histverify      on
    hostcomplete    on
    huponexit       off
    interactive_comments    on
    lastpipe        off
    lithist         off
    login_shell     on
    mailwarn        off
    no_empty_cmd_completion on
    nocaseglob      on
    nocasematch     off
    nullglob        off
    progcomp        on
    promptvars      on
    restricted_shell        off
    shift_verbose   off
    sourcepath      on
    xpg_echo        off

    User@hej ~
    $ set
    + set
    ALLUSERSPROFILE='C:\Documents and Settings\All Users'
    APPDATA='C:\Documents and Settings\User\Application Data'
    BASH=/bin/bash
    BASHOPTS=checkhash:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:histappend:histreedit:histverify:hostcomplete:interactive_comments:login_shell:no_empty_cmd_completion:nocaseglob:progcomp:promptvars:sourcepath
    BASH_ALIASES=()
    BASH_ARGC=()
    BASH_ARGV=()
    BASH_CMDS=()
    BASH_LINENO=()
    BASH_SOURCE=()
    BASH_VERSINFO=([0]="4" [1]="3" [2]="46" [3]="6" [4]="release" [5]="i686-pc-cygwin")
    BASH_VERSION='4.3.46(6)-release'
    CLIENTNAME=Console
    COLUMNS=132
    COMMONPROGRAMFILES='C:\Program Files\Common Files'
    COMPUTERNAME=HEJ
    COMSPEC='C:\WINDOWS\System32\CMD.EXE'
    CYGDRIVE=/cygdrive
    CYGWIN_HOME='C:\cygwin'
    CYG_SYS_BASHRC=1
    CommonAppData='C:\Documents and Settings\All Users\Application Data'
    CommonDesktop='C:\Documents and Settings\All Users\Desktop'
    CommonDocuments='C:\Documents and Settings\All Users\Documents'
    CommonFavorites='C:\Documents and Settings\All Users\Favorites'
    CommonMusic='C:\Documents and Settings\All Users\Documents\My Music'
    CommonPictures='C:\Documents and Settings\All Users\Documents\My Pictures'
    CommonTemplates='C:\Documents and Settings\All Users\Templates'
    CommonVideos='C:\Documents and Settings\All Users\Documents\My Videos'
    DIRSTACK=()
    DefaultUserProfile='C:\Documents and Settings\Default User'
    DevMgr_Show_Details='*'
    DevMgr_Show_NonPresent_Devices='*'
    EUID=197614
    EXECIGNORE='*.dll'
    FP_NO_HOST_CHECK=NO
    GNUGCC=/cygdrive/g/GNU-GCC
    GROUPS=()
    HISTFILE='/c/Documents and Settings/User/.bash_history'
    HISTFILESIZE=500
    HISTSIZE=500
    HOME=/cygdrive/g/GNU-GCC/home/User
    HOMEDRIVE=C:
    HOMEPATH='\Documents and Settings\User'
    HOSTNAME=hej
    HOSTTYPE=i686
    IFS=$' \t\n'
    IGNOREEOF=10
    INFOPATH=/usr/local/info:/usr/share/info:/usr/info
    JD2_HOME='C:\Documents and Settings\User\Local Settings\Application Data\JDownloader 2.0'
    LANG=en_US.UTF-8
    LESS=$'-i -w -s -z-4 -g -M -X -r -f -P%t?f%f \\n:stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'
    LESSCHARSET=latin1
    LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-'
    LESS_TERMCAP_mb=$'\E[01;31m'
    LESS_TERMCAP_md=$'\E[01;31m'
    LESS_TERMCAP_me=$'\E[0m'
    LESS_TERMCAP_se=$'\E[0m'
    LESS_TERMCAP_so=$'\E[01;44;33m'
    LESS_TERMCAP_ue=$'\E[0m'
    LESS_TERMCAP_us=$'\E[01;32m'
    LINES=80
    LOGONSERVER='\HEJ'
    MACHTYPE=i686-pc-cygwin
    MTPPKROOT='C:\WMSDK\MTPPK12\Responder'
    NUMBER_OF_PROCESSORS=2
    OLDPWD='/c/Documents and Settings/User'
    OPTERR=1
    OPTIND=1
    ORIGINAL_PATH='/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE'
    OS=Windows_NT
    OSTYPE=cygwin
    PAGER=less
    PATH='./://cygdrive/c/bin:/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE:/c/Documents and Settings/User'
    PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.REX;.Rexx;.PSC1'
    PIPESTATUS=([0]="0")
    PPID=944
    PRINTER='HP LaserJet Professional P1606dn'
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER='x86 Family 15 Model 6 Stepping 2, GenuineIntel'
    PROCESSOR_LEVEL=15
    PROCESSOR_REVISION=0602
    PROFILEREAD=true
    PROGRAMFILES='C:\Program Files'
    PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
    PS2='> '
    PS4='+ '
    PSModulePath='C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\'
    PWD=/cygdrive/g/GNU-GCC/home/User
    REGINA_HOME='C:\Program Files\rexx.org\Regina'
    REGINA_LANG=en
    REGINA_LANG_DIR='C:\Program Files\rexx.org\Regina'
    SESSIONNAME=Console
    SHELL=/bin/bash
    SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:ignoreeof:interactive-comments:monitor:noclobber:notify:nounset:xtrace
    SHLVL=1
    SYSTEMDRIVE=C:
    SYSTEMROOT='C:\WINDOWS'
    TEMP=/tmp
    TERM=xterm
    THE_HELP_FILE='C:\Program Files\rexx.org\THE\THE_Help.txt'
    THE_HOME_DIR='C:\Program Files\rexx.org\THE'
    THE_MACRO_PATH='C:\Program Files\rexx.org\THE\extras'
    TMP=/tmp
    TZ=America/New_York
    UID=197614
    USER=User
    USERDOMAIN=HEJ
    USERNAME=User
    USERPROFILE='C:\Documents and Settings\User'
    WINDIR='C:\WINDOWS'
    _=shopt
    _NT_SYMBOL_PATH='srv*c:\symbols*https://msdl.microsoft.com/download/symbols'
    profile_d ()
    {
        _LC_ALL_SET_="${LC_ALL+set}";
        _LC_SAVE_="${LC_ALL-null}";
        LC_ALL=C;
        if [ "${_LC_SAVE_}" = "null" ]; then
            for file in /etc/profile.d/*.$1;
            do
                [ -e "${file}" ] && . "${file}";
            done;
            unset LC_ALL;
        else
            for file in /etc/profile.d/*.$1;
            do
                [ -e "${file}" ] && LC_ALL="${_LC_SAVE_}" . "${file}";
            done;
            LC_ALL="${_LC_SAVE_}";
        fi;
        unset file;
        unset _LC_ALL_SET_;
        unset _LC_SAVE_
    }
    wcd ()
    {
        cd $(sed -e 's~\~/~g' -e 's~c:~$CYGDRIVE/c~g' -e 's~g:~$CYGDRIVE/g~' <<< "$@")
    }

    User@hej ~
    $ mount
    + mount

Ctrl-c entered <------


    User@hej ~
    $

    User@hej ~
    $

    User@hej ~
    $ man mount
    + man mount
Ctrl-c entered <------


    User@hej ~
    $

Caminho do DOS:

PATH=C:\cygwin\bin\;C:\;c:\tools;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32\WBEM;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\cgywin\bin;C:\MinGW\bin;C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;C:\Program Files\rexx.org\Regina;C:\Program Files\rexx.org\THE
    
por HiTechHiTouch 09.10.2016 / 14:39

1 resposta

1

Eu "quebrei" o meu sistema adicionando entradas ao FSTAB para meus volumes locais assim:

# /etc/fstab
#
#    This file is read once by the first process in a Cygwin process tree.
#    To pick up changes, restart all Cygwin processes.  For a description
#    see https://cygwin.com/cygwin-ug-net/using.html#mount-table

# This is default anyway:
none /cygdrive cygdrive binary,posix=0,user 0 0

c:/ /c ntfs text,posix=0 0 0
d:/ /d ntfs text,posix=0 0 0
f:/ /f ntfs text,posix=0 0 0
g:/ /g ntfs text,posix=0 0 0

Eu "consertei" alterando o fstab para:

none /cygdrive cygdrive binary,posix=0,user 0 0
none /tmp usertemp binary,posix=0 0 0

c:/  /c  ntfs binary,posix=0,cygexec 0 0
d:/  /d  ntfs binary,posix=0,cygexec 0 0
f:/  /f  ntfs binary,posix=0,cygexec 0 0
g:/  /g  ntfs binary,posix=0,cygexec 0 0

O que eu acho que aconteceu é que, ao não montar 4 drives (c, d, f, g) como "exec", toda vez que cygwin procurava por um externo, ele abria e lia um grande número de arquivos procurando por "magic". bytes "para ver se o arquivo era um executável.

Enquanto isso, o mintty estava armazenando em buffer o que eu digitei como "type ahead" até que eu ctrl-c'd, matando a busca ainda em execução pelo meu comando.

Ao adicionar "cygexec" às opções, a pesquisa agora consulta apenas os flags executáveis nos diretórios e é executada a toda velocidade.

    
por 10.10.2016 / 12:57