From: "jirislaby at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: dwz@sourceware.org
Subject: [Bug default/26645] New: dwz does not remove a tmp file when working on perf
Date: Tue, 22 Sep 2020 10:54:51 +0000 [thread overview]
Message-ID: <bug-26645-11298@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=26645
Bug ID: 26645
Summary: dwz does not remove a tmp file when working on perf
Product: dwz
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: default
Assignee: nobody at sourceware dot org
Reporter: jirislaby at gmail dot com
CC: dwz at sourceware dot org
Target Milestone: ---
Our (openSUSE) build of perf results in 2 binaries trace & perf (ls -li):
> 43866954 -rwxr-xr-x 2 abuild abuild 16704336 zář 22 09:15 perf
> 43866954 -rwxr-xr-x 2 abuild abuild 16704336 zář 22 09:15 trace
They are hard links. The same holds for separated debuginfo binaries:
> 43844091 -rwxr-xr-x 3 abuild abuild 28341208 zář 22 09:15 perf-5.8.7-0.x86_64.debug
> 43844091 -rwxr-xr-x 3 abuild abuild 28341208 zář 22 09:15 trace-5.8.7-0.x86_64.debug
Now when dwz is run:
$ dwz -h -r -m .dwz/perf-5.8.7-0.x86_64 -l 10000000 -L 50000000
./usr/bin/perf-5.8.7-0.x86_64.debug ./usr/bin/trace-5.8.7-0.x86_64.debug ....
it results in (strace):
> openat(AT_FDCWD, "./usr/bin/trace-5.8.7-0.x86_64.debug", O_RDONLY) = 8
> fstat(8, {st_mode=S_IFREG|0755, st_size=28341208, ...}) = 0
> getpid() = 26887
> openat(AT_FDCWD, "./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e", O_RDWR|O_CREAT|O_EXCL, 0600) = 9
> close(9) = 0
> unlink("./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e") = 0
> link("./usr/bin/perf-5.8.7-0.x86_64.debug", "./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e") = 0
> rename("./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e", "./usr/bin/trace-5.8.7-0.x86_64.debug") = 0
The thing is that the rename is thought to actually remove 'oldpath' (first
argument), but in case of hardlinks, it is documented it does nothing:
> If oldpath and newpath are existing hard links referring to the
> same file, then rename() does nothing, and returns a success status.
Sure, perf-5.8.7-0.x86_64.debug and trace-5.8.7-0.x86_64.debug are hard links
and you create trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e (which links to perf-*)
and then rename it to trace-5.8.7-0.x86_64.debug which is still the same hard
link.
Should you remove newpath first? Or do not create the link if it exists
already?
Note that perf is special:
> dwz: ./usr/bin/perf-5.8.7-0.x86_64.debug: DWARF compression not beneficial - old size 9932364 new size 9932655
So this is likely reason, why perf-5.8.7-0.x86_64.debug is left unchanged and
trace -> perf hard link still exists.
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2020-09-22 10:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 10:54 jirislaby at gmail dot com [this message]
2020-10-01 13:19 ` [Bug default/26645] " mark at klomp dot org
2020-10-01 13:19 ` mark at klomp dot org
2021-02-13 22:57 ` mark at klomp dot org
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=bug-26645-11298@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=dwz@sourceware.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).