id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3747	extfs: hp48: fix float truncation	mooffie	zaytsev	"[This is forked from #3729.]

The hp48 helper uses the following code to convert floats (of which filesizes are) to integers:

{{{
hp48_retsize()
{
    printf ""%d"" ""$2"" 2>/dev/null
}
# Note: The number is in $2, not in $1.
}}}

(This results in truncation, not rounding.)

While this trick is acceptable according to ~~the~~ a [http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html standard] (""If an argument operand cannot be completely converted [...] the utility shall [...] write the value accumulated at the time the error was detected to standard output""), it seems that some shells don't support it. @Andrew gives [http://www.midnight-commander.org/ticket/3729#comment:13 as example a certain version of Bash].

So we'd better change that code. One possibility:

{{{
hp48_retsize()
{
    echo ${2%.*}
}
}}}

(We shouldn't do ""printf %.0f NUMBER"" as this would round the number, not truncate it. Not that rounding is a sin, but we should better stick to the current behavior.)
"	defect	closed	major	4.8.19	mc-vfs	master	fixed					merged	committed-master
