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

error in process sentinel: cide--idb-file-to-obj: Wrong type argument: hash-table-p, nil #203

Open
stardiviner opened this issue Sep 5, 2020 · 11 comments

Comments

@stardiviner
Copy link

I got error on opening C++ source code file.

error in process sentinel: cide--idb-file-to-obj: Wrong type argument: hash-table-p, nil
error in process sentinel: Wrong type argument: hash-table-p, nil

And here is my config:

(use-package cmake-ide
  :ensure t
  :defer t
  :init (cmake-ide-setup))
@atilaneves
Copy link
Owner

I've seen that error before. Does it always happen? Normally it's because there's an issue with the compilation database.

@stardiviner
Copy link
Author

It reports error everytime I open .cpp file.

@atilaneves
Copy link
Owner

On a non-cmake project?

@stardiviner
Copy link
Author

Yes. Maybe cmake-ide need to add condtion detect?

@stardiviner
Copy link
Author

Hi, @atilaneves sorry for bothering you. Is there any update on this issue? Still seeing this error message.

@atilaneves
Copy link
Owner

Do you have a minimal repro I can use?

@stardiviner
Copy link
Author

When I try to create an reproduce environment, I figured out why now, The CMakeLists.txt file is empty. This caused the problem. After I write it up. The problem is gone.
Should cmake-ide try to report more explicit warning about CMakeLists.txt file is empty?

@atilaneves
Copy link
Owner

Yeah, I guess so. I do wonder how to detect that though; obviously a completely empty CMakeLists.txt is a problem, but it could be faulty in other ways.

@stardiviner
Copy link
Author

Elisp can read and detect whether CMakeLists.txt is empty.
It can be done like this:

(with-temp-buffer
  (insert-file-contents "CMakeLists.txt")
  (let ((content (buffer-substring-no-properties (point-min) (point-max))))
    (when (string-empty-p content)
      ...)))

This detection is very strict, only when content is "" empty string. If " " or TAB etc will failed. Need more smart rules.
Don't know how to use Elisp regexp or other ways to apply.

@atilaneves
Copy link
Owner

Elisp can read and detect whether CMakeLists.txt is empty.
It can be done like this:

(with-temp-buffer
  (insert-file-contents "CMakeLists.txt")
  (let ((content (buffer-substring-no-properties (point-min) (point-max))))
    (when (string-empty-p content)
      ...)))

This detection is very strict, only when content is "" empty string. If " " or TAB etc will failed. Need more smart rules.
Don't know how to use Elisp regexp or other ways to apply.

Right. What I meant by "obviously a completely empty CMakeLists.txt is a problem" is that this is an easy case to check, but that's a particular example that doesn't generalise. For instance, a non-empty file with a line containing "42" isn't empty, but it might as well be from cmake's perspective.

@stardiviner
Copy link
Author

Does CMake provide some parser command or lint command? I checked man cmake, not found.
Then I searched "cmake parse", found one Python project. https://github.com/ijt/cmakelists_parsing
But using external tool like this cmakelists_parsing is not a good idea.
For now, seems really no good solution.
But I think cmake-ide can add empty detection at first. At least it can detect real empty file, and save place for future solution.

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

2 participants