WinMerge / winmerge

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
https://winmerge.org/
GNU General Public License v2.0
6.47k stars 801 forks source link

ExitCode always 2 with /enableexitcode with no apparent issues #2450

Open SESEric opened 3 weeks ago

SESEric commented 3 weeks ago

Ever since I upgraded to V2.16.42.1 i've been facing some issue with the program returning error 2 wheneever i comparer two big folders.

They seem like the program complete without any issues, and the log says that there are no differences.

I was wondering what could be wrong, is there a log that actually list what is the error ecountered?

Thank you!

SESEric commented 3 weeks ago

I have just downloaded 2.16.40 and i can confirm that the same folder and call to winmerge returns 0 (as expected) as opposed to 2

sdottaka commented 3 weeks ago

In my environment, I was not able to reproduce the issue where the exit code is always 2 in the latest version.

Exit code 2 indicates that an error occurred while comparing folders.

Such an error occurs when another application has a file in the folder open exclusively and WinMerge cannot compare the file.

Or, if you run WinMerge from a command prompt or batch file, the exitcode may remain at its previous value if you refer to it without waiting for WinMerge to finish.

To wait for WinMerge to finish from a command prompt or batch file, use start /wait as follows:

start /wait "" "c:\Program Files\WinMerge\WinMergeU.exe" d:\dev\winmerge\src e:\dev\winmerge\src /noninteractive /enableexitcode
echo %errorlevel%
SESEric commented 3 weeks ago

Hi, thank you for the reply.

I am already waiting for the comparison to complete with a call similar to what you proposed.

This issue doesn’t happen always, on simplifier folders it works fine.

In my case I’m comparing bigger folder that contains binaries, exe and other type of files.

Also im outputting the result to a file and at the end the comparison log says that all files are the same.

Again if I rollback to the previous version the comparison works and the error code return is 0 like I would expect.

It is really hard to understand what could be the cause since there is no error message nor error log.

At this stage I’ll rollback to the previous version which is behaving fine.

Le 25 sept. 2024 à 6:50 p.m., Takashi Sawanaka @.***> a écrit :



In my environment, I was not able to reproduce the issue where the exit code is always 2 in the latest version.

Exit code 2 indicates that an error occurred while comparing folders.

Such an error occurs when another application has a file in the folder open exclusively and WinMerge cannot compare the file.

Or, if you run WinMerge from a command prompt or batch file, the exitcode may remain at its previous value if you refer to it without waiting for WinMerge to finish.

To wait for WinMerge to finish from a command prompt or batch file, use start /wait as follows:

start /wait "" "c:\Program Files\WinMerge\WinMergeU.exe" d:\dev\winmerge\src e:\dev\winmerge\src /noninteractive /enableexitcode echo %errorlevel%

— Reply to this email directly, view it on GitHubhttps://github.com/WinMerge/winmerge/issues/2450#issuecomment-2375407480, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFTMROHB6HRXULCGWFXTPVDZYM427AVCNFSM6AAAAABO3IOIEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVGQYDONBYGA. You are receiving this because you authored the thread.Message ID: @.***>

sdottaka commented 3 weeks ago

Ah, I was able to confirm that exitcode returns 2 when folder comparison takes a long time. I'll take a look at it later.

sdottaka commented 3 weeks ago

I found that the exit status is 2 if the "Include unique subfolder contents" option in the Compare/Folder category of the Options window is turned off and one of the subfolders in the compared folders does not exist.

What about the above settings?

This issue was fixed in this commit https://github.com/WinMerge/winmerge/commit/1646333b0b38cdc3f6ef666d15d76b4fe8c48837.