Bug 1548537 - infinipath-psm: Partial injection of Fedora build flags
Summary: infinipath-psm: Partial injection of Fedora build flags
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: infinipath-psm
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Honggang LI
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: Fedora28BuildFlags
TreeView+ depends on / blocked
 
Reported: 2018-02-23 19:32 UTC by Florian Weimer
Modified: 2018-02-24 09:46 UTC (History)
2 users (show)

Fixed In Version: infinipath-psm-3.3-22_g4abbc60_open.6.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-24 02:15:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Florian Weimer 2018-02-23 19:32:05 UTC
LDFLAGS is not passed down to the build at all.

Using

%{set_build_flags}

instead of 

export CFLAGS="$RPM_OPT_FLAGS"

in the %build section of the RPM spec file should fix this.  This needs a recent version of redhat-rpm-config (at least 94), available in Fedora 28 and rawhide.

See https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md for information on RPM macros and environment variables provided by the build environment.

I can't verify the fix because the package fails to build due to an unrelated issue.

Comment 1 Honggang LI 2018-02-24 01:58:18 UTC
(In reply to Florian Weimer from comment #0)

> I can't verify the fix because the package fails to build due to an
> unrelated issue.

gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection   -Wall -Werror  -fpic -fPIC -D_GNU_SOURCE -funwind-tables   -O3 -g3  -DPSM_USE_SYS_UUID -Wno-strict-aliasing -DNVALGRIND -Wno-maybe-uninitialized -Wno-implicit-function-declaration   -Wall -Werror  -fpic -fPIC -D_GNU_SOURCE -funwind-tables   -O3 -g3  -DPSM_USE_SYS_UUID -Wno-strict-aliasing -DNVALGRIND -Wno-maybe-uninitialized -Wno-implicit-function-declaration -I. -I/builddir/build/BUILD/infinipath-psm-3.3-22_g4abbc60_open/include -I/builddir/build/BUILD/infinipath-psm-3.3-22_g4abbc60_open/mpspawn -I/builddir/build/BUILD/infinipath-psm-3.3-22_g4abbc60_open/include/linux-x86_64  -c psm_utils.c -o psm_utils.o
psm_utils.c: In function 'psmi_faultinj_getspec':
psm_utils.c:964:57: error: '%s' directive output may be truncated writing up to 127 bytes into a region of size between 110 and 237 [-Werror=format-truncation=]
  snprintf(fdesc, sizeof fdesc - 1, "Fault Injection %s <%s>",
                                                         ^~
       fname, fvals_str);
              ~~~~~~~~~                                   
In file included from /usr/include/stdio.h:862,
                 from /builddir/build/BUILD/infinipath-psm-3.3-22_g4abbc60_open/include/ipath_udebug.h:37,
                 from /builddir/build/BUILD/infinipath-psm-3.3-22_g4abbc60_open/include/ipath_user.h:63,
                 from psm_user.h:45,
                 from psm_utils.c:36:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 20 and 274 bytes into a destination of size 255
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:282: psm_utils.o] Error 1
make[1]: Leaving directory '/builddir/build/BUILD/infinipath-psm-3.3-22_g4abbc60_open'
make: *** [Makefile:155: libs] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.HoNINL (%build)


================================================================
It can be fixed with this dummy patch.

infinipath-psm (master)]$ cat extend-fdesc-array.patch 
--- psm_utils.c.org     2018-02-23 20:46:51.999361301 -0500
+++ psm_utils.c 2018-02-23 20:47:24.048331778 -0500
@@ -955,7 +955,7 @@ psmi_faultinj_getspec(char *spec_name, i
        union psmi_envvar_val env_fi;
        char fvals_str[128];
        char fname[128];
-       char fdesc[256];
+       char fdesc[512];
 
        snprintf(fvals_str, sizeof fvals_str - 1, "%d:%d:1", num, denom);
        fvals_str[sizeof fvals_str - 1] = '\0';

Comment 3 Florian Weimer 2018-02-24 09:46:26 UTC
Thanks.  Confirmed as fixed.  I took the liberty to pushed this to Fedora 28.


Note You need to log in before you can comment on or make changes to this bug.