Bug 7754 - samba uses index(), marked as legacy
Summary: samba uses index(), marked as legacy
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Build environment (show other bugs)
Version: unspecified
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Björn Jacke
QA Contact: Samba QA Contact
Depends on:
Reported: 2010-10-26 14:15 UTC by Sven Neumann
Modified: 2010-10-27 13:50 UTC (History)
0 users

See Also:

patch to replace use of index() with strchr() (544 bytes, patch)
2010-10-26 14:16 UTC, Sven Neumann
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Neumann 2010-10-26 14:15:18 UTC
The function index() is marked as LEGACY in POSIX.1-2001.  POSIX.1-2008 removes the specifications of index() and rindex(), recommending strchr(3) and strrchr(3) instead.

This is an issue when trying to compile samba against uCLibc as it doesn't provide these legacy functions by default.

I'll attach a simple patch that changes the code to use strchr() instead. This patch is taken from buildroot. It would be nice to see it going upstream so that buildroot doesn't need to patch samba any longer.
Comment 1 Sven Neumann 2010-10-26 14:16:05 UTC
Created attachment 6034 [details]
patch to replace use of index() with strchr()
Comment 2 Jeremy Allison 2010-10-26 20:38:14 UTC
Oh my god. What horrible code in here....

I'll fix this asap !


Comment 3 Jeremy Allison 2010-10-27 13:50:31 UTC
This code is horrible and needs a rewrite, but the fix in the patch is simple and correct - applied for 3.6.0.
Thanks !