OpenSolaris

Printable Version Enter a New Search
Bug ID 6642972
Synopsis substr() is broken with a negative third argument
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:dtrace
Keywords
Responsible Engineer Adam Leventhal
Reported Against
Duplicate Of
Introduced In
Commit to Fix snv_88
Fixed In snv_88
Release Fixed solaris_nevada(snv_88)
Related Bugs 6642281
Submit Date 18-December-2007
Last Update Date 23-April-2008
Description
[ahl 12.17.2007]

Despite the best efforts of the test suite, the substr() subroutine is broken for certain negative values for the third argument in terms of mimicking perl's substr() behavior:

# perl -e 'printf("-%s-\n", substr("trash", 0, -1));'
-tras-
# dtrace -n BEGIN'{ printf("-%s-\n", substr("trash", 0, -1)); exit(0); }' -q
--
Work Around
N/A
Comments
N/A