NOIRLAB: several patches for libos.a #346
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a number of patches that fix several glitches in
libos.a
:a6459af - increased 'fname' buffer size to avoid overflow
48b2f61 - fixed fcancel() macro for OSX997ff1c - deprecated use of rcmd() on OSX systems
28a9b9e - ensure null termination following strncpy(), gcc 8 -Wstringop-truncation err
1dfb2a7 - ensure null termination following strncpy(), gcc 8 -Wstringop-truncation err
ab2ec08 - ensure null termination following strncpy(), gcc 8 -Wstringop-truncation erra55a788 - fix sign compare
0e72cfc - fix clobber warning from linux64
d8226de - fix compiler warnings from linux64
The commit ab2ec08 looks a bit weird:
The commit currently in the PR has
MACOSX
replaced with__APPLE__
(because we consequently use compiler provided flags instead of self-defined if possible). It is however unclear where the magic numbers 103 and 107 come from and why they differ for macOS. I will leave it out yet until we understand it (maybe @mjfitzpatrick may explain).The other suspicious commit is 48b2f61, which defines fcancel() as setvbuf() on macOS
iraf/unix/os/zxwhen.c
Lines 90 to 96 in 3761a03
First, setvbuf() is not macOS specific but part of the standard C library (and therefore also available for Linux). This is changed by the commit in this PR. Then, hard-coding
_IONBF
instead of using the proper include file (stdio.h
) is bad style, also adjusted here. And finally, setvbuf() is not what fcancel() is supposed to do, namely to cancel any buffered output. Instead, it just makes the output unbuffered. i.e. when applying this patch, stdout will become unbuffered for the rest of the session. Maybe @mjfitzpatrick can comment on that, otherwise I tend to remove this commit from the PR as well.Probably the better solution (although non-portable) is to use fpurge() on macOS (and BSD variants), and __fpurge() on Linux (and glibc variants, like HURD). This is implemented in #366.
Then there is 997ff1c, which basically disables network computing capabilities on macOS
iraf/unix/os/zfioks.c
Lines 2048 to 2057 in 997ff1c
I am not sure whether network computing capabilities are still needed on Linux; at least standard remove shells (rsh) are deprecated everywhere, not just on macOS. If not, we could think about removing the networking layer completely, significantly simplifying the code in
unix/os
. @mjfitzpatrick?