decompme / decomp.me

Collaborative decompilation and reverse engineering website
https://decomp.me
MIT License
348 stars 108 forks source link

error: failed to upload function: missing field `slug` at line 1 column 145 #1279

Closed Lurs closed 2 weeks ago

Lurs commented 2 weeks ago

I get following output in my terminal:

(base) larsvi@Lars-PC:~/botw$ tools/decompme -s src/KingSystem/GameData/gdtSaveMgr.cpp SaveMgr::init SaveMgr::init source file: src/KingSystem/GameData/gdtSaveMgr.cpp context: 5212 lines compile flags: --target=aarch64-linux-elf -DNON_MATCHING -DUKING_NX_V150 -g -D SWITCH -D NNSDK -D MATCHING_HACK_NX_CLANG -mcpu=cortex-a57+fp+simd+crypto+crc -mno-implicit-float -stdlib=libc++ -fPIC -fstandalone-debug -fcolor-diagnostics -Wno-unused-command-line-argument -fdebug-prefix-map=/tmp=/home/larsvi/botw/build -fno-rtti -fno-exceptions -fno-strict-aliasing -Wall -Wextra -Wdeprecated -Wno-unused-parameter -Wno-unused-private-field -Wno-invalid-offsetof -Wextra-semi -std=c++1z -x c++ Upload? Yes uploading... error: failed to upload function: missing field slug at line 1 column 145 note: server response: {"code":"Subprocess","detail":"Assembler messages:\n1: Error: junk at end of line, first unrecognized character is `:'","kind":"SubprocessError"}

Error: failed to create scratch`

In https://gist.github.com/Lurs/80991389293227dd3bacac0829b0bd10 you can see some debug data like the full payload the script is uploading. I hope I have everything included. Is there something wrong with my disassembly code? The full Rust code of the script is here: https://github.com/open-ead/nx-decomp-tools/blob/8a19eb879e94ff19bcc5fb59c0ce3336ce3214a9/viking/src/tools/decompme.rs

mkst commented 2 weeks ago

Is this a script you've written yourself? has it ever worked? I uploaded a scratch via the API yesterday using the decomp-permuter. Check out the code for uploading here. Specifically:

post_data = urllib.parse.urlencode(
    {
        "name": func_name,
        "target_asm": asm_cont,
        "context": context,
        "source_code": source,
        "compiler": compiler_name,
        "compiler_flags": get_compiler_flags(compiler),
        "diff_label": func_name,
    }
).encode("ascii")

From the gist you posted, it appears your payload is quite different?

edit: Looking at that code suggests the payload is the same? although there is the platform field - perhaps this should be omitted?

    let data = Data {
        compiler: decomp_me_config.compiler_name.clone(),
        compiler_flags: flags.to_string(),
        platform: "switch".to_string(),
        name: info.name.clone(),
        diff_label: Some(info.name.clone()),
        target_asm: disassembly.to_string(),
        source_code: source_code.to_string(),
        context: context.to_string(),
    };
Lurs commented 2 weeks ago

Looking at https://github.com/decompme/decomp.me/blob/983cc55ae5e4eaedbcefb0545d19f47d006bdaef/backend/coreapp/platforms.py#L19 I think the platform field is a valid field to send to the backend? The rust code is not from me, but it worked several times (Example here: https://gist.github.com/Lurs/842f80919e71e5b02db63fd642d6341d).

mkst commented 2 weeks ago

Is the failure reproducible? You're saying it doesn't happen for other functions?

Lurs commented 2 weeks ago

Thank you for your replies. The failure should be reproducible after following the steps in https://botw.link/contribute/installation. For other functions it is working.

Lurs commented 2 weeks ago

Ok I managed to get your decomp.me site run locally. Never worked with Docker, nginx and co but really cool works from you all! :) The problem is the disassembler code which will be stored in the asm.s file. it begins with:

SaveMgr::init: sub sp, sp, #0x70 stp x26, x25, [sp, #0x20] ... So the double "::" of the function are the problem. Can fix that in the upload script I guess or maybe by passing other arguments to the command.

mkst commented 2 weeks ago

Ah glad you got to the bottom of it. I wonder if it's something we can catch and emit a nicer error if someone tried to upload an invalid label..