Comment 3 for bug 1824523

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I think it is racy to assert things about getppid

       getppid() returns the process ID of the parent of the calling process.
       This will be either the ID of the process that created this process us‐
       ing fork(), or, if that process has already terminated, the ID of the
       process to which this process has been reparented (either init(1) or a
       "subreaper" process defined via the prctl(2) PR_SET_CHILD_SUBREAPER op‐
       eration).

As processes get reparented, the getppid will not match status.

I also do not understand the point of testing getppid() implementation. Since getppid() is actually never used. The only code path that is used is reading /proc/*/status files and parsing those.

the /proc/*/status parsing is used to determine whether or not to show UA output. When we fail to determine if we should show the output or not, we should not be crashing the whole transaction (and subiquity in this case).

A crashing hook, shouldn't crash apt return codes...

Please remove this selftest from production code:
   // Self testing
   if (access("/proc/self/status", R_OK) == 0) {
      std::string ppid;
      strprintf(ppid, "%d", getppid());
      assert(ppid == getppid_of("self"));
   }

As it will always crash apt, when it gets reparented.