kou1okada / apt-cyg

Apt-cyg, an apt-get like tool for Cygwin
MIT License
351 stars 51 forks source link

/usr/bin/apt-cyg: line 324: /dev/fd/62: Not a directory #20

Closed ghost closed 7 years ago

ghost commented 7 years ago
user@pc ~
$ apt-cyg dist-upgrade
Kill all cygwin process and start dist-upgrade.
/usr/bin/apt-cyg: line 324: /dev/fd/62: Not a directory
Are you sure ? [y/N] y
Are you sure ? [y/N] y
Are you sure ? [y/N] y
Are you sure ? [y/N] y
Are you sure ? [y/N] y
Are you sure ? [y/N] y
Are you sure ? [y/N] N
Are you sure ? [y/N]

I have to control c, doesn't work

user@pc ~
$ uname -a
CYGWIN_NT-10.0 twl-pc 2.7.0(0.306/5/3) 2017-02-12 13:18 x86_64 Cygwin
user@pc ~
$ apt-cyg --version
apt-cyg version 0.57
Written by Stephen Jungels

Copyright (c) 2005-9 Stephen Jungels.  Released under the GPL.
user@pc ~
$ vim /usr/bin/apt-cyg

 315
 316 # Usage: ask_user [MESSAGE [OPTIONS]]
 317 function ask_user ()
 318 {
 319   local answer retcode option
 320   local MESSAGE="$1"
 321   local OPTIONS="${2:-y/N}"
 322   local DEFAULT="$(echo "$OPTIONS" | awk -v FS=/ '{for(i=1;i<=NF;i++)if(match(substr($i,1,1),/[A-Z]/)){print $i; exit}}')"
 323   local SPLIT_OPTIONS
 324   readarray -t SPLIT_OPTIONS < <(echo "$OPTIONS" | sed -e 's:/:\n:g')
 325   while true; do
 326     echo -n "${MESSAGE}${MESSAGE:+ }[${OPTIONS}] "
 327     read answer
 328     retcode=0
 329     for option in "${SPLIT_OPTIONS[@]}"; do
 330       if [ "$option" = "${answer:-$DEFAULT}" ]; then
 331         return $retcode
 332       fi
 333       retcode=$(( retcode + 1 ))
 334     done
 335   done
 336 }
 337
ghost commented 7 years ago

any ideas?

kou1okada commented 7 years ago

Hmm, It's strangeful. Could you try following commands and report its result to here?

( set -x; readarray -t x < <(echo "y/N"|sed -e 's:/:\n:g');for i in "${x[@]}";do echo "[$i]";done;echo "$SHELL";set|grep -i bash;ldd "$SHELL";echo "$PATH"|sed -e 's/:/\n/g'; )|& awk '{print "    "$0}'|tee /dev/stderr|clip

Run it and paste with Ctrl+V, please.

ghost commented 7 years ago

It didn't give me anything

@>~
$ ( set -x; readarray -t x < <(echo "y/N"|sed -e 's:/:\n:g');for i in "${x[@]}";do echo "[$i]";done;echo "$SHELL";set|grep -i bash;ldd "$SHELL";echo "$PATH"|sed -e 's/:/\n/g'; )|& awk '{print "    "$0}'|tee /dev/stderr|clip

@>~
$
kou1okada commented 7 years ago

Too strange. Why result is empty?

I appended a script for diagnostic this issue. Please try below commands and report its result.

wget https://raw.githubusercontent.com/kou1okada/apt-cyg/50b010224dc4a591cda4bd10a54e4772ebce9447/diagnostic4issue20.sh
chmod +x  diagnostic4issue20.sh
. ./diagnostic4issue20.sh
ghost commented 7 years ago

That worked

[user]@[pc] ~
$ ./diagnostic4issue20.sh
++ readarray -t x
+++ echo y/N
./diagnostic4issue20.sh: line 2: /dev/fd/62: Not a directory
++ echo /bin/bash
/bin/bash
+++ sed -e 's:/:\n:g'
+++ echo y/N
++ set
+++ sed -e 's:/:\n:g'
++ grep -i bash
BASH=/usr/bin/bash
BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:  progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="./diagnostic4issue20.sh")
BASH_VERSINFO=([0]="4" [1]="4" [2]="12" [3]="3" [4]="release" [5]="x86_64-unknown-cygwin")
BASH_VERSION='4.4.12(3)-release'
SHELL=/bin/bash
_=/bin/bash
++ ldd /bin/bash
        ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffec7180000)
        KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffec5360000)
        KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffec40d0000)
        cygwin1.dll => /usr/bin/cygwin1.dll (0x180040000)
        cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x3fed40000)
        cygintl-8.dll => /usr/bin/cygintl-8.dll (0x3fece0000)
        cygreadline7.dll => /usr/bin/cygreadline7.dll (0x3fe230000)
        cygncursesw-10.dll => /usr/bin/cygncursesw-10.dll (0x3fe6e0000)
++ echo '/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/VMware/VMware vSphere CLI/Pe  rl/site/bin:/cygdrive/c/Program Files (x86)/VMware/VMware vSphere CLI/Perl/bin:/cygdrive/c/Pr  ogram Files (x86)/Razer Chroma SDK/bin:/cygdrive/c/Program Files/Razer Chroma SDK/bin:/cygdri  ve/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windo  ws/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/B  inn:/cygdrive/c/Program Files/Microsoft/Web Platform Installer:/cygdrive/c/Program Files/Micr  osoft DNX/Dnvm:/cygdrive/c/Program Files/nodejs:/cygdrive/c/Program Files (x86)/Microsoft SQL   Server/Client SDK/ODBC/130/Tools/Binn:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/1  30/Tools/Binn:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/cygdrive/c/P  rogram Files (x86)/Microsoft SQL Server/130/Tools/Binn/ManagementStudio:/cygdrive/c/WINDOWS/s  ystem32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/Wi  ndowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Microsoft VS Code/bin:/cygdrive/c/Users/  [user]/AppData/Roaming/npm:/cygdrive/c/Users/[user]/AppData/Local/Microsoft/WindowsApps:/cygdri  ve/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/Program Files/dotnet:/cy  gdrive/c/Program Files/PuTTY:%SystemRoot%/system32:%SystemRoot%:%SystemRoot%/System32/Wbem:%S  YSTEMROOT%/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Microsoft VS Code/  bin:/cygdrive/c/Users/[user]/AppData/Roaming/npm:%USERPROFILE%/AppData/Local/Microsoft/Windows  Apps'
++ sed -e 's/:/\n/g'
/usr/local/bin
/usr/bin
/cygdrive/c/Program Files (x86)/VMware/VMware vSphere CLI/Perl/site/bin
/cygdrive/c/Program Files (x86)/VMware/VMware vSphere CLI/Perl/bin
/cygdrive/c/Program Files (x86)/Razer Chroma SDK/bin
/cygdrive/c/Program Files/Razer Chroma SDK/bin
/cygdrive/c/Windows/system32
/cygdrive/c/Windows
/cygdrive/c/Windows/System32/Wbem
/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0
/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/Binn
/cygdrive/c/Program Files/Microsoft/Web Platform Installer
/cygdrive/c/Program Files/Microsoft DNX/Dnvm
/cygdrive/c/Program Files/nodejs
/cygdrive/c/Program Files (x86)/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn
/cygdrive/c/Program Files (x86)/Microsoft SQL Server/130/Tools/Binn
/cygdrive/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn
/cygdrive/c/Program Files (x86)/Microsoft SQL Server/130/Tools/Binn/ManagementStudio
/cygdrive/c/WINDOWS/system32
/cygdrive/c/WINDOWS
/cygdrive/c/WINDOWS/System32/Wbem
/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0
/cygdrive/c/Program Files (x86)/Microsoft VS Code/bin
/cygdrive/c/Users/[user]/AppData/Roaming/npm
/cygdrive/c/Users/[user]/AppData/Local/Microsoft/WindowsApps
/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common
/cygdrive/c/Program Files/dotnet
/cygdrive/c/Program Files/PuTTY
%SystemRoot%/system32
%SystemRoot%
%SystemRoot%/System32/Wbem
%SYSTEMROOT%/System32/WindowsPowerShell/v1.0
/cygdrive/c/Program Files (x86)/Microsoft VS Code/bin
/cygdrive/c/Users/[user]/AppData/Roaming/npm
%USERPROFILE%/AppData/Local/Microsoft/WindowsApps

[user]@[pc] ~
$
kou1okada commented 7 years ago

Hmm,,, it seems that process substitution is not working. I have no ideas about causes to fail it, and why it happens process substitution only. But, let's assume several causes.

Does your environment up to date the latest cygwin? Bash 4.4.12(3)-release seems the latest for cygwin, but are DLLs the latest, too? Try apt-cyg dist-upgrade-no-ask, and then retry apt-cyg dist-upgrade again.

What the anti-virus softwares do you use? If anti-virus peeps a pipe for process substitution, that may corrupt the pipe, perhaps. Try to stop the realtime-scan and try apt-cyg dist-upgrade, does it still fail?

And I append a script again. Please try below commands and report its result.

wget https://raw.githubusercontent.com/kou1okada/apt-cyg/2f6069b6b00dbb8a2b9894cf40fdd158685e5576/diagnostic4issue20-2.sh
chmod +x  diagnostic4issue20-2.sh
. ./diagnostic4issue20-2.sh

Good lucks.

ghost commented 7 years ago

apt-cyg dist-upgrade-no-ask seem to work sorta kinda

$ apt-cyg dist-upgrade-no-ask
/usr/bin/apt-cyg: line 1123: /dev/fd/62: Not a directory
/usr/bin/apt-cyg: line 1072: /dev/fd/62: Not a directory
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
/usr/bin/apt-cyg: line 1076: family: bad array subscript
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Cygwin setup launched and ran even with the errors

screenclip

I'm on windows 10 insider build 15025 using the windows defender built in anti virus. i tried disabling real time protection and no change. apt-cyg dist-upgrade still fails even after apt-cyg dist-upgrade-no-ask runs through

Here is out put from the wget sh

[user]@[pc] ~
$ ./diagnostic4issue20-2.sh
=====
ls: cannot access '/dev/fd/': Not a directory
-----
stat: cannot stat '/dev/fd/63': Not a directory
-----
cat: /dev/fd/63: Not a directory
./diagnostic4issue20-2.sh: line 11: /dev/fd/62: Not a directory
=====
ls: cannot access '/dev/fd/': Not a directory
-----
stat: cannot stat '/dev/fd/63': Not a directory
-----
cat: /dev/fd/63: Not a directory
./diagnostic4issue20-2.sh: line 13: /dev/fd/62: Not a directory
ghost commented 7 years ago
[user]@[pc] /dev
$ ll
total 19K
drwxrwx---+ 1 [user] [user]        0 Feb 15 17:36 ./
drwxrwx---+ 1 [user] [user]        0 Mar  1 16:51 ../
crw-rw-rw-  1 [user] [user]  13, 254 Nov 30  2006 clipboard
crw-rw-rw-  1 [user] [user]   5, 255 Mar  2 21:31 conin
crw-rw-rw-  1 [user] [user]   5, 254 Mar  2 21:31 conout
crw-rw-rw-  1 [user] [user]   5,   1 Mar  2 21:31 console
crw-rw-rw-  1 [user] [user]  14,   3 Mar  2 21:31 dsp
-rwxrwx---+ 1 [user] [user]       40 Jan 19 12:51 fd*
crw-rw-rw-  1 [user] [user]   1,   7 Mar  2 21:31 full
crw-------  1 [user] [user]   1,  11 Mar  2 21:31 kmsg
drwxrwx---+ 1 [user] [user]        0 Jan 19 12:50 mqueue/
crw-rw-rw-  1 [user] [user]   1,   3 Mar  2 21:31 null
crw-rw-rw-  1 [user] [user]   5,   2 Mar  2 21:31 ptmx
crw--w----  1 [user] [user] 136,   0 Mar  2 21:31 pty0
crw-rw-rw-  1 [user] [user]   1,   8 Mar  2 21:31 random
brw-rw-rw-  1 [user] [user]   8,   0 Mar  2 21:31 sda
brw-rw-rw-  1 [user] [user]   8,   1 Mar  2 21:31 sda1
brw-rw-rw-  1 [user] [user]   8,   2 Mar  2 21:31 sda2
brw-rw-rw-  1 [user] [user]   8,   3 Mar  2 21:31 sda3
brw-rw-rw-  1 [user] [user]   8,   4 Mar  2 21:31 sda4
brw-rw-rw-  1 [user] [user]   8,  16 Mar  2 21:31 sdb
brw-rw-rw-  1 [user] [user]   8,  17 Mar  2 21:31 sdb1
brw-rw-rw-  1 [user] [user]   8,  32 Mar  2 21:31 sdc
brw-rw-rw-  1 [user] [user]   8,  33 Mar  2 21:31 sdc1
brw-rw-rw-  1 [user] [user]   8,  34 Mar  2 21:31 sdc2
drwxrwx---+ 1 [user] [user]        0 Jan 19 12:50 shm/
-rwxrwx---+ 1 [user] [user]     4.6K Mar  1 22:07 stderr*
-rwxrwx---+ 1 [user] [user]       44 Jan 19 12:51 stdin*
-rwxrwx---+ 1 [user] [user]       44 Jan 19 12:51 stdout*
crw-rw-rw-  1 [user] [user]   5,   0 Mar  2 21:31 tty
crw-rw-rw-  1 [user] [user]   1,   9 Mar  2 21:31 urandom
crw-rw-rw-  1 [user] [user]  13, 255 Mar  2 21:31 windows
crw-rw-rw-  1 [user] [user]   1,   5 Mar  2 21:31 zero
ghost commented 7 years ago
[user]@[pc] /dev
$ cat fd*
!<symlink>¦¦/proc/self/fd

[user]@[pc] /dev
$ cd /proc/self/fd

[user]@[pc] /proc/self/fd
$ ll
total 0
dr-xr-xr-x 2 [user] [user] 0 Mar  2 21:24 ./
dr-xr-xr-x 3 [user] [user] 0 Mar  2 21:24 ../
lrwxrwxrwx 1 [user] [user] 0 Mar  2 21:35 0 -> /dev/pty0
lrwxrwxrwx 1 [user] [user] 0 Mar  2 21:35 1 -> /dev/pty0
lrwxrwxrwx 1 [user] [user] 0 Mar  2 21:35 2 -> /dev/pty0
lrwxrwxrwx 1 [user] [user] 0 Mar  2 21:35 31 -> /dev/pty0

[user]@[pc] /proc/self/fd
$
kou1okada commented 7 years ago

Wait. Are your cygwin64 root directory on Dropbox? If you reinstall cygwin to C:\cygwin64 (default place), does it still happen the problem?

ghost commented 7 years ago

ya I kinda dont like how I did that.. let me try c:\cygwin64

kou1okada commented 7 years ago

It seems that your /dev/fd is not working as symbolic link.

Perhaps, it may help this problem.

rm /dev/fd
ln -s /proc/self/fd /dev/fd

But, dropbox may obstruct it.

ghost commented 7 years ago

It's working now. Been a while (sorry), I have cygwin on the c:\ drive now and apt-cyg works perfectly so far.

I did get this error when installing gnupg with win10 x64 and cygwin x64, but it was a soft error and I never addressed it, and apt-cyg still worked. just mentioning in case someone runs across it too

Gnupg Install Soft Error

Thank you very much for the help!