Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading sweep trashes emacs hashtable management #1

Closed
drtutut opened this issue Apr 10, 2024 · 10 comments
Closed

loading sweep trashes emacs hashtable management #1

drtutut opened this issue Apr 10, 2024 · 10 comments

Comments

@drtutut
Copy link

drtutut commented Apr 10, 2024

description

When starting emacs and loading a prolog file, the following appears in the *Messages* buffer:

File mode specification error: (error Invalid hash table rehash size 1.0)
Error during redisplay: (jit-lock-function 1) signaled (error "Invalid hash table rehash size" 1.0)

The prolog file is loaded and correctly displayed, but some emacs functions are definitively trashed. And it is possible to gets things worse, e.g. :

  • do a C-x C-b to display a list af buffers. Everything is fine.
  • switch to the prolog buffer and run a toplevel with C-c C-t
  • now do a C-x C-b again : in the minibuffer you see a "Invalid hash table rehash size 1.0" message (and in the *Messages* buffer.

How to reproduce ?

Emacs version 27.1, debian build
sweeprolog : 0.27.3
swi-prolog: 9.1.21
minimal configuration:

(require 'package)
(package-initialize)

(require 'sweeprolog)
(add-hook 'sweeprolog-mode-hook #'sweeprolog-infer-indent-style)
(add-hook 'sweeprolog-mode-hook #'sweeprolog-electric-layout-mode)

(add-hook 'sweeprolog-top-level-mode-hook #'compilation-shell-minor-mode)
(setq sweeprolog-read-predicate-documentation-function
      #'sweeprolog-read-predicate-documentation-with-holes)

start emacs:

LD_PRELOAD=/usr/lib/swipl/lib/x86_64-linux/libswipl.so emacs -q -l .emacs-sweep-mini tmp/test.pl 

(replace the path to the swipl.so with the correct one on your system). .emacs-sweep-mini is the minimal emacs configuration described above, and test.pl is just a "hello world" program in prolog.

You should see the spurious (error Invalid hash table rehash size 1.0) messages in the *Messages* buffer.

@drtutut
Copy link
Author

drtutut commented Apr 10, 2024

After updating sweep to 0.27.4 the problem persists.

@eshelyaron
Copy link
Collaborator

Hi @drtutut, thank you for the detailed report.

I cannot reproduce this issue just yet, but I have a suspicion that it relates to some locale settings.
Can you please run locale and share the output that you get?
Also, could you check if you still get this error when running Emacs with LC_ALL=C or LC_ALL=en_US.UTF-8?

@drtutut
Copy link
Author

drtutut commented Apr 10, 2024

Hi @eshelyaron ,
Your suspicions seem to be confirmed.
Result of my locale:

LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

And when I launch emacs with LC_ALL=C the problem disappears.

@eshelyaron
Copy link
Collaborator

Great, thank you for confirming.
I'll try to reproduce this with these locale settings and keep you posted about a solution.

@drtutut
Copy link
Author

drtutut commented Apr 10, 2024

Thank you for your prompt answer.
I stay tuned.

eshelyaron added a commit that referenced this issue Apr 10, 2024
The Emacs Elisp reader only works with locales that have "." as their
decimal separator, but Prolog initialization sets up the locale
according to the environment variables.  Therefore we need to reset
the locale after initializing Prolog in case the environment
prescribes a locale with a different decimal separator, such as fr_FR.
See also #1
@eshelyaron
Copy link
Collaborator

Thanks to these clues I was able to reproduce this issue, and hopefully fix it in commit f57584a. I'll release a version 0.27.5 with this fix soon, but you're welcome to test the development version and see if it works for you.

@drtutut
Copy link
Author

drtutut commented Apr 10, 2024

Thanks for the work. I hope to have time tomorrow to test it.

@drtutut
Copy link
Author

drtutut commented Apr 11, 2024

I just updated to 0.27.5 and everything works fine.

Thank you.

@drtutut drtutut closed this as completed Apr 11, 2024
@JanWielemaker
Copy link
Member

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-4/7399/1

@JanWielemaker
Copy link
Member

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/ann-swi-prolog-9-2-4-stable/7407/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants