From: SourceForge.net <no...@so...> - 2005-05-23 12:29:29
|
Patches item #1040330, was opened at 2004-10-05 03:22 Message generated for change (Comment added) made by tanders You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1040330&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Accepted Priority: 5 Submitted By: Geert De Peuter (gdepeute) Assigned to: Robert Story (rstory) Summary: Getting rid of strtok Initial Comment: A patch that at least remediates one of the problems of strtok, being that is can not be called recursively. This "solution" replaces strtok with the reentrant version (strtok_r), using a variable from the stack to make sure each function has its own pointer into the string that is tokenized. Probably a configure check for strtok_r could be added (don't know which platforms don't have strtok_r implemented nowadays) Anyway, if there is an interest in this patch and a strtok_r implementation for platforms that don't have it should be written, then let me know. -- Geert Patch is a unified diff taken from HEAD at time of posting ---------------------------------------------------------------------- Comment By: Thomas Anders (tanders) Date: 2005-05-23 14:29 Message: Logged In: YES user_id=848638 Thanks for applying my patch to V5-1-patches. Please also attach it here for future reference. I just noticed that there are still occurences of strtok() in all 5.x.y CVS code: it's in perl/SNMP/SNMP.xs. I have a patch for 5.3 sitting in my local tree that I'll mail to Robert as I can't attach it here. Please apply to 5.[123].y, then close this patch tracker item for good, finally. Thanks to all that have been working on this. ---------------------------------------------------------------------- Comment By: Thomas Anders (tanders) Date: 2005-05-08 02:23 Message: Logged In: YES user_id=848638 The patch still hasn't been applied to 5.1.x and earlier, unfortunately. I've got a clean version of this patch against 5.1.x CVS sitting in my tree that: - has been well-tested - has been successfully used in production for months - fixes bug #1040686 for me Unfortunately SF doesn't seem to allow me to attach it here (since I'm not the original submitter, probably). I'll be happy to provide the patch on request to apply it to 5.1.x. Please! ---------------------------------------------------------------------- Comment By: Thomas Anders (tanders) Date: 2004-10-07 13:55 Message: Logged In: YES user_id=848638 I strongly agree with Mike. It should be applied to V5-1-patches because: - it doesn't change behaviour (other than fixing bugs) - it fixes at least one bug (#1040686) - getting rid of strtok may also prevent other, not yet known bugs (e.g. interactions of strtok usage in an application and the library, as discussed on the coders list) - strtok is deprecated (and documented as such) - it's a clean patch with low risk (if any) ---------------------------------------------------------------------- Comment By: Michael J. Slifcak (slif) Date: 2004-10-06 16:53 Message: Logged In: YES user_id=88697 <opinion> Please apply it as well to 5.1 patches. The reason you state is not sufficient to restrict the changes to main branch only. </opinion> ---------------------------------------------------------------------- Comment By: Robert Story (rstory) Date: 2004-10-06 07:21 Message: Logged In: YES user_id=76148 Applied for 5.2. This would fix a bug (http://sourceforge.net/tracker/index.php?func=detail&aid=1040686&group_id=12694&atid=112694), but is overkill. might just want to fix the isloated problem for previous releases. ---------------------------------------------------------------------- Comment By: Geert De Peuter (gdepeute) Date: 2004-10-06 02:44 Message: Logged In: YES user_id=75327 here is one : http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/string/strtok_r.c ---------------------------------------------------------------------- Comment By: Robert Story (rstory) Date: 2004-10-06 01:00 Message: Logged In: YES user_id=76148 ok, i've changed my mind. Where's that strtok_r implementation? ---------------------------------------------------------------------- Comment By: Michael J. Slifcak (slif) Date: 2004-10-05 09:04 Message: Logged In: YES user_id=88697 The changes for the library look promising. ---------------------------------------------------------------------- Comment By: Robert Story (rstory) Date: 2004-10-05 03:40 Message: Logged In: YES user_id=76148 Since the agent isn't multi-threaded, this patch is of little benefit. It may be beneficial if/when we do go multi-threaded, so I'm not actually rejecting or closing the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1040330&group_id=12694 |