Skip to content

Ticket #4631: copy_file_file() - fixed "Ignore All" freezing on read errors - #5170

Open
tuffnatty wants to merge 3 commits into
MidnightCommander:masterfrom
tuffnatty:fix-4631
Open

tuffnatty wants to merge 3 commits into
MidnightCommander:masterfrom
tuffnatty:fix-4631

Conversation

@tuffnatty

@tuffnatty tuffnatty commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

On a read error that is encountered after Ignore All has been selected, don't loop forever but skip the rest of the file.

Checklist

  • I have referenced the issue(s) resolved by this PR (if any)
  • I have signed-off my contribution with git commit --amend -s
  • Lint and unit tests pass locally with my changes (make indent && make check)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@github-actions github-actions Bot added needs triage Needs triage by maintainers prio: medium Has the potential to affect progress labels Sep 28, 2026
@github-actions github-actions Bot added this to the Future Releases milestone Sep 28, 2026
@zyv zyv added area: core Issues not related to a specific subsystem and removed needs triage Needs triage by maintainers labels Sep 29, 2026
@zyv zyv changed the title copy_file_file(): Fixed Ignore All freezing on read errors (#4361) Ticket #4361: copy_file_file() - fixed "Ignore All" freezing on read errors Sep 30, 2026
@zyv zyv modified the milestones: Future Releases, 4.9.0 Sep 30, 2026
@zyv zyv changed the title Ticket #4361: copy_file_file() - fixed "Ignore All" freezing on read errors Ticket #4631: copy_file_file() - fixed "Ignore All" freezing on read errors Sep 30, 2026

@zyv zyv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for looking into it!

I have had it build & run tested by the agent, and it found one related issue with "Ignore All" (see comment & commit). Do you agree?

Also, note that the commit message references the wrong ticket, please correct that.

In addition to that, I've added a regression test.

Finally, the agent found a whole bunch of less closely related bugs in copy_file_file, including data loss. How about we make the following deal: I commit them as a patch series and make a follow-up PR after this one is merged, and you review it?

Comment thread src/filemanager/file.c
Comment on lines 2925 to 2934
if (dst_status == DEST_SHORT_QUERY)
{
// Query to remove short file
if (query_dialog (Q_ ("DialogTitle|Copy"), _ ("Incomplete file was retrieved"), D_ERROR, 2,
_ ("&Delete"), _ ("&Keep"))
== 0)
dst_status = DEST_SHORT_DELETE;
else
dst_status = DEST_SHORT_KEEP;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The hang is fixed, but every failing file still stops the job with "Ignore all" at the modal "Incomplete file was retrieved [Delete] [Keep]" query. This seems to be the same problem as described for "Skip". Could "Ignore all" answer it as well?

if (dst_status == DEST_SHORT_QUERY)
{

   if (ctx->ignore_all)
   {
       // "Ignore all" answers this question too, but never deletes pre-existing data
       dst_status = appending ? DEST_SHORT_KEEP : DEST_SHORT_DELETE;
   }
   else
   {
       // Query to remove short file
       if (query_dialog (Q_ ("DialogTitle|Copy"), _ ("Incomplete file was retrieved"), D_ERROR,
                         2, _ ("&Delete"), _ ("&Keep"))
           == 0)
           dst_status = DEST_SHORT_DELETE;
       else
           dst_status = DEST_SHORT_KEEP;
   }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it's a separate problem which should be solved by introduction of Delete All and Keep All buttons.

tuffnatty and others added 3 commits October 3, 2026 17:26
…errors

Add tests/src/filemanager/copy_file_file.c, which copies a real file
through the local VFS whose read callback is replaced to fail with EIO.
With ctx->ignore_all set, copy_file_file() must give up after a single
failed read and return FILE_IGNORE_ALL instead of retrying forever.
The fake read stops failing after 1000 calls, so a regression makes the
test fail (read_calls == 1001) rather than hang.

Mark query_dialog() as MC_MOCKABLE, like message() already is, so the
"Incomplete file was retrieved" prompt can be stubbed in tests.

Assisted-By: Claude Opus 5.5
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
After "Ignore all", every file that fails to read still stopped the
operation with the "Incomplete file was retrieved [Delete] [Keep]"
query. Use "Delete" (the default button) without asking, but keep the
target when appending, because it held data before this copy.

Assisted-By: Claude Opus 5.5
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
@tuffnatty

Copy link
Copy Markdown
Contributor Author

@zyv Thanks! I've fixed the commit message. As for the Delete/Keep questions, I believe it's a separate issue which should be resolved by adding Delete All/Keep All options, and this can be done in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues not related to a specific subsystem prio: medium Has the potential to affect progress

Development

Successfully merging this pull request may close these issues.

File transfer hangs upon "Skip all" on I/O errors

2 participants