Comments (10)
I could reproduce this strange behavior and I have no explanations why this occurs now. The problem comes from the use of _findfirst/_findnext (other projects report the same problem).
I confirm that turning the compatibility mode on is a workaround (after some tries, even comptatibility set to Windows 8 worked).
In next release, I'll try to use other system calls (FindFirstFile/FindNextFile) to implement directory_files.
from gprolog.
I'll look at it very soon...
from gprolog.
Same issue with the Windows 10 with MinGW64 gcc under MSys2 build.
from gprolog.
More details:
GNU Prolog 1.5.0 (64 bits)
Compiled Jul 8 2021, 12:22:53 with gcc
Copyright (C) 1999-2021 Daniel Diaz
| ?- current_directory(D).
uncaught exception: error(existence_error(procedure,current_directory/1),top_level/0)
| ?- working_directory(D).
D = 'C:\\GNU-Prolog\\bin'
yes
| ?- directory_files('C:\\GNU-Prolog\\bin', Files).
Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']
yes
| ?- directory_files('C:/GNU-Prolog/bin', Files).
Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']
yes
But if I start Logtalk using the "Logtalk - GNU Prolog" shortcut:
| ?- directory_files('C:\\GNU-Prolog\\bin', Files).
uncaught exception: error(system_error('No error'),directory_files/2)
| ?- directory_files('C:/GNU-Prolog/bin', Files).
uncaught exception: error(system_error('No error'),directory_files/2)
The only change to GNU Prolog defaults when running Logtalk is that the strict_iso
flag is turned off. But toggling this flag doesn't solve the problem. On the other hand, if I start GNU-Prolog and then load Logtalk from the top-level:
| ?- ['C:/Program Files (x86)/Logtalk/integration/logtalk_gp.pl'].
...
Logtalk 3.49.0-b05
Copyright (c) 1998-2021 Paulo Moura
...
(468 ms) yes
| ?- directory_files('C:\\GNU-Prolog\\bin', Files).
Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']
yes
| ?- directory_files('C:/GNU-Prolog/bin', Files).
Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']
yes
Thus, the issue seems to be caused by how Logtalk with GNU Prolog is started. If from a Windows shortcut, directory_files/2
doesn't work. If we start GNU Prolog directly and then load Logtalk, directory_files/2
works as expected.
from gprolog.
Running the integration shortcut as an administrator doesn't solve the problem.
from gprolog.
The issue can be solved by editing the shortcut properties and then set compatibility mode to Windows 7.
from gprolog.
Actually, setting the shortcut compatibility mode, sets the GNU Prolog executable itself compatibility mode. Thus, it seems that the GNU Prolog installers for Windows need to ensure that the compatibility mode is set to Windows 7.
from gprolog.
The trick of setting the compatibility mode to Windows 7 or 8 no longer works in recent Windows 10 builds. I'm working on a portable package manager that requires a call to the directory_files/2
predicate at startup. This bug effectively prevents running the next Logtalk release with GNU Prolog on Windows 10.
from gprolog.
It seems that a restart is needed after setting the compatibility mode. Odd. I don't remember doing it after I found the workaround.
from gprolog.
Fix confirmed using the Windows build you provided at http://www.gprolog.org/unstable/ Thanks!
from gprolog.
Related Issues (20)
- Leak with simple arithmetics HOT 4
- Power not defined HOT 1
- Linking error riscv64
- Problem processing repeated calls HOT 3
- New show_information flag regression HOT 1
- Typo in Load_Math_Expression?
- Insure project web site
- GNU Prolog Parser accepts incomplete clause.
- hand written C code lacks some garbage collection.
- real_file_name does not follow symlinks on Windows HOT 1
- numbervars/3 silently refuses to number vars
- ensure_loaded/1 wants suddently predicate indicator HOT 1
- Ubuntu defaults so that GNU compile result is speedy HOT 1
- Incorrect answers when exceeding domains
- phrase/2 too eager execution HOT 1
- Feature request: format_time
- Ma2Asm for linux x64 with gcc is not generating PIC code (v1.5.0+)
- GNU Prolog crashes when reading long string literals
- GNU Prolog segmentation faults when using read_term/3 on a huge file
- formatting floats (adaptive 16 or 17 decimal precision)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gprolog.