Ticket #3000 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

Copy/move dialog report invalid file size when file already exist.

Reported by: gv Owned by: andrew_b
Priority: major Milestone: 4.8.9
Component: mc-core Version: 4.8.8
Keywords: Cc: gabriel@…, onlyjob@…
Blocked By: Blocking:
Branch state: merged Votes for changeset: slavazanko angel_il

Description

# mkdir src
# mkdir dst
# cp test.txt src/test.txt
# cp test.txt dst/test.txt
# ls -l src/test.txt dst/test.txt
-rw-r--r--. 1 gabriel gabriel 1093 Apr 8 19:13 dst/test.txt
-rw-r--r--. 1 gabriel gabriel 1093 Apr 8 19:13 src/test.txt
# mc
left panel : src
right panel: dst
Try to copy/move test.txt from src over test.txt in dst

[File exists]
[Target file already exists!"]
[~/dst/test.txt]
[New : Apr 8 19:13, size 1093K]
[Existing: Apr 8 19:13, size 1093K]

File size is 1093 bytes not 1093 kbytes.

If file is 3716886 bytes copy/rename dialog report 3716886M.
If file is 1194181320 bytes copy/rename dialog report 1194181320G.

Attachments

mc-overwrite_query_dialog-units.patch (985 bytes) - added by gv 11 years ago.
Patch

Change History

Changed 11 years ago by gv

Patch

comment:1 Changed 11 years ago by andrew_b

I can't agree with this patch. If you get the "Target file already exists!" error for huge file (many GBs), the size in bytes can exceed the bounds of dialog area.

comment:2 Changed 11 years ago by gv

It would be nice when you overwrite a file (even if it is very large) to see the size in bytes.

Anyway, patch does not work well when panels_options.kilobyte_si is on.

comment:3 Changed 11 years ago by gv

Sorry, It does work.
Anyway, it's up to you to find a better solution. It's fine for me and I'm going to use-it.

comment:4 Changed 11 years ago by gv

# xterm -fn 10x20

┌───────────────────── File exists ──────────────────────┐
│ Target file already exists! │
│ /saves/gabriel/Fedora-18-x86_64-DVD.iso │
├────────────────────────────────────────────────────────┤
│ New : Jan 9 23:01, size 4573888512 │
│ Existing: Jan 9 23:01, size 4573888512 │

# xterm -fn 7x14

│ New : Jan 9 23:01, size 4573888512G │
│ Existing: Jan 9 23:01, size 4573888512G │

Same amount of space in standard linux console terminal.

So, from my point of view, there is plenty of space. Even for very large files.
But again, it's up to you.

comment:5 Changed 11 years ago by gv

# echo -n "4573888512 " | wc -c
25

(25 even in standard linux text console)
maximum value of uintmax_t: 18447644073710439615 (util.c line 444)

# echo -n 18447644073710439615 | wc -c
20

So how exactly "the size in bytes can exceed the bounds of dialog area"?
:-)

comment:6 Changed 11 years ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted
  • Component changed from adm to mc-core
  • Branch state changed from no branch to on review
  • Milestone set to 4.8.9

Ok, I reverted wrong modification of size_trunc_len() and restored previous size format.

Branch: 3000_incorrect_filesize
Initial changeset:4d140433700806203c8a9a6478af47f4f42424c8

comment:7 Changed 11 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:8 Changed 11 years ago by onlyjob

  • Cc onlyjob@… added

comment:9 Changed 11 years ago by onlyjob

Changeset is good -- it works as expected.

IMHO for comparison it is important that dialog shows size of files exactly in bytes.
No further "optimisation" (to add K/M/G) is necessary.

Thanks.

comment:10 Changed 11 years ago by angel_il

  • Votes for changeset changed from slavazanko to slavazanko angel_il
  • Branch state changed from on review to approved

comment:11 Changed 11 years ago by andrew_b

  • Status changed from accepted to testing
  • Priority changed from minor to major
  • Resolution set to fixed
  • Branch state changed from approved to merged

Merged to master: [61d230e494098e311a02aa3df7d7846817ddde60].

git log --pretty=oneline 6b64835..61d230e
Last edited 11 years ago by andrew_b (previous) (diff)

comment:12 Changed 11 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.