This is an archive of the discontinued LLVM Phabricator instance.

[fs] Prevent symlink destroying.
Needs ReviewPublic

Authored by chestnykh on Jan 6 2023, 10:02 AM.

Details

Summary

If we open symlink with llvm-strip then the current behaviour is to destroy it and create
new regular file. This behaviour is different from the behaviour of binutils strip.
The new behaviour is to modify the real file and to keep symlink.
PR#59848

Diff Detail

Event Timeline

chestnykh created this revision.Jan 6 2023, 10:02 AM
chestnykh requested review of this revision.Jan 6 2023, 10:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 10:02 AM
chestnykh updated this revision to Diff 486943.Jan 6 2023, 11:34 AM
chestnykh updated this revision to Diff 486948.Jan 6 2023, 11:42 AM
chestnykh changed the visibility from "Public (No Login Required)" to "No One".Jan 6 2023, 11:47 AM
chestnykh removed projects: Restricted Project, Restricted Project.
chestnykh removed subscribers: ormris, MaskRay, llvm-commits, hiraditya.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 6 2023, 11:49 AM
chestnykh edited the summary of this revision. (Show Details)Jan 6 2023, 11:52 AM
chestnykh added a reviewer: jakehehrlich.
chestnykh set the repository for this revision to rG LLVM Github Monorepo.
chestnykh changed the visibility from "No One" to "Public (No Login Required)".
chestnykh updated this revision to Diff 486956.Jan 6 2023, 11:53 AM

I think we have made a decision (for crbug.com/1108880 c2a84771bb63947695ea50b89160c02b36fb634d @manojgupta) that we always create a new file instead of reusing the existing file.
It can be argued that our behavior has stronger security characteristics since it doesn't follow a symlink (see https://sourceware.org/bugzilla/show_bug.cgi?id=26945 ).
Perhaps we should just accept this incompatibility with GNU objcopy.