Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use off_t for free space calculation (free space on filesystems >2TB not properly displayed) #2338

Closed
mc-butler opened this issue Sep 1, 2010 · 34 comments
Assignees
Labels
area: core Issues not related to a specific subsystem prio: medium Has the potential to affect progress ver: 4.8.0 Reproducible in version 4.8.0
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/2338
Reporter swegener (sven.wegener@….net)
Mentions mc.trac@….org

The free space calculation currently uses ints, which are just 32bit on plain x86 systems and result in free space on filesystems >2TB not being properly displayed. See attached patch.

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by swegener (sven.wegener@….net) on Sep 1, 2010 at 9:33 UTC

This is needed to show correct free space information for todays large filesystems on 32bit systems.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 1, 2010 at 9:56 UTC (comment 1)

Thanks!

Do we really have use signed off_t instead of unsigned uintmax_t?

Generally, we have 3 different types for FS description: my_statfs (mountlist.h:26), fs_usage (fsusage.h:36) and again fs_usage (mountlist.c:139). I think all that structures should be merged into single one.

@mc-butler
Copy link
Author

Changed by swegener (sven.wegener@….net) on Sep 3, 2010 at 10:23 UTC (comment 1.2)

Replying to andrew_b:

Do we really have use signed off_t instead of unsigned uintmax_t?

I've taken off_t, because when showing these values in src/info.c, we pass them through size_trunc_len(), which takes an off_t. In the end any integer that is 64bit on 32bit systems is fine, but we should be consistent.

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 8, 2011 at 19:13 UTC (comment 3)

  • Branch state set to no branch
  • Version changed from 4.7.3 to 4.7.5.3
  • Cc set to mc.trac@….org

since i run into this bug daily, i was wondering if there has been any progress on the issue?

in the current version(4.7.5.3) i see this, when browsing my 6TB RAID 5:

mc: 793G/1493G (53%)
os: 700G/5.5T 13%

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 8, 2011 at 19:17 UTC (comment 4)

  • Summary changed from Use off_t for free space calculation to Use off_t for free space calculation (free space on filesystems >2TB not properly displayed)
  • Milestone changed from 4.7 to 4.8

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 10, 2011 at 16:16 UTC (comment 5)

  • Owner set to andrew_b
  • Status changed from new to accepted
  • Branch state changed from no branch to on review

Branch: 2338_free_space_calculation (parent: master).
[8846ecde8be2c656bab23c24cbbf822b7a352b3e]
Please review.

@mc-butler
Copy link
Author

Changed by slavazanko (@slavaz) on Sep 10, 2011 at 18:02 UTC (comment 6)

  • Votes set to slavazanko

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 11, 2011 at 0:03 UTC (comment 7)

because i'm unable to build the git-tree(some stuff missing on osx apparently, as autogen.sh fails), i applied the patch from git to 4.7.5.3. patch worked, however now i'm seeing:

mc: 2024G/1493G (135%) on my 5.5tb disc.
os: 1517G/4072G 28%

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 11, 2011 at 6:19 UTC (comment 7.8)

Replying to mak:

mc: 2024G/1493G (135%) on my 5.5tb disc.
os: 1517G/4072G 28%

Would you show exact that values in bytes?

@mc-butler
Copy link
Author

Changed by slavazanko (@slavaz) on Sep 12, 2011 at 9:03 UTC (comment 9)

  • Votes slavazanko deleted
  • Branch state changed from on review to on rework

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 13, 2011 at 0:09 UTC (comment 10)

  • mc

Free space: 1982G/1493G (132%)

  • disk utility

Capacity : 6 TB (6,000,699,228,160 Bytes)
Free Space : 4.33 TB (4,327,139,147,776 Bytes)
Used : 1.67 TB (1,673,560,080,384 Bytes)

  • df (1k blocks)

5860057840 1634336016 4225721824 28%

…hope this helps.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 13, 2011 at 7:17 UTC (comment 11)

Thanks! Would you attach your config.h here?

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 14, 2011 at 15:02 UTC

config.h while builing with brew

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 14, 2011 at 17:27 UTC (comment 12)

Hmm, the _FILE_OFFSET_BITS macro is not defined in your config.h. It should be

#define _FILE_OFFSET_BITS 64

which is provided by AC_SYS_LARGEFILE macro. If you run configure without --disable-largefile option, _FILE_OFFSET_BITS should be defined.

BTW, what system do you use?

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 15, 2011 at 2:56 UTC (comment 13)

hmm. looks like another perk of running os x(10.6.8 and 10.7.1).

getting this while building with --enable-largefile

checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no

@mc-butler
Copy link
Author

Changed by zap (anpaza@….ru) on Sep 25, 2011 at 8:13 UTC (comment 14)

I also hit the same problem on a x86_64 FreeBSD system, mc 4.7.5.4.

df output:

Filesystem 1K-blocks        Used      Avail Capacity  Mounted on
/dev/da0   7802994930 1643615732 6159379198    21%    /

Midnight shows: 1778G/16Z

Applied the above git patch and recompiled.

Now Midnight shows: 5874G/7442G

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 27, 2011 at 6:43 UTC (comment 15)

Please test 2338_free_space_calculation branch. If you cannot get this branch from our repo, you can get the following snapshot: http://repo.or.cz/w/midnight-commander.git/snapshot/947be78a1b4070a35461b23ffc7c8bad32740afb.tar.gz

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 28, 2011 at 10:55 UTC (comment 16)

sadly i'm not able to build the snapshot.
this, however has nothing to do with the code, it's simply impossible to run autogen.sh successfully. lets call it another limitation of osx.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 28, 2011 at 12:08 UTC (comment 16.17)

Replying to mak:

it's simply impossible to run autogen.sh successfully.

I've created tarball for you.

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 28, 2011 at 17:18 UTC (comment 18)

thx for the tarball.

when building i get this error:

make[5]: * No rule to make target changesetfs', needed by all-am'. Stop.
make[4]:
* [all-recursive] Error 1
make[3]: * [all-recursive] Error 1
make[2]:
* [all-recursive] Error 1
make[1]: * [all-recursive] Error 1
make:
* [all] Error 2

i also attached the config.h file.

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 28, 2011 at 17:20 UTC

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 28, 2011 at 17:36 UTC (comment 19)

Ah, sorry. This bug was fixed in master after created branch. I think, build with --disable-vfs-extfs option as a quick workaround can help you.
I've created another tarball. Please test it.

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 28, 2011 at 18:08 UTC (comment 20)

build worked, but after starting it crashed instantly:

mc(61865,0x7fff70040cc0) malloc: * error for object 0x10201d048: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Abort trap

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 28, 2011 at 18:16 UTC (comment 20.21)

Replying to mak:

build worked, but after starting it crashed instantly:

mc(61865,0x7fff70040cc0) malloc: * error for object 0x10201d048: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Abort trap

Would you get a backtrace using following instructions?

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 28, 2011 at 18:52 UTC (comment 22)

del

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 29, 2011 at 4:25 UTC (comment 22.23)

There is no debug info here. If you use gcc, run

make CFLAGS='-g -ggdb3'

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 29, 2011 at 6:26 UTC (comment 24)

sorry 'bout that:

bt

#0  0x00007fff8044b0b6 in __kill ()
#1  0x00007fff804eb9f6 in abort ()
#2  0x00007fff80403195 in free ()
#3  0x0000000100093cf7 in free_mount_entry (me=0x101301490) at mountlist.c:295
#4  0x00000001000940c7 in free_my_statfs () at mountlist.c:1387
#5  0x00000001000940f4 in init_my_statfs () at mountlist.c:1400
#6  0x0000000100086694 in show_free_space (panel=0x10180f200) at panel.c:1032
#7  0x0000000100086ce1 in show_dir (panel=0x10180f200) at panel.c:1123
#8  0x00000001000872d9 in paint_frame (panel=0x10180f200) at panel.c:1306
#9  0x000000010008aa7f in panel_callback (w=0x10180f200, msg=WIDGET_DRAW, parm=0) at panel.c:3003
#10 0x0000000100046e39 in send_message (w=0x10180f200, msg=WIDGET_DRAW, parm=0) at widget-common.h:132
#11 0x0000000100046e07 in dlg_broadcast_msg_to (h=0x101301190, msg=WIDGET_DRAW, reverse=1, flags=0) at dialog.c:145
#12 0x0000000100048316 in dlg_broadcast_msg (h=0x101301190, msg=WIDGET_DRAW, reverse=1) at dialog.c:901
#13 0x0000000100048717 in dlg_redraw (h=0x101301190) at dialog.c:1060
#14 0x00000001000487f1 in init_dlg (h=0x101301190) at dialog.c:1097
#15 0x0000000100048942 in run_dlg (h=0x101301190) at dialog.c:1154
#16 0x00000001000806c6 in create_panels_and_run_mc () at midnight.c:897
#17 0x0000000100081f0a in do_nc () at midnight.c:1649
#18 0x0000000100007aa1 in main (argc=1, argv=0x7fff5fbfeb38) at main.c:510

bt full

#0  0x00007fff8044b0b6 in __kill ()
No symbol table info available.
#1  0x00007fff804eb9f6 in abort ()
No symbol table info available.
#2  0x00007fff80403195 in free ()
No symbol table info available.
#3  0x0000000100093cf7 in free_mount_entry (me=0x101301490) at mountlist.c:295
No locals.
#4  0x00000001000940c7 in free_my_statfs () at mountlist.c:1387
	next = (struct mount_entry *) 0x1013014c0
#5  0x00000001000940f4 in init_my_statfs () at mountlist.c:1400
No locals.
#6  0x0000000100086694 in show_free_space (panel=0x10180f200) at panel.c:1032
	rpath = "??_?\000\000\000?30\001\001\000\000\000\000TR\000\001\000\000\000\000\020R\000\001\000\000\000\b", '\0' <repeats 15 times>, "`?_?\000\000 \r@??\000\000??_?\000\000??\003\000\001\000\000\000????\000\000\000\000?\000\000\000\000\000\000\000\001\000\000\000\b\000\000\000\001\000\000\000\001\000\000\000\001\000\000\000\000\000\000\000??\003\000 \000\001\000P?_?\000\000m?\003\000\001\000\000\000\001\000\000\000?\000\000\000?", '\0' <repeats 16 times>, "\020R\000\001\000\000\000?E\003p?\000\000\000\000\000\000\000\000\000\000??_?\000\000?\t@??\000\000??"...
	vpath = (vfs_path_t *) 0x101303090
	myfs_stats = {
  type = -1, 
  typename = 0x101819d38 "hfs", 
  mpoint = 0x1013013b0 "/Volumes/data", 
  device = 0x1013013a0 "/dev/disk1s2", 
  avail = 98268964, 
  total = 732238672, 
  nfree = 24567241, 
  nodes = 183059666
}
	old_cwd = 0x101301620 "/Users/mak/_get"
#7  0x0000000100086ce1 in show_dir (panel=0x10180f200) at panel.c:1123
	tmp = (gchar *) 0x101303340 "\n"
#8  0x00000001000872d9 in paint_frame (panel=0x10180f200) at panel.c:1306
	side = 0
	width = 0
	format_txt = (GString *) 0x1a00621b00
#9  0x000000010008aa7f in panel_callback (w=0x10180f200, msg=WIDGET_DRAW, parm=0) at panel.c:3003
	panel = (WPanel *) 0x10180f200
	bb = (WButtonBar *) 0x101301190
#10 0x0000000100046e39 in send_message (w=0x10180f200, msg=WIDGET_DRAW, parm=0) at widget-common.h:132
No locals.
#11 0x0000000100046e07 in dlg_broadcast_msg_to (h=0x101301190, msg=WIDGET_DRAW, reverse=1, flags=0) at dialog.c:145
	w = (Widget *) 0x10180f200
	p = (GList *) 0x10061f2e0
	first = (GList *) 0x1006212a0
#12 0x0000000100048316 in dlg_broadcast_msg (h=0x101301190, msg=WIDGET_DRAW, reverse=1) at dialog.c:901
No locals.
#13 0x0000000100048717 in dlg_redraw (h=0x101301190) at dialog.c:1060
No locals.
#14 0x00000001000487f1 in init_dlg (h=0x101301190) at dialog.c:1097
No locals.
#15 0x0000000100048942 in run_dlg (h=0x101301190) at dialog.c:1154
No locals.
#16 0x00000001000806c6 in create_panels_and_run_mc () at midnight.c:897
No locals.
#17 0x0000000100081f0a in do_nc () at midnight.c:1649
	midnight_colors = {9, 9, 9, 9, 9}
#18 0x0000000100007aa1 in main (argc=1, argv=0x7fff5fbfeb38) at main.c:510
	error = (GError *) 0x0
	isInitialized = 1

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 29, 2011 at 6:45 UTC (comment 24.25)

Thanks! Please test this tarball.

@mc-butler
Copy link
Author

Changed by mak (mc.trac@….org) on Sep 29, 2011 at 18:15 UTC (comment 26)

thx again.

build worked and i'm seeing the correct values in the bottom bar.

mc:
521G/5589G (9%)

os:
521G/5589G 91%

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 19, 2011 at 17:56 UTC (comment 27)

  • Branch state changed from on rework to on review
  • Milestone changed from 4.8 to 4.8.1
  • Version changed from 4.7.5.3 to 4.8.0

Initial changeset: [b9f03c63d80445c4b74dd0c52c2a9a07ee547f36]

@mc-butler
Copy link
Author

Changed by slavazanko (@slavaz) on Oct 20, 2011 at 14:21 UTC (comment 28)

  • Votes set to slavazanko

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Oct 26, 2011 at 12:13 UTC (comment 29)

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

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 28, 2011 at 7:35 UTC (comment 30)

  • Votes changed from slavazanko angel_il to committed-master
  • Status changed from accepted to testing
  • Branch state changed from approved to merged
  • Resolution set to fixed

Merged to master.
[d7ed661]

git log --pretty=oneline bbbb918..d7ed661

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 28, 2011 at 7:35 UTC (comment 31)

  • Status changed from testing to closed

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 ver: 4.8.0 Reproducible in version 4.8.0
Development

No branches or pull requests

2 participants