-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPM: Make /usr/bin/code owned by package #142907
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0900570
RPM: Make /usr/bin/code owned by package
ferdnyc 07f41ae
Merge branch 'main' into patch-1
ferdnyc 5e51c3b
Merge branch 'main' into patch-1
ferdnyc f7693f3
Merge branch 'main' into patch-1
ferdnyc 4ac2575
Merge branch 'main' into patch-1
ferdnyc 34c5a25
Merge branch 'main' into patch-1
rzhao271 c1cc94b
Merge branch 'main' into patch-1
ferdnyc 7ea9944
Merge branch 'main' into patch-1
ferdnyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure which directory
..
is pointing at. Is there an absolute path one can use instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rzhao271 A relative symlink will be relative to the location of the link itself. So, in this case, the symlink at
%{buildroot}/usr/bin/@@NAME@@
will be pointing at%{buildroot}/usr/bin/../share/@@name@@/bin/@@name@@
. (Or, normalized, to%{buildroot}/usr/share/@@name@@/bin/@@name@@
.)An absolute path is certainly an option, but it has the downside that the link would be non-relocatable. Using a relative link, the link will already be correct from inside the
%{buildroot}
(instead of pointing to/usr/bin/
on the build machine), and it will still be good even if someone decides to install the package in/usr/local/
,$HOME/.local/
, etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common practice is pretty split on the question. On my system, out of 7447 items in
/usr/bin/
, 950 are symlinks:/etc/alternatives/
/usr/
../{share,lib,libexec,...}
, or in a few cases even../../usr/*
.(There are 42 yet unaccounted for there, out of the total 950. Most (39) are pointing to
./<something>
— so, special case of same-directory. The final three outliers, I can't explain. They didn't match any of my greps.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rzhao271 I notice that in 7492ba5, @Tyriar changed the scriplet code to use
%{_bindir}
instead of a hardcoded/usr/bin/
, as the location to create the link.That seems to have been intended as a nod to relocatability, although in practice it isn't because it won't work the way it was apparently intended to. The expansion of
%{_bindir}
in the scriptlet code is performed byrpmbuild
when generating the binary RPM. The scriptlet as embedded into the RPM still contains the same hardcoded/usr/bin/
(assuming that was the value of%(_bindir}
on the system creating the RPM), it won't change based on where the package is installed or anything else:If the package were actually relocatable, and the symlink could be installed in some other location, then I agree that an absolute-path symlink to
/usr/share/...
would be more appropriate because the symlink itself might be somewhere other than/usr/bin/
. But nothing about the current packaging makes that possible, really, so the%{_bindir}
there is a bit odd.(Actually, it's not, what's odd is that the entire packaging doesn't use macros like
%{_bindir}
. I would expect the%files
section of the specfile to look more like this (with my addition), rather than hardcoding so many of the paths.):If that were the case, then I would absolutely create the symlink to point to
%{_datadir}/%{name}/bin/%{name}
as there's no way to be sure how%{_bindir}
and%{_datadir}
are located relative to each other.%{_datadir}
may or may not be../share/
, relative to%{_bindir}
. But since the current packaging is all absolute paths, their relative locations are fixed and unambiguous.Still, I'll happily change the relative symlink to an absolute one, if that's preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's near the end of the iteration, my plan is to merge this during debt week, which is in two weeks from now. https://github.com/microsoft/vscode/wiki/Development-Process#inside-an-iteration
You can leave the PR as-is. The suggestion to use more macros seems reasonable to me, though I'd put that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rzhao271 OK, cool, thanks.
Agreed, though I'm a little stuck on how best to accomplish that, if I wanted to submit such a PR "now" (for small values of "now").
If I were to submit a PR based on the current
.spec
file, with this PR un-merged, then they'd interact with each other in ways that makes the merge process tenuous. Beyond actual merge conflicts that would have to be resolved (which wouldn't take much effort to sort out), after this PR is merged the other PR would then need to further modify this change, for it to not break the packaging.In a macro-based specfile, as I mentioned, a symlink targeting a path under
%{_datadir}
should not assume it's located under../share/
, from%{_bindir}
. Installing to macro-driven paths would make a relative-path link inadvisable, unless the relative path from post-expansion%{_bindir}
to post-expansion%{_datadir}
were first computed for the link.(Actually, the relative path link is irrelevant. The same issue comes up with absolute paths, since linking to
/usr/share/...
would no longer be correct once the target file is being installed to%{_datadir}/...
.I suppose I could create a PR that branches off of this PR's commit, and add a note that this PR should be merged prior to that one, but that feels a bit... well, either "convoluted", or "presumptuous" on my part. If not both.
The other option is to wait until after this PR is merged, to start work on the other one, since it would then be able to take this change into account. But (in addition to presenting a challenge for my attention span, if I'm to remember
that I should revisit something I need to work on "some time after two weeks from now"), IIUC that would mean delaying that change until the following release? Which isn't really a problem, as there's certainly no rush, but it
does make the process feel a bit drawn out.
Any suggestions you have for how best to proceed would be welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdnyc branching off the original PRs commit is good since it will just turn into a regular single change PR once this gets merged.