Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 435078

Summary: The output of "strings -0 file" is in loop and "-n 0xA" cannot be correctly recognized
Product: Red Hat Enterprise Linux 5 Reporter: chuli <chul>
Component: binutilsAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 5.1CC: cward, jan.kratochvil, mnowak, pmuller, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 21:57:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
correct the bug when using "-0" and use strtoul() in replace integer_arg() to fix "-n hexnumber"
none
Upstream form of the Comment 1 patch.
none
Upstream patch reduced for a needless output change for RHEL. none

Description chuli 2008-02-27 08:14:53 UTC
Description of problem:
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"

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

binutils-2.17.50.0.6-5.el5

How reproducible:
100%


Steps to Reproduce:
1.touch file contains some characters
2.execute "strings -0 file"
3.execute "strings -n 0xA file"
  
Actual results:
step2 is in loop and step3 will report "invalid number 0xA"

Expected results:
step2 will report "invalid number 0" and step3 will print the strings of which 
the length is more than 9 in file.

Additional info:
It seems the minumum length of "strings -n 0xB" is not 11.

Comment 1 chuli 2008-02-27 08:14:53 UTC
Created attachment 296030 [details]
correct the bug when using "-0" and use strtoul() in replace integer_arg() to fix "-n hexnumber"

Comment 2 Jan Kratochvil 2008-04-16 13:36:37 UTC
Created attachment 302600 [details]
Upstream form of the Comment 1 patch.

Upstream commits:
  http://sourceware.org/ml/binutils-cvs/2008-02/msg00083.html
  http://sourceware.org/ml/binutils-cvs/2008-02/msg00036.html

2008-02-15  Chu Li  <chul.com>
	    Nick Clifton  <nickc>

	PR binutils/5713
	* strings.c (integer_arg): Delete function.
	(string_min): Initialise to 4.
	(main): Use strtoul to parse integer arguments.
	Move check for an invalid string length to after all the arguments
	have been parsed.
	(usage): Use indentation to indicate that -<n> is a another form
	of the --bytes= command line option.

2008-02-08  H.J. Lu  <hongjiu.lu>

	PR binutils/5713
	* strings.c (main): Set string_min to 4 if it is <= 0.

Comment 3 Jan Kratochvil 2008-04-16 13:41:05 UTC
Created attachment 302601 [details]
Upstream patch reduced for a needless output change for RHEL.

Comment 4 RHEL Program Management 2008-06-02 20:16:34 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 15 errata-xmlrpc 2009-01-20 21:57:25 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0198.html