-
Notifications
You must be signed in to change notification settings - Fork 28
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
http: Fix downstream permission bug #1589
Conversation
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.
Is there anything specific to curl or the local runner in that failure case, or is it pointing to a broader issue/feature of permissions across the board? Either way, this fixing the RSC failure is a good thing, but if this makes the HTTP library act differently than the rest of Wake, I do wonder if there's a more precision fix possible. (Mainly, is there a reason the hardlink has to be included in the repro instructions, or can the user change the permissions of the output in-place, so then the rm
winds up potentially throwing out their work rather than safely aborting with "File has been edited since it was created" or whatever the message is.)
Curl will refuse to overwrite the file if it has "weird" permissions but since the weird permission only happens if the user specifically changes them somewhere else its not safe for us to change them back as it would edit an unrelated Path owned by some other part of the system. It's kind of hard to describe the problem in text but I'll give it a try
Using
The weirdest part here is that a User could have a reference to aside: immediately after the call to this function it would be something like
The original |
6894ea3
to
ac165a1
Compare
Yeah, makes sense. I think I was a bit unclear about my questions, though: 1, is this the resolution method we want to support if the user didn't make a link,1 since it risks losing work if they also edited it in the intervening time?, and 2, what do we want to do if the file was created by a non-curl job instead before the same process of hardlink-and-chmod,2 since it should presumably have the same behaviour? I guess one answer for question 1 is that it's irrelevant because the check is only run when the job is exactly the same rather than every time the output is known,3 and if we assume that that's not a bug we can say curl is closer to virtual jobs like After having gone through the cases explicitly and exhaustively, and now having a better idea of the rules around this, I think I would be fine with merging this as-is if we don't think we'll be tightening up that changed-output check in the future. The discrepancies/bugs example 2 reveals should be fixed either way, but that doesn't have to be part of this same PR. Footnotes
|
Folks really shouldn't be editing anything inside of the private/internal
Since the file path is a hash of the http request, the only way a user would ever reasonably create the file with a non-curl job would be to hand write out the exact path, hash included. If they do that then they are opting in to any internal implementation weirdness of the http library
I believe |
Missed (or forgot) the fact that this was only ever going to be happening in
This is specifically asking about things which don't have any connection to curl. If a user writes a Job which creates a file (
Good point, the only way to edit the file would be to use However, the main issue I was trying to point out with that comment is that |
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.
Since this is happening in .build
, I'm happy with any potential weirdness compared to other jobs. I still have a number of remaining questions, but they don't apply specifically to this 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.
I agree with Sam. I think we should take a closer look at the "file changed underneath wake" behaviors but I think this specific fix for the http library is quite targeted, so should not be a problem to merge.
If a downstream user (directly or indirectly) removes the write permissions of a
Path
created bymakeBinaryRequest
then the request is triggered again it would fail as the call to curl wouldn't be able to overwrite the underlying file.This changes the function to remove the file right before recreation to avoid that edge case.