Opened 12 years ago

Closed 12 years ago

#3867 closed Bug (fixed)

memmem(3) in Solaris 11 doesn't work as expected

Reported by: cloyce Owned by: charles
Priority: Normal Milestone: 2.20
Component: libtransmission Version: 2.13
Severity: Minor Keywords: libtransmission, configure
Cc:

Description

I'm building Transmission 2.13 on a Solaris 11 Express (11/10) system using the Studio 12.2 compilers.

It looks like one of the new things in Solaris 11 is memmem(3). Unfortunately, its semantics aren't what libtransmission expects. Fortunately, the test suite caught it.

The tests that fail are these (lines 296-299 of utils-test.c):

    check( tr_memmem( haystack, sizeof haystack, "", 0) == haystack )
    check( tr_memmem( haystack, sizeof haystack, NULL, 0) == haystack )
    check( tr_memmem( haystack, 0, "", 0) == haystack )

The problem is that when one of the lengths passed is 0 or the haystack is empty or NULL, memmem(3) on Solaris 11 returns 0 instead of haystack.

I don't know if this would affect operation of Transmission... All I know is that it made the tests fail. So I have no idea whether this is severe (like will cause it to never work on Solaris 11, which would be severe for me :) ) or trivial.

It should be pretty easy to test this at configure time. I'm sorry I don't have a patch, but my autoconf-fu has atrophied significantly over the years.

Change History (2)

comment:1 Changed 12 years ago by charles

  • Milestone changed from None Set to 2.20
  • Severity changed from Normal to Minor
  • Status changed from new to assigned

It doesn't look like we use memmem() with 0 anywhere. IIRC the motivation behind these test cases was to proactively nail down the fringe cases... probably a mistake in this case. I'll remove these three tests.

comment:2 Changed 12 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r11619. Thanks for reporting this.

Note: See TracTickets for help on using tickets.