Created attachment 231129 [details] fix SIGBUS This commit changed contrib/bc/configure from regular file to the symlink to configure.sh https://cgit.freebsd.org/src/commit/contrib/bc/configure?h=stable/12&id=e32b8140f4e7de93eb7d571e7fcb2bf9db6c97a3 gitup-0.96 crashes with SIGBUS trying to repair or update local repository copy when old (pre-commit) tree is present: 1) The function save_repairs() contains logic error calling calculate_file_hash() function to calculate hash of local file passing file mode of an object from the repository. The function calculate_file_hash() assumes that mode describes local file, calls readlink() for supposed symlink, but readlink() returns -1 with errno=EINVAL. This returned value ("uint32_t bytes_read" assigned with -1) is used in a statement: temp_path[bytes_read] = '\0'; SIGBUS is imminent. 2) With this bug fixed by passing real mode of local file to calculate_file_hash(), the function save_file() still does not handle the situation because it halts on any error on symlink creation including EEXIST. Instead, it should remove old file preventing symlink creation and retry. The patch solving the problem is attached.
Created attachment 231226 [details] fix SIGBUS Update the patch to add missing parenthesis.
Hello, Could you please open an issue at https://github.com/johnmehr/gitup about this change/fix and refer this PR so author can test and analise it? Thanks, Nuno Teixeira
Created attachment 231608 [details] fix SIGBUS Add parenthesis to correct logic error in previous patch.
(In reply to Nuno Teixeira from comment #2) I have some problems communicating with Github at the moment.
hello Eugene, I have openned an issue at githup: https://github.com/johnmehr/gitup/issues/79 Cheers
Hello Eugene, Your patch was applied to current source by Mehr. Closed #79 ( https://github.com/johnmehr/gitup/issues/79 ) Please test it fetching lateast source. I will close this PR for now. Thanks, Nuno Teixeira
Our port still has not a fix. Will you add the patch to the port until next gitup release? Or I can add it myself, if you wish.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=cc3322db8bfb8393736ec23624a36ccacb7e22b7 commit cc3322db8bfb8393736ec23624a36ccacb7e22b7 Author: Eugene Grosbein <eugen@FreeBSD.org> AuthorDate: 2022-04-29 02:12:22 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2022-04-29 02:12:22 +0000 net/gitup: fix SIGBUS Temporary add the patch fixing SIGBUS. The patch already accepted to upstream repo but next release delayed for long time. Many thanks to eduardo@ for submitting the patch upstream. PR: 261307 Approved by: eduardo (maintainer timeout, 1 month) net/gitup/Makefile | 1 + net/gitup/files/patch-gitup.c (new) | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)
(In reply to Eugene Grosbein from comment #7) Hello Eugene, Thank you for appying the patch, I was waiting for a new release that already includes it. Thank you, and sorry for my delay. Cheers, Nuno Teixeira