"Delete tagged files if a copy exists in the other directory" doesn't work if names of the files or folders contains space

Bug #1094324 reported by Mantas Kriaučiūnas on 2012-12-28
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Midnight Commander
Fix Released
Unknown
mc (Baltix)
Medium
Mantas Kriaučiūnas
mc (Ubuntu)
Undecided
Yury V. Zaytsev

Bug Description

Midnight commander has nice feature - you can mark some file in one side and MC can compare these files with identically named files in other side and remove them if files are identical. This function can be started from the "User menu" (key F2) and is named"
"D Delete tagged files if a copy exists in the other directory"
But "Delete tagged files if a copy exists in the other directory" doesn't work if names of the files or folders contains space :(
Problem is in /etc/mc/mc.menu - I'm attaching a patch against mc.menu, which fixes this problem - I've tested with mc from Ubuntu 12.04 and newer :)

The attachment "Patch against mc.menu to fix "Delete tagged files if a copy exists in the other directory" when names of the files or folders contains space" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Yury V. Zaytsev (zyv) wrote :

Thanks for the report, I have created a new patch and a reported the bug upstream. Please try to go upstream in the future if possible, this tracker is not used by upstream developers and there are no dedicated mc package maintainers in Ubuntu.

Changed in mc (Ubuntu):
status: New → In Progress
assignee: nobody → Yury V. Zaytsev (zyv)
Changed in mc:
status: Unknown → New
Changed in mc:
status: New → Confirmed
Mantas Kriaučiūnas (mantas) wrote :

According to upstream changes at http://www.midnight-commander.org/ticket/2947 bug is fixed and will be included into mc version 4.8.8

comment:4 Changed 3 hours ago by andrew_b
    Status changed from accepted to testing
    Votes for changeset changed from andrew_b slavazanko to committed-master
    Resolution set to fixed
    Branch state changed from approved to merged
Merged to master: [be2883dc86d01fa54003ec75b0a1fc9ed93c9358].

comment:5 Changed 3 hours ago by andrew_b
    Status changed from testing to closed

Yury V. Zaytsev, could you confirm that "Delete tagged files if a copy exists in the other directory" will work in mc 4.8.8 even
 if names of the files or folders contains space?
And maybe you know if mc version 4.8.8 will be packaged in Debian and/or Ubuntu?

Yury V. Zaytsev (zyv) wrote :

Hi Mantas,

I pushed upstream a different patch from what you suggested, but I believe it should still work. Yes, I believe it will make it in 4.8.8. I don't know when it will get packaged, but I believe that it's not going to be backported to the currently shipping versions of Ubuntu.

--Yury.

Changed in mc:
status: Confirmed → Fix Released
Mantas Kriaučiūnas (mantas) wrote :

Hi Yury,

Yury V. Zaytsev (zyv) wrote on 2013-03-05:
> I pushed upstream a different patch from what you suggested, but I believe it should still work.

Your patch doesn't fix the problem - I'm attaching correct patch against mc.menu from mc 4.8.8 which fixes identical files deletion when folders and/or files names contains spaces.
Problem in your patch was quoted %D - see this line in your patch:
  if [ -f "%D/$i" ]; then
because of quoted %D deletion doesn't work: mc doesn't even find identical files - I get a message "FILENAME has no copy in /tmp/folder\ with\ space: NOT deleted." in terminal.
Deletion works correctly when %D isn't quoted, only $i is quoted:
  if [ -f %D/"$i" ]; then

I hope you understand why your patch doesn't work and you will forward my patch to mc upstream ;)

Yury V. Zaytsev (zyv) wrote :

Actually no, I don't understand it, but I will try to have a look.

Changed in mc (Baltix):
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Mantas Kriaučiūnas (mantas)
Changed in mc (Ubuntu):
status: In Progress → Confirmed
Mantas Kriaučiūnas (mantas) wrote :

Hi Yury,

It seems http://midnight-commander.org is dead or at least unreachable from my country (Lithuania) :(

Could you forward corrected patch mc.menu.folders-and-files-with-spaces-deletion-fix-4.8.8.patch from https://launchpad.net/mc/+bug/1094324 to mc upstream ?

Yury V. Zaytsev (zyv) wrote on 2013-04-05:
> I don't understand it, but I will try to have a look.

Yury V. Zaytsev (zyv) wrote :

Hi ,

Sadly, it's not accessible from anywhere at all, because our old server died. A new machine is now being installed to replace the old one.

Z.

Graham Inggs (ginggs) wrote :

Fix released in mc 3:4.8.11-1 in Trusty.

Changed in mc (Ubuntu):
status: Confirmed → Fix Released
Mantas Kriaučiūnas (mantas) wrote :

this mc problem isn't fixed - attached correct patch against mc.menu from mc 4.8.8 which fixes identical files deletion when folders and/or files names contains spaces, see comment #6

Problem in current mc is quoted %D - see this line in mc.menu:
  if [ -f "%D/$i" ]; then
because of quoted %D deletion doesn't work: mc doesn't even find identical files - I get a message "FILENAME has no copy in /tmp/folder\ with\ space: NOT deleted." in terminal.
Deletion works correctly when %D isn't quoted, only $i is quoted:
  if [ -f %D/"$i" ]; then

Changed in mc (Ubuntu):
status: Fix Released → Confirmed
Yury V. Zaytsev (zyv) wrote :

How about SUM2="`sum \"%D/$i\"`" ? Should %D remain quoted there? Anyways, I don't quite understand why %D shouldn't be quoted.

Mantas Kriaučiūnas (mantas) wrote :

Hi,

Yury V. Zaytsev (zyv) wrote on 2015-07-04: #12
> How about SUM2="`sum \"%D/$i\"`" ?
> Should %D remain quoted there?

No, %D shouldn't be quoted at all in mc.menu, see my patch, attached to the bugreport:

https://launchpadlibrarian.net/136265988/mc.menu.folders-and-files-with-spaces-deletion-fix-4.8.8.patch

Yury, please apply this patch to the upstream mc.menu - there are only 2 lines changed.

> Anyways, I don't quite understand why %D shouldn't be quoted.
I also don't understand why problem disappears only when %D *isn't* quoted and $i *is* quoted, but I successfully use patched mc.menu since 2010 ;)

Changed in mc:
status: Fix Released → New
Changed in mc:
status: New → Confirmed
Yury V. Zaytsev (zyv) wrote :

Hi Mantas,

I know it's hard to believe but we finally did it (again)! Could you please check the latest master to make sure we didn't screw it up again? If all is well, I would like to make a new release soon.

Many thanks!

Changed in mc:
status: Confirmed → Fix Released
Paul White (paulw2u) wrote :

Fixed in version 4.18.16
Ubuntu 18.04 has version 4.18.19 so closing.

Changed in mc (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.