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

Diesel CLI doesn't work with busybox `patch` #1817

Open
sgrif opened this Issue Aug 9, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@sgrif
Member

sgrif commented Aug 9, 2018

On gitter the following error was reported: stderr: patch: can't open 'src/db/schema.rs': File exists. They were using busybox. Installing GNU patch appeared to fix the issue. That error message corresponds to EEXIST, which is likely coming from passing O_EXCL to open. I can confirm that busybox uses that, not sure about GNU.

If that is in fact the case, the solution is to close all open handles to the file before shelling out to patch. I'm not sure if that's actually a feasible option though, since our file is sometimes a tempfile (when I say I'm not sure though, I mean I'm actually not sure. Since patch overrides the file, it does make our previous handle invalid. If we were faced with a pathological tempfile system that immediately deletes the file when all handles to it are closed, I'm not sure if we even work today)

In any case, we need to:

  • Determine if we can support busybox patch
  • If yes, add a test for it which handles both updating src/schema.rs and printing to stdout
  • If no, document this fact, and improve our error messaging
    • Ideally we would explicitly detect the existence of busybox vs GNU, but if that's not possible we can probably just look for File exists in stderr and say "you may be using busybox, we only support GNU"

I'm fine with a PR to improve our error message in the short term while we figure out if we can even support busybox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment