[haiku-commits] Re: haiku: hrev50562 - in src: add-ons/translators/stxt add-ons/kernel/file_systems/nfs kits/locale apps/stylededit

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 30 Sep 2016 11:36:31 +0200

Am 30.09.2016 um 07:22 schrieb Adrien Destugues:

On Thu, Sep 29, 2016 at 10:57:25PM +0200, pulkomandy@xxxxxxxxxxxxx wrote:
f638c82a22f6: StyledText: fix reading of utf-8 documents

  BNode::ReadAttrString does not check for the attribute to actually be a
  string. It will return B_OK (and useless data) if called on a
  B_INT32_TYPE attribute.

I wonder if that's expected behavior from ReadAttrString (and ReadAttr
which it uses). They use fs_read_attr, which has a "type" parameter, but
does not forward it to the underlying syscall.

Should the type check be done:
- In calling code as I did?
- In BNode?
- In fs_read_attr? (both of these three would cost an extra call to
  fs_stat_attr)
- In the syscall used to read an attribute? (but not all filesystems may
  allow it?)

I have a faint memory of wondering about this myself. I think we went with the BeOS compatible solution here, which means there isn't much we can do about it.

Bye,
   Axel.

Other related posts: