You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The UT assert framework is supposed to be portable, and this should adhere to strict C99.
However, in the goal of squelching a bogus CodeQL warning - some POSIX-specific logic got added in #827. This seemed to work (likely because it was never run on a non-POSIX OS) until it was changed to use a different POSIX API (fstat/fchmod) to address another bogus CodeQL warning.
Now, builds are failing because the APIs used are marked as POSIX-specific but we are not compiling this code with _POSIX_C_SOURCE (nor should we, because its supposed to be pure C99).
This is currently breaking the mainline build.
To Reproduce
Build UT assert - get the error:
/home/runner/work/CF/CF/osal/ut_assert/src/uttools.c: In function ‘UtMem2BinFile’:
/home/runner/work/CF/CF/osal/ut_assert/src/uttools.c:63:14: error: implicit declaration of function ‘fileno’; did you mean ‘fopen’? [-Werror=implicit-function-declaration]
fd = fileno(fp);
^~~~~~
fopen
/home/runner/work/CF/CF/osal/ut_assert/src/uttools.c:66:13: error: implicit declaration of function ‘fchmod’; did you mean ‘chmod’? [-Werror=implicit-function-declaration]
fchmod(fd, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH));
^~~~~~
chmod
This is directly from the validation workflow on a recent CF change.
System observed on:
Ubuntu (various)
Additional context
The CodeQL warnings about file permissions "not being set" are not really valid. UNIX still allows file permissions to be set by the user, in the form of the umask setting. So the permissions on a file created using pure C99 stdio calls (fopen) are not "unset" - they are just not set directly by the application, they are controlled externally.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
File permissions in general are a POSIX concept, but this tool should be
pure C99. It should not rely on any POSIX headers or POSIX-specific
API calls.
File permissions in general are a POSIX concept, but this tool should be
pure C99. It should not rely on any POSIX headers or POSIX-specific
API calls.
Describe the bug
The UT assert framework is supposed to be portable, and this should adhere to strict C99.
However, in the goal of squelching a bogus CodeQL warning - some POSIX-specific logic got added in #827. This seemed to work (likely because it was never run on a non-POSIX OS) until it was changed to use a different POSIX API (fstat/fchmod) to address another bogus CodeQL warning.
Now, builds are failing because the APIs used are marked as POSIX-specific but we are not compiling this code with
_POSIX_C_SOURCE
(nor should we, because its supposed to be pure C99).This is currently breaking the mainline build.
To Reproduce
Build UT assert - get the error:
This is directly from the validation workflow on a recent CF change.
System observed on:
Ubuntu (various)
Additional context
The CodeQL warnings about file permissions "not being set" are not really valid. UNIX still allows file permissions to be set by the user, in the form of the umask setting. So the permissions on a file created using pure C99 stdio calls (
fopen
) are not "unset" - they are just not set directly by the application, they are controlled externally.Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: