Skip to content
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

I keep ending up with a 0 byte executable #81

Open
Nickhoyer opened this issue Jan 18, 2022 · 10 comments
Open

I keep ending up with a 0 byte executable #81

Nickhoyer opened this issue Jan 18, 2022 · 10 comments

Comments

@Nickhoyer
Copy link

Nickhoyer commented Jan 18, 2022

I tried changing my main function from async to sync, I tried running as admin, running in a different folder, closing the app after updating, but every time, it looks to be correctly downloading a 13.2MB file from github, but then without warnings, it replaces my local exe with a 0 byte file that will never run.

Is there anything I can do to avoid this? I didn't see it mentioned in other issues. I'm on windows, and so is my ci runner.
image

@jaemk
Copy link
Owner

jaemk commented Jan 22, 2022

hey @Nickhoyer , could you try using some variation of the code in the docs here

fn update() -> Result<(), Box<::std::error::Error>> {
and tell it to move the downloaded/extracted file to some location that isn't the current exe? I'm wondering if it's something related to exe replacement on windows.

@andrew121410
Copy link

andrew121410 commented Apr 19, 2022

Same, I keep getting 0 bytes. Even when specifying a new location that's not the same location of the executable it's still 0 bytes. Not sure how to fix it, and I'm on Linux(Ubuntu Server)

Looking at the photo Nickhoyer posted it's not a download link for a executable, but a page with JSON on it. If that makes sense?

For an example here's mine

Screenshot 2022-04-19 173419

Going to the "new exe download url" shows

Screenshot 2022-04-19 173603

So maybe this is the problem? I have no idea lol

@jaemk
Copy link
Owner

jaemk commented Apr 19, 2022

The github api returns json to basic get requests. You have to set Accept: application/octet-stream to get back the contents of the release (which happens here):

james@tamale|t.main:~/bin$
::: curl -LO https://api.github.com/repos/andrew121410/Limonium/releases/assets/63040612
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1561  100  1561    0     0  10518      0 --:--:-- --:--:-- --:--:-- 11150
james@tamale|t.main:~/bin$
::: file 63040612
63040612: JSON data

::: curl -LO https://api.github.com/repos/andrew121410/Limonium/releases/assets/63040612 -H 'Accept: application/octet-stream'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 10.0M  100 10.0M    0     0  20.3M      0 --:--:-- --:--:-- --:--:-- 20.3M
james@tamale|t.main:~/bin$
::: file 63040612
63040612: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=ca974c7e079f34babf7575cd2a2e5fd8022e662b, for GNU/Linux 3.2.0, with debug_info, not stripped

@jaemk
Copy link
Owner

jaemk commented Apr 19, 2022

It'd be helpful if you could modify your code to use the example code linked to in #81 (comment), modify the final Move::from_source to write to some other file, and then check if that file has the full contents. My guess is it's something to do with replacing the current binary, but I'm unable to reproduce it myself.

@andrew121410
Copy link

This works

Screenshot 2022-04-19 214414

Screenshot 2022-04-19 214903

@andrew121410
Copy link

Now this actually works. I'm beyond confused

Screenshot 2022-04-19 215816

@jaemk
Copy link
Owner

jaemk commented Apr 20, 2022

That's... Interesting. And if you replace the contents of that update function with a call to the GitHub updater, then it spits out an empty file again?

@andrew121410
Copy link

Yes replacing it with this still replaces it with an empty binary

A4592734-24DB-4052-8354-3DCFB1473A9E

I just realized it’s probably not working correctly because I’m not utilizing self_update correctly in update.rs it calls this

CAF10A1B-9464-4281-B821-A2CAA13882A0

My only asset is just a binary not a archive like a .zip etc

412CAEB0-7682-46B9-859F-8A0905A6C2EC

@jaemk
Copy link
Owner

jaemk commented Apr 20, 2022

Ah, yeah that'll do it! Glad you were able to get to the bottom of it. Maybe it was the same thing affecting @Nickhoyer

@CheatCod
Copy link

Is there a way to configure self_update to not extract?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants