From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Scott Zimmermann Newsgroups: gmane.emacs.bugs Subject: bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container Date: Sat, 13 May 2023 19:57:08 +0200 Message-ID: <0f761478-aeb5-d65c-2c92-67dba69076d1@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4365"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: curl/7.5.1 To: 63496@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 14 09:58:40 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1py6cq-0000zJ-FF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 May 2023 09:58:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1py6cH-0001oA-Ms; Sun, 14 May 2023 03:58:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1py6cF-0001m6-Eq for bug-gnu-emacs@gnu.org; Sun, 14 May 2023 03:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1py6cF-0005zT-6U for bug-gnu-emacs@gnu.org; Sun, 14 May 2023 03:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1py6cF-0007mx-2B for bug-gnu-emacs@gnu.org; Sun, 14 May 2023 03:58:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Scott Zimmermann Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 May 2023 07:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63496 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168405104929860 (code B ref -1); Sun, 14 May 2023 07:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 May 2023 07:57:29 +0000 Original-Received: from localhost ([127.0.0.1]:40237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1py6bh-0007lS-GF for submit@debbugs.gnu.org; Sun, 14 May 2023 03:57:29 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxtWf-0006Kt-CC for submit@debbugs.gnu.org; Sat, 13 May 2023 13:59:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxtWf-000623-69 for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 13:59:25 -0400 Original-Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxtWd-0008Np-Oq for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 13:59:24 -0400 Original-Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-50bc3088b7aso20870048a12.3 for ; Sat, 13 May 2023 10:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684000761; x=1686592761; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=8gJ6pGJ+l/zWD3i2DV90f79OZ7eHhjkvl4Owca581u0=; b=Q+U4k15yGRe9sO069F30phZnj8mgpN9H6+0fxDAeeKUyEYiFeJ/XS4akn66f8hlr1t HvPWuM/nc0z47OjvUlFnMVLHj0ToprIVs/mt8t65rwBzY6o4KJUmfo3/xS/J0mVn7RPA 9gmqd6aaTGkz5CWAYsU7JzBuEG8VGcHJa2YE1bfv5Z0EXLUu7GJe7JWGi98UL8JdlsXd TMV8yLE1vUIxFAxwNYmnvYl9RkK4D99FbKsRBtvFYQUZv6wDzcKhsEd3XcLyNussWO1U KNR+M/3osF6oPoh7XaJj9BgwmTVdbDqlYx98o+AcHCVHMaK/3y3csVch/l2jBVyCWfi4 JL5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684000761; x=1686592761; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8gJ6pGJ+l/zWD3i2DV90f79OZ7eHhjkvl4Owca581u0=; b=LWXwoaJAA+dc4OAT3J9KxibsOJZlsnpSmSjdV5IDA+DL9Ncv4xTM9I8273OCr5vRqU Kl2kCzgckHOujJY8VJmWrFxQ1a4yYhqqLRSb7lBULQsDY+lIPIqqUy3k9MC7Fm1PtrOW 9SzOiY4etc+eAa4CnvFENEARzOeh+/5glYZedRZuwkX0jFa4AvTaa8JJxVGct2gDmT8S boZoyizDExoycrduAtexRGmRWcuieEDtZIcatUYjYXWBLzeUcizI0Z+flvjYadPzucPE Er80Ah1/B4tIfUeREpM55lEjYiKApfW7h5wfD+6Ol8mmGi9ZFnR163wBGs21L2ODCxrf 2wPQ== X-Gm-Message-State: AC+VfDxzsljFLJbRNGGPcB1S6RZqE0Lyy8bkcjCu05PZDbUHRtzya2ES adNNBYwMx+V+d9i+PP/fzETOTjmQZLB2Jw== X-Google-Smtp-Source: ACHHUZ6j4OLgoW0Xt8AYq6FPxlhysO64xQw4UtV9jMCajBF93WjwACTXeZ44RKotMHB6YMZIVp1NQw== X-Received: by 2002:a17:906:db08:b0:965:fa80:bf1 with SMTP id xj8-20020a170906db0800b00965fa800bf1mr26202736ejb.32.1684000761320; Sat, 13 May 2023 10:59:21 -0700 (PDT) Original-Received: from ?IPV6:fc00:bbbb:bbbb:bb01::4:eb62? ([2a00:1651:0:4000::a01e]) by smtp.gmail.com with ESMTPSA id wi21-20020a170906fd5500b0094edbe5c7ddsm7107050ejb.38.2023.05.13.10.59.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 May 2023 10:59:20 -0700 (PDT) Content-Language: en-US-large Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=sczimmer@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 14 May 2023 03:57:26 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261708 Archived-At: in src/sysdep.c line 3475: Lisp_Object boot = Ftime_subtract (now, uptime); it calculates the boot time for linux based on the uptime. Inside lxc containers, /proc/uptime is the uptime of the container rather than of the host system. However in /proc/[PID]/stat, starttime is the time since system boot, of the host system, not since the container started. This leads to emacs computing incorrect values for start, etime, and pcpu for processes. I think it should get the boot time from "btime" in /proc/stat, this is what ps does, which shows correct times for processes inside the container. If this sounds like an appropriate fix I'm happy to write and test a patch for it.