-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
xar: fix Linux build on staging-next #352507
Conversation
I can not judge the contents of the patch in detail, but the approach for avoiding rebuilds seems fine. |
Since the only report of a Linux failure was related to trying to get Linux‐to‐Darwin cross working, maybe this is sufficiently non‐urgent that we can just throw it in the next |
} | ||
+#elif defined(__linux__) | ||
+ // Linux has to get the path to the file via `/proc`. | ||
+ if (readlink("/proc/self/fd/<n>", &path_buff, PATH_MAX) < 0) { |
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.
This <n>
cannot possibly be right, right?
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.
No, it’s not. It was a placeholder I forgot to convert because I didn’t have much time tonight to work on stuff. I’ve marked this draft until I can get a chance to fix it tomorrow.
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 updated it to use snprintf
to generate the path to pass to readlink
.
16b344e
to
c739a09
Compare
I can retarget staging if that would be preferred. @tie? |
+ close(fd); | ||
+ return NULL; | ||
+ } | ||
+ // The filename is the file’s when the fd was created. Check to make sure it still exists. |
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.
Do we really have to check that the file exists? How does F_GETPATH on Darwin handle this case (e.g. fcntl after unlink)?
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.
Not sure. The documentation just says it gets the path. I’m going to write some test programs later today to probe the behavior to see what Darwin does.
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.
Darwin tracks name changes for renames. When the file is unlinked, F_GETPATH
appears to return the last name it had. It may be possible to track renames in Linux (not sure), but it’s probably not worth the effort. Bailing if the underlying file was removed or renamed seems like the safest/easiest option.
c739a09
to
0a48b45
Compare
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.
LGTM
Adds an alternate implementation of
F_GETPATH
for Linux. Avoids rebuilds on Darwin. Fixes failure on staging-next #348827. I tested that it builds. It would be good if a Linux user could confirm this is the right approach.Closes #352453.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.