Opened 4 years ago

Last modified 4 years ago

#16301 in-progress bug

lsindex Illegal Byte Sequence Error

Reported by: AGMS Owned by: axeld
Priority: normal Milestone: Unscheduled
Component: Applications/Command Line Tools Version: R1/beta2
Keywords: lsindex Cc: agmsmith@…, ttcoder
Blocked By: Blocking:
Platform: All

Description

When running "lsindex -l" it always prints an error message at the end, after listing all the indices:

lsindex: fs_read_index_dir: (-2147454938) Illegal byte sequence

Works okay if you just do "lsindex". I thought it may be a corrupted index directory (tried adding and removing indices), but this happens on a clean R1B2 installer boot too.

Change History (7)

comment:1 by ttcoder, 4 years ago

Cc: ttcoder added

FWIW, the error does not occur on an old pre-beta hrev (50465). Will try on beta1 too when I reboot.

comment:2 by ttcoder, 4 years ago

Behavior confirmed in beta2, using the exact same partitions to test ; now to actually test on beta1...

comment:3 by ttcoder, 4 years ago

Turns out the bug/problem was already present in beta1:

          Int-64  12/20/2018 04:48 PM   3410944 size
lsindex: fs_read_index_dir: (-2147454938) Illegal byte sequence
~> uname -a
Haiku shredder 1 hrev52295+132 Jan 26 2020 08:04 x86_64 x86_64 Haiku

So that "narrows" it down (in a manner of speaking...) to somewhere between 50465 and 52295+132.

comment:4 by axeld, 4 years ago

When I grep for EILSEQ (that's the corresponding error code), I get very few hits. The ones I get pretty much all have to do with unicode conversion. The code in lsindex looks like this:

dirent *index = fs_read_index_dir(indices);
if (index == NULL) {
	if (errno != B_ENTRY_NOT_FOUND && errno != B_OK) {
		printf("%s: fs_read_index_dir: (%d) %s\n", argv[0], errno, strerror(errno));
		return errno;
	}
	break;
}

This does look good, however, when we look at readdir() which is what fs_read_index_dir() uses internally, we find this code:

count = _kern_read_dir(dir->fd, &dir->first_entry,
	(char*)dir + DIR_BUFFER_SIZE - (char*)&dir->first_entry, USHRT_MAX);
if (count <= 0) {
	if (count < 0)
		__set_errno(count);

	// end of directory
	return NULL;
}

If count == 0, errno is not set, but NULL is returned. The error shown comes from another call.

comment:5 by axeld, 4 years ago

Owner: changed from nobody to axeld
Status: newin-progress

comment:6 by axeld, 4 years ago

The incorrect error message has been fixed in hrev54364. However, the underlying issue has not been investigated yet (I cannot reproduce it on my normal install).

Therefore I'll keep this one open, until someone has gotten to the root cause of it.

comment:7 by AGMS, 4 years ago

I'm able to recreate it by running R1B2 hrev54154_111 anyboot.iso in VirtualBox in 64 bit mode. Just pick boot to desktop, fire up a Terminal and type in lsindex -l.

Note: See TracTickets for help on using tickets.