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

Extra nulls in path string with 28.1 Linux package #60

Open
asmeurer opened this issue Apr 26, 2022 · 14 comments · May be fixed by #64 or #65
Open

Extra nulls in path string with 28.1 Linux package #60

asmeurer opened this issue Apr 26, 2022 · 14 comments · May be fixed by #64 or #65

Comments

@asmeurer
Copy link
Member

With the emacs 28.1 package, I get this error when I start emacs

Warning (initialization): An error occurred while loading ‘/home/aaronmeurer/.emacs’:

Wrong type argument: filenamep, /home/aaronmeurer/anaconda3/share/info\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/

This is coming from one of the packages in my init file, but the extra nulls indicate that this is likely an issue with the conda build. Somewhere, the extra null padding that is done for the binary path replacement messed up and created a string that emacs itself is interpreting as including nulls.

I didn't see this issue on macOS, only on Linux.

@asmeurer asmeurer changed the title Extra nulls in path string with 28.1 Linux package\ in 28.1 Extra nulls in path string with 28.1 Linux package Apr 26, 2022
@allispaul
Copy link

I've been having the same issue. Has anyone found a solution?

@izahn
Copy link
Contributor

izahn commented Jun 17, 2022

If someone can give explicit reproduction steps for demonstrating this bug I'll look into it

@asmeurer
Copy link
Member Author

Let me see if I can bisect my init file.

@asmeurer
Copy link
Member Author

Hmm, now when I try to start emacs in a fresh environment, I just get

emacs: symbol lookup error: emacs: undefined symbol: malloc_set_state, version GLIBC_2.2.5

@izahn
Copy link
Contributor

izahn commented Jun 18, 2022

Ouch. We need to add tests that run the GUI. I've just recently learned how to do that:

@izahn
Copy link
Contributor

izahn commented Jun 18, 2022

Although in this case the error occurs with emacs -nw too, so that's not the problem.

Hmm, now when I try to start emacs in a fresh environment, I just get

emacs: symbol lookup error: emacs: undefined symbol: malloc_set_state, version GLIBC_2.2.5

This happens because malloc_set_state has been removed from glibc:

  • The deprecated functions malloc_get_state and malloc_set_state have been
    moved from the core C library into libc_malloc_debug.so. Legacy applications
    that still use these functions will now need to preload libc_malloc_debug.so
    in their environment using the LD_PRELOAD environment variable.

So actually this is not because of a change in conda-forge packaging but because of a change in the host operating system. You can work-around with

export LD_PRELOAD=/usr/lib/libc_malloc_debug.so

(assuming you have /usr/lib/libc_malloc_debug.so on the host OS, adjust as needed). Can you do that and then continue trying to pin down the embedded nulls issue?

I think this is probably unrelated to the extra nulls issue here, so let's open a new issue for the the glibc problem.

@PythonNut
Copy link

PythonNut commented Jun 29, 2022

The extra nulls first appear in configure-info-directory as far as I can tell. If you look at it with describe-variable you can see the nulls even in emacs -Q.

The error actually gets triggered in info.el (part of Emacs) which is probably loaded by many configs at some point or other. One temporary workaround to this problem is to add these two lines to the top of your config:

(setq configure-info-directory (string-replace "\0" "" configure-info-directory))
(setf (car Info-default-directory-list) configure-info-directory)

@izahn
Copy link
Contributor

izahn commented Jul 2, 2022

The extra nulls first appear in configure-info-directory as far as I can tell. If you look at it with describe-variable you can see the nulls even in emacs -Q.

The error actually gets triggered in info.el (part of Emacs) which is probably loaded by many configs at some point or other.

Thanks, I'll look into this when I get back from vacation next week.

@mhlr
Copy link

mhlr commented Jul 11, 2022

A temporary fix is
(setq Info-default-directory-list '("~/miniconda3/share/info/" "/usr/share/info/"))
in early-init.el

@zklaus
Copy link

zklaus commented Jul 12, 2022

Excellent find about the early-init.el, @mhlr! I didn't know about that. The line you posted is specific to your installation. A more general fix might be

(setq configure-info-directory (string-replace "\0" "" configure-info-directory))
(setf (car Info-default-directory-list) configure-info-directory)

I also did some more digging. In src/callproc.c, line 2065 we have Vconfigure_info_directory = build_string (PATH_INFO);, which is defined in src/lisp.h as

INLINE Lisp_Object
build_string (const char *str)
{
  return make_string (str, strlen (str));
}

so that's where things start to go wrong because make_string (src/alloc.c) proceeds to make a lisp string that is not null terminated but records the length in a struct field.

So perhaps the best way forward is to make patch the temporary fix mentioned above into a distribution file?

@izahn izahn linked a pull request Jul 12, 2022 that will close this issue
5 tasks
@izahn
Copy link
Contributor

izahn commented Jul 12, 2022

I think #64 should do it. I built it locally and uploaded to the izahn channel, you can install from there and test locally if you like.

@izahn
Copy link
Contributor

izahn commented Jul 15, 2022

There are currently two PRs being worked on to address this:

  1. fix default info path #64 uses site-start.el to fix Info-default-directory-list after the fact
  2. Add configure-info-dir patch #65 patches emacs to prevent the problem in the first place.

A third option suggested by https://www.gnu.org/software/emacs/manual/html_node/info/Emacs-Info-Variables.html is to set the INFOPATH environment variable, which should prevent Info-default-directory-list from being used at all.

@zklaus zklaus linked a pull request Jul 15, 2022 that will close this issue
5 tasks
@asmeurer asmeurer mentioned this issue Sep 14, 2023
3 tasks
@diekhans
Copy link

This still occurs on Emacs 29.2; any progress in finishing the PRs?

@asmeurer
Copy link
Member Author

It seems the latest status on #65 was that it doesn't work. I don't know if anyone has looked at it recently.

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

Successfully merging a pull request may close this issue.

7 participants