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

"nitems == 1 not true" #72

Open
elig0n opened this issue Apr 10, 2021 · 9 comments
Open

"nitems == 1 not true" #72

elig0n opened this issue Apr 10, 2021 · 9 comments

Comments

@elig0n
Copy link

elig0n commented Apr 10, 2021

sdcv-0.5.3 from AUR

removing ~/.cache/sdcv/ and running sdcv show save to cache lines until:

Internal error: nitems == 1 not true at /build/sdcv/src/sdcv-0.5.3/src/stardict_lib.cpp: 544

Which is very much like this 2017 issue, for which the workaround on that page is still good, so I'm guessing the problem remains to lie with load_cache

Running sdcv as root, or another user on the same machine the problem does not recur.
Also, saving to cache only happens for regular users and not root, is that normal?

@greg-minshall
Copy link

Console version of Stardict, version 0.5.5

hi. i'm having this symptom i assume:

Internal error: nitems == 1 not true at /usr/src/debug/sdcv/sdcv-0.5.5/src/stardict_lib.cpp: 530

i tried deleting every sdcv/stardict cache or whatever in my home directory i could find (in ~/.cache, ~/.local/share, ...), but that doesn't seem to have helped.

if you have any ideas...

@anakojm
Copy link

anakojm commented Aug 17, 2024

I have the same issue with https://github.com/BoboTiG/ebook-reader-dict/blob/master/docs/en/README.md:

sdcv: /build/sdcv/src/sdcv-0.5.5/src/stardict_lib.cpp:530: const gchar* {anonymous}::OffsetIndex::read_first_on_page_key(glong): Assertion `(nitems == 1)' failed.

qstardict also crashes with a similar error (qstardict: stardict_lib.cpp:682: gulong {anonymous}::OffsetIndex::load_page(glong): Assertion `(nitems == page_data.size())' failed.)

goldendict does not crash

@Dushistov
Copy link
Owner

@anakojm

The assertion only occurred if there are problems with the *.oft file.

Is removing of dict-data.idx.oft fix problem ?

@anakojm
Copy link

anakojm commented Aug 19, 2024

I don’t see such a file:

/usr/share/stardict/dic/bobotig-en $ tree
.
├── dict-data.dict.dz
├── dict-data.idx
├── dict-data.ifo
└── res
    ├── 02d176db.gif
    ├── 04454792.gif
    ├── 056e3359.gif
    ├── 0683160a.gif
    ├── 0715a661.gif
    …
    ├── f9c3b57e.gif
    ├── f9c3d9c7.gif
    ├── fb96b5c6.gif
    ├── fed24f8f.gif
    └── fee40bb1.gif

2 directories, 123 files

I tried removing the *.idx file but then sdcv segfaults.

I added some lines to debug and the file giving the error is dict-data.idx:

/tmp/sdcv $ ./sdcv
…
wordentry_buf = Ledinghemois
std::min(sizeof(wordentry_buf), static_cast<size_t>(page_size)) = 264
idxfile = /usr/share/stardict/dic/bobotig-fr/dict-data.idx
nitems = 1
wordentry_buf = !
std::min(sizeof(wordentry_buf), static_cast<size_t>(page_size)) = 264
idxfile = /usr/share/stardict/dic/bobotig-en/dict-data.idx
nitems = 1
wordentry_buf = !
std::min(sizeof(wordentry_buf), static_cast<size_t>(page_size)) = 0
idxfile = /usr/share/stardict/dic/bobotig-en/dict-data.idx
nitems = 0
sdcv: /tmp/sdcv/src/stardict_lib.cpp:540: const gchar* {anonymous}::OffsetIndex::read_first_on_page_key(glong): Assertion `(nitems == 1)' failed.
Aborted

@Dushistov
Copy link
Owner

@anakojm

If your dictionary in /usr/share/stardict/dic/ , then *.oft can exists there,
because of sdcv have no rights to write into such directory.

So *.oft file somewhere in your home directory.
Possible location ~/.cache/sdcv/.

@anakojm
Copy link

anakojm commented Aug 21, 2024

There was indeed dict-data.idx.oft in ~/.cache/sdcv/ but removing it does nothing. It gets created again identically and sdcv still shows the same error.

image

@elig0n
Copy link
Author

elig0n commented Nov 5, 2024

For me, *.oft files in /usr/share/stardict/dic/ didn't have o+r permissions and were owned by root, after setting it the problem was fixed. Perhaps explicit read permissions should be checked by the app and on error reported in human format to the user instead of the above cryptic one ? (unless there are other cases where nitems can be non-1)

@anakojm
Copy link

anakojm commented Nov 9, 2024

it wasn’t my case. my issue stopped appearing for a moment after an update of stardict-bobotig-en. should this issue be closed and another one opened?

@greg-minshall
Copy link

fwiw, i still have the problem

~ *​​​ ❯ sdcv fairly
Internal error: nitems == 1 not true at /usr/src/debug/sdcv/sdcv-0.5.5/src/stardict_lib.cpp: 530

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

4 participants