Created attachment 168240 [details] fix undefined behavior While building mc-4.8.16 under FreeBSD 9.x using system gcc 4.2.1, one obtains a warning: interface.c: In function 'mc_open': interface.c:203: warning: 'mode_t' is promoted to 'int' when passed through '...' interface.c:203: warning: (so you should pass 'int' not 'mode_t' to 'va_arg') interface.c:203: note: if this code is reached, the program will abort interface.c:203: warning: will never be executed gcc generates instruction "ud2a" for the code and mc crashes with SIGILL when it calls mc_open() function to create a file, e.g. while copying a file to another directory or saving a file in the mcedit. A patch is attached.
The problem and patch reported upstream: https://www.midnight-commander.org/ticket/3617
Comment on attachment 168240 [details] fix undefined behavior The patch associated with the upstream ticket 3617 has been updated. Rejecting this patch in favour of using the new one from upstream.
Created attachment 168339 [details] Patch from upstream ticket 3617 to fix SIGILL crash upon creating a file Note that this patch was generated by comparing the resulting mc-4.8.16.tar.xz files when following the mc release building guidelines, with a stock 4.8.16 release, and the 4.8.16 release with the patch applied from upstream ticket 3617 "3617-mc_open-handle-varargs-mode_t-promotion-issue--v2.patch". mc release building guidelines: https://www.midnight-commander.org/wiki/ReleaseGuidelines
Created attachment 168340 [details] Patch from upstream ticket 3617 to fix SIGILL crash upon creating a file Patch updated to bump PORTREVISION
Created attachment 168341 [details] QA: Successful poudriere testport logs for misc/mc 4.8.16 with patch on FreeBSD 10.2 amd64
If you patch mc 4.8.16 in the FreeBSD port then please also fix another new bug (syntax error) in 4.8.16 with the patch https://www.midnight-commander.org/attachment/ticket/3611/mc-3611-fish-fix-perl-ls-helper.patch
(In reply to Lena from comment #6) Hi Lena, thanks for your comment. I have raised a separate bug report for that issue here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208104
A commit references this bug: Author: feld Date: Fri Mar 18 12:04:33 UTC 2016 New revision: 411345 URL: https://svnweb.freebsd.org/changeset/ports/411345 Log: misc/mc: Multiple fixes - Fix subshell functionality for csh users - Make SFTP an option, enabled by default - Fix SIGILL on FreeBSD 9.x - Fix perl ls helper with fish shell PR: 207487, 208027, 208102, 208104 Changes: head/misc/mc/Makefile head/misc/mc/files/patch-upstreamticket2742-detect-csh-as-tcsh-by-name.patch head/misc/mc/files/patch-upstreamticket3611-fish-fix-perl-ls-helper.patch head/misc/mc/files/patch-upstreamticket3617-mc_open-handle-varargs-mode_t-promotion-issue--v2.patch
Committed, thanks!