Bug 177111 - Bug when copying/move file to deleted directory
Summary: Bug when copying/move file to deleted directory
Alias: None
Product: Fedora
Classification: Fedora
Component: mc
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jindrich Novy
QA Contact:
URL: http://mail.gnome.org/archives/mc-dev...
Depends On:
TreeView+ depends on / blocked
Reported: 2006-01-06 13:13 UTC by Marcin Garski
Modified: 2013-07-02 23:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-03-16 12:05:24 UTC
Type: ---

Attachments (Terms of Use)
Patch to fix your problem. (487 bytes, patch)
2006-01-12 12:11 UTC, Jindrich Novy
no flags Details | Diff

Description Marcin Garski 2006-01-06 13:13:27 UTC
Hello Jindrich,

I send this bug report on mc-devel but as I see, no one has reply, so I have
decided to put it in RH bugzilla. Feel free to close it and wait for upstream
resolution :)

1. cd /tmp && mkdir dir && mkdir dir/subdir && touch dir/file.txt
2. cd dir && mc
3. press Alt+i and in right panel cd into subdir
4. on left you should be in /tmp/dir on right in /tmp/dir/subdir
5. open second MC in new console, delete /tmp/dir/subdir
6. go back to first MC, in left panel selcet file.txt and copy or move it to
directory in right panel (/tmp/dir/subdir) that don't exist
7. see what will happen (filename of file.txt will be changed to subdir)

MC should report that /tmp/dir/subdir don't exist and it's immposible to
copy/move file to it.

Comment 1 Jindrich Novy 2006-01-06 20:41:28 UTC
Hello Marcin,

I successfully reproduced it after I saw your post on mc's upstream. I'll look
more into it after the weekend. The more bugzillas you file, the more likely
someone will look at it ;) Thanks for the heads-up, I almost forgot about it.

Comment 2 Jindrich Novy 2006-01-12 12:11:23 UTC
Created attachment 123109 [details]
Patch to fix your problem.

This is caused by the fact, that mc won't refresh contents of panels when a
delete/move/copy command is requested. This causes in your particular case that
the source file is /tmp/dir/file.txt and the default destination is
/tmp/dir/subdir. Since /tmp/dir/subdir directory no more exists, mc thinks you
want to move/copy the file.txt to a file named subdir.

Note that a more suitable fix would be to present /tmp/dir/subdir/ as a
destination in case it's directory, otherwise it's indisqushable for mc from a

Comment 3 Marcin Garski 2006-01-13 13:01:46 UTC
This patch fix my problem. As you note it's not a perfect solution (but it's
better then currently mc state), because user may not notice that after pressing
F5 or F6 directory has changed. Maybe mc before delete/move/copy command should
check if the directory exist if not then display warning message?

I didn't have installed slang-devel and during configure:
checking slang.h usability... no
checking slang.h presence... no
checking for slang.h... no
checking slang/slang.h usability... no
checking slang/slang.h presence... no
checking for slang/slang.h... no
configure: error: S-Lang library not found
so it would be good to add slang-devel to BuildRequires.

Comment 4 Jindrich Novy 2006-01-13 14:29:05 UTC
It does. MC checks whether the directory to which is something copied exists,
but in this case MC has no clue to figure out whether /tmp/dir/subdir was a
directory or a file. This is the reason I vote for /tmp/dir/subdir/ to be sure
it'll be considered a directory even if it doesn't exist.

The both panels contain a directory without the slash and the information for
target in copy/move dialog is taken from the panels. So stuff need to be fixed
there instead. I'll have a look at it when I have some time.

Regarding the slang problem, the FC3/FC4 versions don't contain slang-devel
dependency since they're compiled with internal mcslang support. devel MC is
linked against external slang, and there's slang-devel dependency so I don't
understand how did you happen to see this.

What mc version do you compile?

Comment 5 Marcin Garski 2006-01-13 14:47:41 UTC
Thanks for answer about directories.

I've downloaded this source rpm:
and only added patch, bump release number and done rpmbuilb -ba mc.spec

Comment 6 Jindrich Novy 2006-01-13 16:13:57 UTC
Yes, I reproduced it. I changed in CVS a while ago, but fotgot that I haven't
released any updates. Now I'm waiting to gather more fixes to ship them with
upcoming updates all at once.

Note You need to log in before you can comment on or make changes to this bug.