public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/28725] New: eu-ar -x -N COUNT uses instance [COUNT+1] of name
@ 2021-12-25 12:19 panxh_ran at 163 dot com
  2021-12-25 12:20 ` [Bug tools/28725] " panxh_ran at 163 dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: panxh_ran at 163 dot com @ 2021-12-25 12:19 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28725

            Bug ID: 28725
           Summary: eu-ar -x -N COUNT uses instance [COUNT+1] of name
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: panxh_ran at 163 dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 13880
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13880&action=edit
the result of eu-ar -x -N COUNT

eu-ar -x -N COUNT should use instance [COUNT] of name, 
but it uses instance [COUNT+1] of name incorrectly.
Usage: -N  Use instance [COUNT] of name.

The attachments show the differences of command result between "eu-ar -x -N
COUNT"
and "ar -x -N COUNT".

do_oper_extract() in src/ar.c
Is it should be instance-- at Line522?
 522           if (res != NULL && (instance < 0 || instance-- == 0)
 523               && !found[(char **) res->data - argv])
 524             found[(char **) res->data - argv] = do_extract = true;
 525         }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/28725] eu-ar -x -N COUNT uses instance [COUNT+1] of name
  2021-12-25 12:19 [Bug tools/28725] New: eu-ar -x -N COUNT uses instance [COUNT+1] of name panxh_ran at 163 dot com
@ 2021-12-25 12:20 ` panxh_ran at 163 dot com
  2022-08-04  0:05 ` panxh_ran at 163 dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: panxh_ran at 163 dot com @ 2021-12-25 12:20 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28725

--- Comment #1 from panxiaohe <panxh_ran at 163 dot com> ---
Created attachment 13881
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13881&action=edit
the result of ar -x -N COUNT

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/28725] eu-ar -x -N COUNT uses instance [COUNT+1] of name
  2021-12-25 12:19 [Bug tools/28725] New: eu-ar -x -N COUNT uses instance [COUNT+1] of name panxh_ran at 163 dot com
  2021-12-25 12:20 ` [Bug tools/28725] " panxh_ran at 163 dot com
@ 2022-08-04  0:05 ` panxh_ran at 163 dot com
  2022-08-28 15:59 ` mark at klomp dot org
  2022-09-14 19:00 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: panxh_ran at 163 dot com @ 2022-08-04  0:05 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28725

--- Comment #2 from panxiaohe <panxh_ran at 163 dot com> ---
Please pay attention on this issue.
When using instance [COUNT] of name, the instance of check is wrong in
do_oper_extract().
instance-- should be --instance.
 522           if (res != NULL && (instance < 0 || instance-- == 0)
 523               && !found[(char **) res->data - argv])
 524             found[(char **) res->data - argv] = do_extract = true;
 525         }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/28725] eu-ar -x -N COUNT uses instance [COUNT+1] of name
  2021-12-25 12:19 [Bug tools/28725] New: eu-ar -x -N COUNT uses instance [COUNT+1] of name panxh_ran at 163 dot com
  2021-12-25 12:20 ` [Bug tools/28725] " panxh_ran at 163 dot com
  2022-08-04  0:05 ` panxh_ran at 163 dot com
@ 2022-08-28 15:59 ` mark at klomp dot org
  2022-09-14 19:00 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2022-08-28 15:59 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28725

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-08-28
           Assignee|unassigned at sourceware dot org   |mark at klomp dot org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Thanks for the report and analysis.
Next time please post output as text instead of an image.
I posted a patch that includes a testcase:
https://inbox.sourceware.org/elfutils-devel/20220828155746.99653-1-mark@klomp.org/T/#u

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/28725] eu-ar -x -N COUNT uses instance [COUNT+1] of name
  2021-12-25 12:19 [Bug tools/28725] New: eu-ar -x -N COUNT uses instance [COUNT+1] of name panxh_ran at 163 dot com
                   ` (2 preceding siblings ...)
  2022-08-28 15:59 ` mark at klomp dot org
@ 2022-09-14 19:00 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2022-09-14 19:00 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28725

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
commit 6cb01b4ef3cdd4f83d21bbcec72fa66712ac14e6
Author: Mark Wielaard <mark@klomp.org>
Date:   Sun Aug 28 17:46:08 2022 +0200

    ar: Correct -N COUNT off-by-one

    When using instance [COUNT], the instance check is wrong.
    instance-- == 0 should be --instance == 0.

    Add a testcase run-ar-N.sh that uses -N COUNT with extract and delete
    operations checking the right instance was extracted and deleted.

    https://sourceware.org/bugzilla/show_bug.cgi?id=28725

    Reported-by: panxiaohe <panxh_ran@163.com>
    Signed-off-by: Mark Wielaard <mark@klomp.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-14 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-25 12:19 [Bug tools/28725] New: eu-ar -x -N COUNT uses instance [COUNT+1] of name panxh_ran at 163 dot com
2021-12-25 12:20 ` [Bug tools/28725] " panxh_ran at 163 dot com
2022-08-04  0:05 ` panxh_ran at 163 dot com
2022-08-28 15:59 ` mark at klomp dot org
2022-09-14 19:00 ` mark at klomp dot org

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 read-only IMAP folder(s) and NNTP newsgroup(s).