为什么将可执行文件复制到新名称会阻止其运行?

时间:2017-05-09 00:42:56

标签: windows windows-10 gfortran msys2

我在Windows 10 Professional下运行MSYS2

这是shell会话的副本。 [...]中的行是稍后添加的注释。

$ ./flmoon.exe
 Date of the next few phases of the moon
 Enter today's date (e.g. 1,31,1982)

[program running OK - aborted with Ctrl-C]

$ cp flmoon.exe flmoon2.exe

[copy to a different name]

$ ./flmoon2.exe
 Date of the next few phases of the moon
 Enter today's date (e.g. 1,31,1982)

[the copy also runs OK - aborted]

$ cp flmoon2.exe xflmoon.exe

[copy to a another different name]

$ ./xflmoon.exe
bash: ./xflmoon.exe: Permission denied

[HUH????]

$ ls -l flmoon.exe flmoon2.exe xflmoon.exe
-rwxr-xr-x 1 Rob None 409191 May  9 01:14 flmoon.exe
-rwxr-xr-x 1 Rob None 409191 May  9 01:26 flmoon2.exe
-rwxr-xr-x 1 Rob None 409191 May  9 01:27 xflmoon.exe

[But all three files have the same permissions???]

有什么东西"魔法"关于名称" xflmoon.exe"?

FWIW,在Windows shell下运行xflmoon.exe会首先提供Windows用户访问控制消息,如果我接受该消息,则该程序将在单独的控制台窗口中运行,这不是我想要的。其他两个文件名在Windows下作为命令行应用程序运行。

FWIW可执行文件是用gfortran构建的:

$ gfortran -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gfortran.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-6.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 6.2.0 (Rev2, Built by MSYS2 project)

使用Cygwin而不是MSYS2以及相同的文件名也会出现相同的行为。

请注意,原始源代码来自Numerical Recipes库和配套示例书。

更新:

在回复评论时,xflmoon.exe已被Windows标记为"以管理员身份运行",但其他两个.exe文件没有。如果我删除该标志,它将按预期运行。

所以问题现在变成了#34;为什么Windows会标记它,它会影响其他文件名,以及如何阻止它呢?"

0 个答案:

没有答案