From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8FD4B384243A; Tue, 22 Sep 2020 10:54:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FD4B384243A From: "jirislaby at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: dwz X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jirislaby at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nobody at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2020 10:54:51 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26645 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=C3=A1=C5=99 22 09:15 perf > 43866954 -rwxr-xr-x 2 abuild abuild 16704336 z=C3=A1=C5=99 22 09:15 trace They are hard links. The same holds for separated debuginfo binaries: > 43844091 -rwxr-xr-x 3 abuild abuild 28341208 z=C3=A1=C5=99 22 09:15 perf-= 5.8.7-0.x86_64.debug > 43844091 -rwxr-xr-x 3 abuild abuild 28341208 z=C3=A1=C5=99 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) =3D 8 > fstat(8, {st_mode=3DS_IFREG|0755, st_size=3D28341208, ...}) =3D 0 > getpid() =3D 26887 > openat(AT_FDCWD, "./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e", O_R= DWR|O_CREAT|O_EXCL, 0600) =3D 9 > close(9) =3D 0 > unlink("./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e") =3D 0 > link("./usr/bin/perf-5.8.7-0.x86_64.debug", "./usr/bin/trace-5.8.7-0.x86_= 64.debug.#dwz#.maMA6e") =3D 0 > rename("./usr/bin/trace-5.8.7-0.x86_64.debug.#dwz#.maMA6e", "./usr/bin/tr= ace-5.8.7-0.x86_64.debug") =3D 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 lin= ks 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 ha= rd link. Should you remove newpath first? Or do not create the link if it exists already? Note that perf is special:=20 > dwz: ./usr/bin/perf-5.8.7-0.x86_64.debug: DWARF compression not beneficia= l - old size 9932364 new size 9932655 So this is likely reason, why perf-5.8.7-0.x86_64.debug is left unchanged a= nd trace -> perf hard link still exists. --=20 You are receiving this mail because: You are on the CC list for the bug.=