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

fix: crash when backing up swap partition #148

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

justforlxz
Copy link
Contributor

args: -s /dev/nvme0n1p5 -o - -c -z 1048576 -L /var/log/partclone.log

/dev/nvme0n1p5 is the swap partition, I noticed that in the calculate_speed function of progress.c, percent = prog->unit * copied; percent is NaN, prog->unit is Inf, so the next judgment was not successfully modified percent, which caused the retained to be the wrong value, and the strftime function crashed.

args: -s /dev/nvme0n1p5 -o - -c -z 1048576 -L /var/log/partclone.log

/dev/nvme0n1p5 is the swap partition, I noticed that in the calculate_speed function of progress.c, percent = prog->unit * copied; percent is NaN, prog->unit is Inf, so the next judgment was not successfully modified percent, which caused the retained to be the wrong value, and the strftime function crashed.
@Thomas-Tsai Thomas-Tsai merged commit a6a8559 into Thomas-Tsai:master Jul 24, 2020
@Thomas-Tsai
Copy link
Owner

after this patch, some of case the progress not work like before. In one of my test, the value of complete always is 1 (one), before finish. I will try to change and reproduce your crash but not work. Do you have any other suggestion?

@justforlxz
Copy link
Contributor Author

after this patch, some of case the progress not work like before. In one of my test, the value of complete always is 1 (one), before finish. I will try to change and reproduce your crash but not work. Do you have any other suggestion?

I guess this has something to do with the compiler. On processors of different architectures, only x86 crashes. I traced through gdb and found that there was a problem with floating-point calculations.
But this problem does not always appear, even if it is the same binary file, it still behaves differently on different x86 devices. My colleagues and I have no further ideas.

@Thomas-Tsai
Copy link
Owner

ok, thank you. We just add isnormal function which is from math.h to avoid float INF and NAN. Now it work well like before, I just can't make sure is also workable for your case? We release 3.17 to fix the progress issue, please give a try anytime, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants