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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1824523

Title:
  Assertion error during iso build

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1824523/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to