Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2012 12:20:04 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r244432 - stable/7/sbin/devd
Message-ID:  <201212191220.qBJCK49p091601@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Dec 19 12:20:04 2012
New Revision: 244432
URL: http://svnweb.freebsd.org/changeset/base/244432

Log:
  MFC r243907:
  
  Fix an old bug in devd, where it uses std::sort() to sort the various
  lists it reads from its configuration files on the priority field.
  
  Because some items in the lists have the same priority, and std::sort()
  is not stable, the exact order in which the items are enumerated does
  not have to correspond to the order they appear in the configuration
  files.
  
  Apparently this was never noticed with libstdc++, but with libc++ it
  could cause the "uhid" entry from /etc/devd/usb.conf to be used instead
  of the "ums" entry (which is earlier in the file).  This caused the
  problem described in the PR: the USB mouse module was never loaded, and
  the other actions (such as starting moused) were not executed.
  
  To fix the problem, make devd use std:stable_sort() instead.
  
  Reported by:	Jan Beich <jbeich@tormail.org>
  PR:		bin/172958

Modified:
  stable/7/sbin/devd/devd.cc
Directory Properties:
  stable/7/sbin/devd/   (props changed)

Modified: stable/7/sbin/devd/devd.cc
==============================================================================
--- stable/7/sbin/devd/devd.cc	Wed Dec 19 12:19:56 2012	(r244431)
+++ stable/7/sbin/devd/devd.cc	Wed Dec 19 12:20:04 2012	(r244432)
@@ -351,7 +351,7 @@ public:
 void
 config::sort_vector(vector<event_proc *> &v)
 {
-	sort(v.begin(), v.end(), epv_greater());
+	stable_sort(v.begin(), v.end(), epv_greater());
 }
 
 void



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