Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2020 16:30:00 +0000 (UTC)
From:      Ryan Moeller <freqlabs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362544 - head/lib/libdevdctl
Message-ID:  <202006231630.05NGU0VQ047936@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: freqlabs
Date: Tue Jun 23 16:29:59 2020
New Revision: 362544
URL: https://svnweb.freebsd.org/changeset/base/362544

Log:
  libdevdctl: Force full match of "timestamp" field name
  
  OpenZFS generates events with a "zio_timestamp" field, which gets mistaken for
  "timestamp" by libdevdctl due to imprecise string matching.  Then later it is
  assumed a "timestamp" field exists when it doesn't and an exception is thrown.
  
  Add a space to the search string so we match exactly "timestamp" rather than
  anything with that as a suffix.
  
  Approved by:	mav (mentor)
  MFC after:	3 days
  Sponsored by:	iXsystems, Inc.

Modified:
  head/lib/libdevdctl/event.cc

Modified: head/lib/libdevdctl/event.cc
==============================================================================
--- head/lib/libdevdctl/event.cc	Tue Jun 23 15:36:05 2020	(r362543)
+++ head/lib/libdevdctl/event.cc	Tue Jun 23 16:29:59 2020	(r362544)
@@ -427,7 +427,7 @@ Event::TimestampEventString(std::string &eventString)
 		 * Add a timestamp as the final field of the event if it is
 		 * not already present.
 		 */
-		if (eventString.find("timestamp=") == string::npos) {
+		if (eventString.find(" timestamp=") == string::npos) {
 			const size_t bufsize = 32;	// Long enough for a 64-bit int
 			timeval now;
 			char timebuf[bufsize];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006231630.05NGU0VQ047936>