RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 834265 - net command should print prefix 0x before the actual addresses
Summary: net command should print prefix 0x before the actual addresses
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: crash
Version: 6.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Dave Anderson
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-21 11:34 UTC by Stanislav Kozina
Modified: 2013-03-04 01:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-16 15:28:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Stanislav Kozina 2012-06-21 11:34:01 UTC
Description of problem:

Net command does not print prefix '0x' before net_device addresses, therefore its output is not possible to pass to px command for example.

Version-Release number of selected component (if applicable):

# rpm -qf `which crash`
crash-5.1.8-1.el6.x86_64
$ rpm -qf `which crash`
crash-6.0.5-0.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. net
2.
3.
  
Actual results:

crash> net
   NET_DEVICE     NAME   IP ADDRESS(ES)
ffff880317be7820  lo     127.0.0.1
ffff880312458020  eth0   10.34.1.37

Expected results:

crash> net
   NET_DEVICE     NAME   IP ADDRESS(ES)
0xffff880317be7820  lo     127.0.0.1
0xffff880312458020  eth0   10.34.1.37

Additional info:

Comment 1 Dave Anderson 2012-06-21 13:14:17 UTC
Sorry, that's not going to change for this command (or for all of the other
commands that display structure addresses).  A foundational tenet of the
crash utility is the avoidance of the 0x whenever possible, both for user
input and command output.  And why use "px" for this example?

  crash> net
     NET_DEVICE     NAME   IP ADDRESS(ES)
  ffffffff80321e80  lo     127.0.0.1
  ffff81003c058000  eth0   10.16.185.59
  ffff810038ea7800  sit0   
  crash> net_device ffff81003c058000
  struct net_device {
    name = "eth0\000\000\000\000\000\000\000\000\000\000\000", 
    name_hlist = {
      next = 0x0, 
      pprev = 0xffffffff804d6ed0
    }, 
    mem_end = 0, 
    mem_start = 0, 
    base_addr = 0, 
    irq = 193,
  ...

Comment 3 Stanislav Kozina 2012-06-21 13:45:36 UTC
(In reply to comment #1)
> Sorry, that's not going to change for this command (or for all of the other
> commands that display structure addresses).  A foundational tenet of the
> crash utility is the avoidance of the 0x whenever possible, both for user
> input and command output.

And would the user distinquish hex and dec output with such tenet? What's the motivation for it? For example, by default crash outputs:

crash> net_device.flags ffff880312458020
  flags = 4099

Is this hex, or dec? By default crash prints some values in dec, some in hex. How can I distinquish each other without the prefix?
What's the motivation for such tenet?

My main concern is that 'px' command considers values which does not begin with '0x' as symbols - therefore I have to add 0x every single time I need to do some computation, which is not pleasant.

> And why use "px" for this example?

Because I need to get pointer to some item in the structure. Because `struct' command can't be used with -o option together with the address (bz834260), I have to compute the address myself.

Comment 4 Dave Anderson 2012-06-21 15:28:25 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > Sorry, that's not going to change for this command (or for all of the other
> > commands that display structure addresses).  A foundational tenet of the
> > crash utility is the avoidance of the 0x whenever possible, both for user
> > input and command output.
> 
> And would the user distinquish hex and dec output with such tenet? What's
> the motivation for it? For example, by default crash outputs:
> 
> crash> net_device.flags ffff880312458020
>   flags = 4099
>
> Is this hex, or dec? By default crash prints some values in dec, some in
> hex. How can I distinquish each other without the prefix?
> What's the motivation for such tenet?
>

Well, in the case above, that output is from the embedded gdb module, not
from crash per se, and gdb's output depends upon the current state of its
output radix -- which defaults to decimal.  That's annoying taking your
example of a bit-map "flags" member, but gdb sees it as just an "int".
 
So from crash, the gdb output (and along with it, several instances of
crash-only output) is controlled by the "set radix 10" or "set radix 16"
commands (or the built-in "hex" and "dec" aliases).  

I've also recently gone through commands that display gdb structure
output (struct, vm, list, net, mach, dis, and task) and added new
-x and -d options that override the current radix setting.

So for example: 

Default:

  crash> net_device.flags ffffffff80321e80 
    flags = 9
  crash>

Change it and redisplay:

  crash> hex
  output radix: 16 (hex)
  crash> net_device.flags ffffffff80321e80
    flags = 0x9
  crash>

Change it back, but override the default:

  crash> dec
  output radix: 10 (decimal)
  crash> net_device.flags ffffffff80321e80
    flags = 9
  crash> net_device.flags ffffffff80321e80 -x
    flags = 0x9
  crash>

All of the newer -x/-d options are not yet seen in the RHEL versions
of crash, but during the errata cycles I typically rebase the RHEL
versions.  But there's always a lag, and the GSS folks typically
update their crash version from upstream on their dumpfile-hosting
systems.

Comment 5 RHEL Program Management 2012-07-10 06:59:43 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 Stanislav Kozina 2012-07-10 12:02:10 UTC
> > crash> net_device.flags ffff880312458020
> >   flags = 4099
> 
> Well, in the case above, that output is from the embedded gdb module, not
> from crash per se, and gdb's output depends upon the current state of its
> output radix -- which defaults to decimal.  That's annoying taking your
> example of a bit-map "flags" member, but gdb sees it as just an "int".

Yes, I understand the principle, I just wanted to open a discussion if this is really behavior we want. I really picked the 'flags' example because it's a bit controversial, sorry about that:-)

> So from crash, the gdb output (and along with it, several instances of
> crash-only output) is controlled by the "set radix 10" or "set radix 16"
> commands (or the built-in "hex" and "dec" aliases).  

Yes, it's a good to have an option to set default output radix to 16, and I personally find it as neccessary that I have it in my crashrc file.

> I've also recently gone through commands that display gdb structure
> output (struct, vm, list, net, mach, dis, and task) and added new
> -x and -d options that override the current radix setting.

Thanks for that - might be useful. Although I personally prefer to change default output radix.

>   crash> net_device.flags ffffffff80321e80 -x

Option can be put after the argument? In which cases? Is this a rule for all options?

> All of the newer -x/-d options are not yet seen in the RHEL versions
> of crash, but during the errata cycles I typically rebase the RHEL
> versions.  But there's always a lag, and the GSS folks typically
> update their crash version from upstream on their dumpfile-hosting
> systems.

I see, I will really make sure to always use only current version of crash. Thanks a lot for reminding it.
And GSS folks keep an eye to update the version we use on our core analysis systems, so it's current there all the time.

Thanks.

Comment 7 Dave Anderson 2012-07-10 15:48:21 UTC
> Yes, it's a good to have an option to set default output radix to 16, 
> and I personally find it as neccessary that I have it in my crashrc file.

Right, and I understand that can be a pain if you find yourself running
on a machine where your $HOME/.crashrc doesn't exist.

How about if I add a new "crash --hex ..." command line option?  (and like
most command line options, it would overrule any conflicting .crashrc entry.)

> Option can be put after the argument? In which cases? Is this a rule for
> all options?

Sure, in pretty much all cases -- and why not?  In fact, it makes it much
easier if you want to rerun a prior command with a different radix -- just
recall the command and append the option to the command line.

Comment 8 RHEL Program Management 2012-07-10 23:10:38 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.


Note You need to log in before you can comment on or make changes to this bug.