Skip to content

[BUGFIX] Prevent fatal error due to uparsed lines when makemkvcon rips successfully (#1688)#1699

Merged
microtechno9000 merged 1 commit intoautomatic-ripping-machine:mainfrom
joelishness:patch-2
Mar 12, 2026
Merged

[BUGFIX] Prevent fatal error due to uparsed lines when makemkvcon rips successfully (#1688)#1699
microtechno9000 merged 1 commit intoautomatic-ripping-machine:mainfrom
joelishness:patch-2

Conversation

@joelishness
Copy link
Copy Markdown
Contributor

[BUGFIX] Prevent fatal error due to uparsed lines when makemkvcon rips successfully (#1688)

Description

Check for buffer content only if the process returns an error.
Created Pull Request for suggestion by @swolfe2

Fixes #1688 BUG: Parser Fragility causes Fatal Error on successful rips (makemkv.py)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  1. Ripped a disc that would generate MakeMKV errors, result was ARM fatal error.
  2. Applied the proposed patch change.
  3. Ripped the same disc that would generate MakeMKV errors, result was successful rip and transcode.
  • Docker
  • Other (Please state here)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have tested that my fix is effective or that my feature works

Changelog:

  • Check for buffer content only if the MakeMKV process returns an error.

Logs

Error case demonstrating the issue that with MakeMKV debug logging, MakeMKV rip was successful (exit 0) yet ARM throws fatal error.
ARM and MakeMKV debug logs attached:
logs-Alien3-ng.zip

No error case demonstrating that without MakeMKV debug logging, MakeMKV rip was successful (exit 0) and ARM finished successfully.
ARM and MakeMKV debug logs attached:
logs-Alien3-ok-no-debug.zip

No error case demonstrating patch effectiveness with MakeMKV debug logging, MakeMKV rip was successful (exit 0) and ARM finished successfully.
logs-Alien3-ok-debug.zip

…s successfully (automatic-ripping-machine#1688)

Check for buffer content only if the process returns an error.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 9, 2026

@swolfe2
Copy link
Copy Markdown

swolfe2 commented Feb 9, 2026

Great job on the pr, @joelishness!

Copy link
Copy Markdown
Collaborator

@microtechno9000 microtechno9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, and simple

@microtechno9000 microtechno9000 merged commit f7f1515 into automatic-ripping-machine:main Mar 12, 2026
12 of 13 checks passed
@ukos-git
Copy link
Copy Markdown
Contributor

Not so sure if this is such a nice fix. The way I read it, The line now is effektivly the same as "if False" since it will never get triggered.

@microtechno9000
Copy link
Copy Markdown
Collaborator

Not so sure if this is such a nice fix. The way I read it, The line now is effektivly the same as "if False" since it will never get triggered.

Can you clarify, not sure I follow

@ukos-git
Copy link
Copy Markdown
Contributor

ukos-git commented Mar 13, 2026

We raise if proc.returncode is true (an error)in the line above already.
So the next line checking for unparsed lines and proc.returncode will never see a failed returncode.

The proper fix would be to move the line which outputs the logger warning for unparsed lines before the initial raise and remove the raise from the conditional branch. That way, the logger warning would still be visible indicating that the parser needs adjustments.

@@ -1191,7 +1191,7 @@ def run(options, select):
yield data
if proc.returncode:
Copy link
Copy Markdown
Contributor

@ukos-git ukos-git Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prevents failed processes from getting any further than here.

if proc.returncode:
raise MakeMkvRuntimeError(proc.returncode, cmd, output=os.linesep.join(buffer))
if buffer:
if buffer and proc.returncode:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we will never see it here.

if buffer:
if buffer and proc.returncode:
logging.warning(f"Cannot parse {len(buffer)} lines: {os.linesep.join(buffer)}")
raise MakeMkvRuntimeError(proc.returncode, cmd, output=os.linesep.join(buffer))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix would be to just remove the raise.

Copy link
Copy Markdown
Contributor

@ukos-git ukos-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to submit the comments.

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

Successfully merging this pull request may close these issues.

🐛 BUG: Parser Fragility causes Fatal Error on successful rips (makemkv.py)

4 participants