--- rpm-5.4.15/rpmio/macro.c~ 2014-12-07 20:24:53.000000000 +0100 +++ rpm-5.4.15/rpmio/macro.c 2014-12-07 20:44:45.739944044 +0100 @@ -2965,7 +2965,17 @@ se = rpmMCExpand(mc, s, NULL); rc = rpmGlob(se, &argc, &argv); for(i = 0; i < argc; i++) { - rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1); + /* Skip backups, non existing files and %config leftovers. */ +#define _suffix(_s, _x) \ + (strlen(_s) >= sizeof(_x) && !strcmp((_s)+strlen(_s)-(sizeof(_x)-1), (_x))) + if (!(_suffix(argv[i], "~") + || _suffix(argv[i], ".rpmnew") + || _suffix(argv[i], ".rpmorig") + || _suffix(argv[i], ".rpmsave")) + && !Access(argv[i], R_OK) + ) + rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1); +#undef _suffix argv[i] = _free(argv[i]); } argv = _free(argv); --- rpm-5.4.15/macros/macros.in~ 2014-12-07 21:43:59.000000000 +0100 +++ rpm-5.4.15/macros/macros.in 2014-12-07 22:07:57.383101292 +0100 @@ -1019,13 +1019,7 @@ %{nil} #============================================================================== -# XXX Caveat: -# XXX With %{load:...} being interpreted immediately -- not lazily -- -# XXX within a macro init file, a failure to load causes immediate loading -# XXX termination silently. -# XXX -# XXX So the order as well as the existence of the %{load:...} macros below -# XXX are critically important. +# XXX If a file specified in %{load:...} does not exist, it will be skipped. # XXX # XXX Note also that loaded macro files can NOT recursively load other # XXX macro files; only a top-level (i.e. after --macros, or within a *.spec) @@ -1036,11 +1030,8 @@ # XXX for configuring RPM itself. # XXX # XXX Simple example(s): -# XXX If the file %{_usrlibrpm}/macros.d/selinux doesn't exist, -# XXX then %{_usrlibrpm}/macros.rpmbuild will NOT be loaded. -# XXX # XXX if the file %{_usrlibrpm}/macros.d/cmake attempts another -# XXX %{load:...}, then loading will CEASE at that point in the file. +# XXX %{load:...}, then the statement will be IGNORED. #============================================================================== # ---- SELinux configuration macros. %{load:%{_usrlibrpm}/macros.d/selinux}