git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: David Miller <davem@davemloft.net>, git@vger.kernel.org
Cc: imunsie@au1.ibm.com, linux-kernel@vger.kernel.org,
	a.p.zijlstra@chello.nl, paulus@samba.org, acme@redhat.com,
	kosaki.motohiro@jp.fujitsu.com, mitake@dcl.info.waseda.ac.jp,
	rusty@rustcorp.com.au, fweisbec@gmail.com, ebmunson@us.ibm.com,
	Valdis.Kletnieks@vt.edu, amwang@redhat.com, tfransosi@gmail.com,
	mhiramat@redhat.com, xiaoguangrong@cn.fujitsu.com,
	jaswinderrajput@gmail.com, arjan@linux.intel.com,
	hirofumi@mail.parknet.co.jp, efault@gmx.de, tzanussi@gmail.com,
	anton@samba.org, jkacur@redhat.com, lizf@cn.fujitsu.com,
	rostedt@goodmis.org
Subject: Re: [PATCH] perf: Fix endianness argument compatibility
Date: Wed, 14 Apr 2010 11:28:43 +0200	[thread overview]
Message-ID: <20100414092843.GD10537@elte.hu> (raw)
In-Reply-To: <20100413.014821.34906166.davem@davemloft.net>


* David Miller <davem@davemloft.net> wrote:

> From: "Ian Munsie" <imunsie@au1.ibm.com>
> Date: Tue, 13 Apr 2010 18:37:33 +1000
> 
> > From: Ian Munsie <imunsie@au.ibm.com>
> > 
> > Parsing an option from the command line with OPT_BOOLEAN on a bool data
> > type would not work on a big-endian machine due to the manner in which
> > the boolean was being cast into an int and incremented. For example,
> > running 'perf probe --list' on a PowerPC machine would fail to properly
> > set the list_events bool and would therefore print out the usage
> > information and terminate.
> > 
> > This patch makes OPT_BOOLEAN work as expected with a bool datatype. For
> > cases where the original OPT_BOOLEAN was intentionally being used to
> > increment an int each time it was passed in on the command line, this
> > patch introduces OPT_INCR with the old behaviour of OPT_BOOLEAN (the
> > verbose variable is currently the only such example of this).
> > 
> > I have reviewed every use of OPT_BOOLEAN to verify that a true C99 bool
> > was passed. Where integers were used, I verified that they were only
> > being used for boolean logic and changed them to bools to ensure that
> > they would not be mistakenly used as ints. The major exception was the
> > verbose variable which now uses OPT_INCR instead of OPT_BOOLEAN.
> > 
> > Signed-off-by: Ian Munsie <imunsie@au.ibm.com>
> 
> Thanks for finding and fixing this bug.

Nice fix!

Btw., perf got the option parser from the Git project - i'm wondering how the 
Git folks solved this endianness problem?

	Ingo

       reply	other threads:[~2010-04-14  9:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1271147857-11604-1-git-send-email-imunsie@au.ibm.com>
     [not found] ` <20100413.014821.34906166.davem@davemloft.net>
2010-04-14  9:28   ` Ingo Molnar [this message]
2010-04-14  9:52     ` [PATCH] perf: Fix endianness argument compatibility Jeff King
2010-04-14  9:36 ` [tip:perf/core] perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() tip-bot for Ian Munsie
2010-04-14 15:12   ` Erik Faye-Lund
2010-04-14 15:12   ` Erik Faye-Lund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100414092843.GD10537@elte.hu \
    --to=mingo@elte.hu \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=amwang@redhat.com \
    --cc=anton@samba.org \
    --cc=arjan@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=ebmunson@us.ibm.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=imunsie@au1.ibm.com \
    --cc=jaswinderrajput@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mhiramat@redhat.com \
    --cc=mitake@dcl.info.waseda.ac.jp \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tfransosi@gmail.com \
    --cc=tzanussi@gmail.com \
    --cc=xiaoguangrong@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).