[systemd-devel] [HEADS-UP] It's release time!

Lennart Poettering lennart at poettering.net
Wed Feb 19 08:53:36 PST 2014


On Wed, 19.02.14 11:47, Colin Guthrie (gmane at colin.guthr.ie) wrote:

> 'Twas brillig, and Lennart Poettering at 18/02/14 02:26 did gyre and gimble:
> > Heya!
> > 
> > It's release time again! It has been more than 4 months now since the
> > last release. That's kinda emberassing, since we actually intended to go
> > for a 2-3 week cycle... The big dbus transition took some time however.
> > 
> > Aynway, I just finished a review of the git history, marked backportable
> > fixes, and put together the NEWS.
> > 
> > Kay, Zbigniew, Tom, David, Patrik, anything left to fix before I roll a
> > release? I'd like to roll the release tomorrow (tuesday) or
> > wednesday. Please have a closer look and test!
> 
> So I'm not sure if this is just a product of my package building stuff,
> but I get a lot more warning during build than I used to, primarily
> -Wmaybe-uninitialized and -Wdeclaration-after-statement warnings.
> 
> I'm sure most are harmless but do you know if this is something at my
> end (compiler, default options etc) that's different for other folks?
> 
> It doesn't happen for me with 208 with the same environment hence why it
> looks like some kind of change upstream.
> 
> I attach both build logs for reference (both have
> -Wdeclaration-after-statement but neither has -Wmaybe-uninitialized in
> flags).
> 


> src/libsystemd/sd-bus/bus-kernel.c: In function 'bus_message_setup_kmsg':
> src/libsystemd/sd-bus/bus-kernel.c:230:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
>          assert_cc(ALIGN8(offsetof(struct kdbus_item, vec) +
>          sizeof(struct kdbus_vec)) ==

This one happens if you don't have a compiler/libc that supports C11
static fallbacks. We then emulate them with an array definition, which
however gcc then complains about because we mix it with
-Wdeclaration-after-statement.

If have "gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)" and glibc
2.18 where C11 static asserts work fine, and where the warning is hence
not generated.

Zbigniew suggest we should drop -Wdeclaration-after-statement. I am not
convinced that that would be a good idea since generally declarations
after statements are an abomination, and we should avoid them, and it is
nice if gcc warns about that. I am open to dropping the warning though
with a gcc pragma in case we are compiled on an old system that lacks
C11 static asserts. But then again, I am not sure it's worth it...

> src/libsystemd/sd-bus/bus-message.c: In function 'sd_bus_message_open_container':
> src/libsystemd/sd-bus/bus-message.c:1917:18: warning: 'begin' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          w->begin = begin;

Fixed this one. But you could as well ignore it...

> /usr/include/bits/poll2.h: In function 'bus_poll':
> /usr/include/bits/poll2.h:71:2: warning: call to '__ppoll_chk_warn' declared with attribute warning: ppoll called with fds buffer too small file nfds entries [enabled by default]
>   return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds));
>   ^

This one I really don't grok, and the code looks totally fine...

> src/journal/cat.c: In function 'main':
> src/shared/util.c:5906:23: warning: 'buf' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  char *buf, *p;

Fixed this one, but doesn't matter...

> src/journal/sd-journal.c: In function 'add_file':
> src/journal/sd-journal.c:1304:11: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          r = hashmap_put(j->files, f->path, f);
>            ^

Same...

> src/shared/acpi-fpdt.c: In function 'acpi_get_boot_usec':
> src/shared/acpi-fpdt.c:102:12: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          if (l != tbl->length)
>             ^
> src/shared/acpi-fpdt.c:86:16: note: 'l' was declared here
>          size_t l;

Same...

> src/shared/efivars.c: In function 'read_usec.isra.2':
> src/shared/efivars.c:409:12: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          *u = x;
>             ^

Same...

> src/shared/utf8.c:226:44: warning: 'ss' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          for (f = s; f < (const uint8_t*) s + length; f += 2) {
>                                             ^
> src/shared/efivars.c:133:16: note: 'ss' was declared here
>          size_t ss;

Same...

> src/libsystemd/sd-bus/bus-control.c: In function 'sd_bus_get_owner':
> src/libsystemd/sd-bus/bus-control.c:710:494: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                          c->label = strndup(p, sz);

Same...

>   CCLD     test-date
>   CCLD     test-namespace
>   CCLD     test-replace-var
>   CCLD     test-sleep
> src/shared/sleep-config.c: In function 'can_sleep':
> src/shared/sleep-config.c:245:54: warning: 'used' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          log_debug("Hibernation is %spossible, Active(anon)=%llu kB, size=%zu kB, used=%zu kB, threshold=%.2g%%",
>                                                       ^
> src/shared/sleep-config.c:245:54: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized]
> src/shared/sleep-config.c:245:54: warning: 'act' may be used uninitialized in this function [-Wmaybe-uninitialized]

Same...

>   CCLD     test-calendarspec
>   CCLD     test-strip-tab-ansi
>   CCLD     test-cgroup-util
>   CCLD     test-job-type
> src/core/execute.c: In function 'exec_context_dump':
> src/core/execute.c:2008:21: warning: 'policy_str' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  free(policy_str);
>                      ^
> src/core/execute.c:1995:23: note: 'policy_str' was declared here
>                  char *policy_str;

Same...

>                        ^
> ./src/shared/util.h:120:22: warning: 'class_str' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          return s ? s : "n/a";
>                       ^
> src/core/execute.c:1980:23: note: 'class_str' was declared here
>                  char *class_str;

Same...

> src/libsystemd/sd-bus/sd-bus.c: In function 'sd_bus_attach_event.constprop.113':
> src/libsystemd/sd-event/sd-event.c:2145:16: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          e->tid = gettid();
>                 ^
> src/libsystemd/sd-event/sd-event.c:2129:19: note: 'e' was declared here
>          sd_event *e;

Same...

> src/core/dbus-manager.c: In function 'method_create_snapshot':
> src/core/dbus-manager.c:898:30: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          path = unit_dbus_path(UNIT(s));
>                               ^
> src/core/dbus-manager.c:876:19: note: 's' was declared here
>          Snapshot *s;

Same...

> src/shared/boot-timestamps.c:58:31: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          loader->monotonic = y - x;
>                                ^
> src/shared/boot-timestamps.c:29:16: note: 'x' was declared here
>          usec_t x, y, a;
>                 ^
> src/shared/boot-timestamps.c:60:11: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          a = n->monotonic + firmware->monotonic;
>            ^
> src/shared/boot-timestamps.c:29:19: note: 'y' was declared here
>          usec_t x, y, a;
>                    ^

Same...

> src/libsystemd/sd-bus/bus-control.c:710:494: warning: 'sz' may be used uninitialized in this function [-Wmaybe-uninitialized]
> src/test/test-sched-prio.c: In function 'main':
> src/core/manager.c:949:27: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          dual_timestamp_get(&m->generators_start_timestamp);
>                            ^
> src/test/test-sched-prio.c:28:18: note: 'm' was declared here
>          Manager *m;

Same...

>   CCLD     test-bus-memfd
> src/libsystemd/sd-bus/test-bus-memfd.c: In function 'main':
> src/libsystemd/sd-bus/test-bus-memfd.c:71:15: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          fflush(f);
>                ^
> src/libsystemd/sd-bus/test-bus-memfd.c:36:15: note: 'f' was declared here
>          FILE *f;

Same...

>   CCLD     test-bus-creds
>   CCLD     test-event
> src/libsystemd/sd-event/test-event.c: In function 'main':
> src/libsystemd/sd-event/sd-event.c:678:48: warning: 'bootid.qwords[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE;
>                                                 ^
> src/libsystemd/sd-event/sd-event.c:647:20: note: 'bootid.qwords[1]' was declared here
>          sd_id128_t bootid;
>                     ^
> src/libsystemd/sd-event/sd-event.c:678:48: warning: 'bootid.qwords[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE;
>                                                 ^
> src/libsystemd/sd-event/sd-event.c:647:20: note: 'bootid.qwords[0]' was declared here
>          sd_id128_t bootid;

Same...

> src/libsystemd/sd-event/test-event.c: In function 'signal_handler':
> src/libsystemd/sd-event/test-event.c:101:68: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          assert_se(sd_event_source_set_enabled(p, SD_EVENT_ONESHOT) >= 0);
>                                                                     ^
> src/libsystemd/sd-event/test-event.c:79:26: note: 'p' was declared here
>          sd_event_source *p;

Same...

>                           ^
> src/libsystemd/sd-event/test-event.c: In function 'defer_handler':
> src/libsystemd/sd-event/test-event.c:122:68: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          assert_se(sd_event_source_set_enabled(p, SD_EVENT_ONESHOT) >= 0);
>                                                                     ^
> src/libsystemd/sd-event/test-event.c:109:26: note: 'p' was declared here
>          sd_event_source *p;

Same...

>   CCLD     journalctl
> src/journal/journalctl.c: In function 'main':
> src/journal/sd-journal.c:2378:113: warning: 'end' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                                  *to = MAX(t, *to);

Same...

> src/journal/journalctl.c:1661:23: warning: 'bytes' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  printf("Journals take up %s on disk.\n",
>                        ^
> src/journal/journalctl.c:1654:26: note: 'bytes' was declared here
>                  uint64_t bytes;

Same...

> src/udev/udevadm-hwdb.c: In function 'adm_hwdb':
> src/udev/udevadm-hwdb.c:387:30: warning: 'filename_tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          if (err < 0 || rename(filename_tmp, filename) < 0) {
>                               ^

This one actually was interesting, but only because it lead me to find
an unrelated bug...

> src/udev/udevd.c: In function 'handle_ctrl_msg':
> src/udev/udev-ctrl.c:207:62: warning: 'ucred.uid' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  log_error("sender uid=%i, message ignored", ucred.uid);
>                                                               ^
> src/udev/udev-ctrl.c:183:22: note: 'ucred.uid' was declared here
>          struct ucred ucred;
>                       ^

Fixed but doesn't matter, again...

> src/journal/journal-gatewayd.c: In function 'request_handler_machine':
> src/journal/journal-gatewayd.c:766:21: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  free(b);
>                      ^

Same....

> src/network/networkd-manager.c: In function 'manager_process_link':
> src/network/networkd-link.c:1001:45: warning: 'link' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          assert(link->state == _LINK_STATE_INVALID);
>                                              ^
> src/network/networkd-link.c:108:15: note: 'link' was declared here
>          Link *link;
>                ^

Same...

> src/cgtop/cgtop.c: In function 'process':
> src/shared/cgroup-util.c:73:19: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          if (fscanf(f, "%lu", &ul) != 1) {
>                    ^

Same...

> src/boot/bootctl.c: In function 'show_status':
> src/boot/boot-efi.c:53:19: warning: 'list' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          uint16_t *list;

Same...

>   CCLD     systemd-nspawn
> src/nspawn/nspawn.c: In function 'main':
> src/nspawn/nspawn.c:769:17: warning: 'rnd.bytes[15]' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          snprintf(as_uuid, sizeof(as_uuid),
>                  ^

Same...

> src/hostname/hostnamectl.c:104:23: warning: 'bid.bytes[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  printf("           Boot ID: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(bid));
>                        ^
> src/hostname/hostnamectl.c:72:25: note: 'bid.bytes[0]' was declared here
>          sd_id128_t mid, bid;

Same...

> src/timedate/timedatectl.c: In function 'show_status':
> src/timedate/timedatectl.c:197:21: warning: 'zc' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  free(zc);
>                      ^
> src/timedate/timedatectl.c:198:21: warning: 'zn' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  free(zn);

Ah, there's actually a bug here... Fixed.

>                      ^
> /usr/include/bits/stdio2.h:64:3: warning: 'dn' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
>    ^
> src/timedate/timedatectl.c:104:13: note: 'dn' was declared here
>          int dn;

Fixed but doesn't matter...

>              ^
> ./src/shared/util.h:104:26: warning: 'is_dstc' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          return b ? "yes" : "no";
>                           ^
> src/timedate/timedatectl.c:105:15: note: 'is_dstc' was declared here
>          bool is_dstc, is_dstn;

Same here...

> src/tmpfiles/tmpfiles.c: In function 'process_item':
> src/tmpfiles/tmpfiles.c:753:445: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  if (!streq(i->argument, x)) {

Same here...

> src/shared/util.c:2530:214: note: 's' was declared here
>          char fn[sizeof("/dev/char/")-1 + 2*DECIMAL_STR_MAX(unsigned)
>          + 1 + 1], *s, *b, *p;

Same...

> src/socket-proxy/socket-proxyd.c: In function 'accept_cb':
> src/shared/socket-util.c:597:29: warning: 'ucred.uid' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                  if (asprintf(ret, "PID %lu/UID %lu", (unsigned long) ucred.pid, (unsigned long) ucred.uid) < 0)
>                              ^

Same...

> src/backlight/backlight.c: In function 'find_pci_or_platform_parent':
> src/backlight/backlight.c:75:28: warning: 'class' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                          if (class == 0x30000)
>                             ^
> src/backlight/backlight.c:67:39: note: 'class' was declared here
>                          unsigned long class;

Same...

>                                        ^
> src/login/logind-session.c: In function 'session_start':
> src/login/logind-session.c:503:38: warning: 'job' may be used uninitialized in this function [-Wmaybe-uninitialized]
>                          s->scope_job = job;

Same...

Soo, pretty much all of these are false positives triggered by
-flto. Before adding -flto we only got these fals positives within
source files, now we ge them across source files. We usually just
patched these issues away by initializing variables where initialization
wasn't really necessary. I did the same now for all of these.

Please try to rebuild things again. You should still see some noise, but
much less. Can you post your results again?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list