microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
194 stars 58 forks source link

When dry run output is greater than 65537, it's truncated into two lines #545

Closed Remiliap closed 2 months ago

Remiliap commented 9 months ago

I have a compile command whose output is very long, and I found that it was truncated into two lines in the dryrun.log file at position 65537, which caused the configuration to be incorrect.

gcampbell-msft commented 9 months ago

@Remiliap Hi! Thanks for posting this issue. Could you confirm for me what versions this happens on? I'd like to confirm that this is a generic bug and not a regression in our most recent release. Thanks!

Remiliap commented 9 months ago

v0.8.22

gcampbell-msft commented 9 months ago

@Remiliap A couple of questions:

  1. Does this happen on any versions prior to v0.8.22?
  2. Either way, could you provide a repro project so that we can attempt to reproduce this issue and investigate it?
Remiliap commented 9 months ago

@gcampbell-msft I tried versions 0.5 to 0.7 and all of them encountered this bug

To reproduce this bug, run the configuration using the Makefile generated by the following Python code

with open("Makefile","w") as file:
    file.write("all:\n\tg++ -DDEF")
    for n in range(10000):
        file.write(" f{}.cpp".format(n))

Then create two CPP files named f0.cpp and f9999.cpp and check if the macro definition is configured

#ifdef DEF
void t() {}
#endif
gcampbell-msft commented 4 months ago

@Remiliap Does this issue still reproduce in the most recent pre-release version? I am not able to reproduce this on my machine.

@Yingzi1234 Could you help in trying to reproduce? Thanks!

Yingzi1234 commented 4 months ago

@Remiliap We are trying to reproduce your issue but we can't reproduce it based on the information you provided, could you provide us with the folder you reproduced?

Please feel free if you have any doubt!

Remiliap commented 3 months ago

@Yingzi1234 I still have this issue on v0.9.10

Look at this repository https://github.com/Remiliap/makefile_tool_bug_repro

I can use build_log to configure the project normally, but in dry run mode, f9999.cpp is not configured.I copied the last few lines of the output into the output file.The dry-run.log file is the dry run output described in the output.

I used to think that the reason for the problem was that the dry-run output was truncated into two lines, as seen in the dry-run.log file.But in the output, the configuration proceeded normally to f6656.cpp.

Yingzi1234 commented 3 months ago

@gcampbell-msft @Remiliap Based on the repository you provided, we tried to reproduce your issue. However, we were unable to reproduce it on latest version, you can get the details below.

ENV:

  1. VSCode version: 1.90.0(user setup)
  2. C/C++ version: v1.20.5
  3. Makefile tools version: v0.10.9(pre-release)

Repro steps:

  1. Open VSCode and clone the repo
  2. Open settings and search for "makefile.extension", set "Makefile: Extension Output Folder" to ".vscode"
  3. Click F1 to run "Makefile: configure" command

Actual result: It was configured successfully image

545

gcampbell-msft commented 2 months ago

@Remiliap I just attempted to download your git repository and repro the problem, and I was able to reproduce. I am doing a small investigation now.

gcampbell-msft commented 2 months ago

@Remiliap I think I have determined that the issue is because the compile command is split up into two lines due to it's length, and the make.exe invocation is outputting into different callbacks to stdout: https://github.com/microsoft/vscode-makefile-tools/blob/main/src/make.ts#L725.

I'm not sure what the best way to fix this is, so it might take some time for a fix to be inserted, but I'll brainstorm and investigate. 👍