Your message dated Fri, 2 Mar 2018 01:16:58 +0100
with message-id <[email protected]>
and subject line in git.git/next
has caused the Debian Bug report #890543,
regarding powermgmt-base's on_ac_power should report AC when no battery is 
present
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
890543: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890543
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: powermgmt-base
Version: 1.31+nmu1
Severity: important
Tags: patch newcomer

On a workstation system, on_ac_power gives 255 as exit code because it
was unable to determine the power source.

This would in turn make git think the system is on battery, and refuse
to automatically perform garbage collection.

The proposed patch will tell the caller that AC power is present when
there is no battery.

%%%%%%%
--- /sbin/on_ac_power   2009-12-02 00:57:18.000000000 -0800
+++ ./on_ac_power       2017-11-29 15:09:09.255660304 -0800
@@ -23,6 +23,9 @@
 OFF_LINE_P=no
 
 if [ -d /sys/class/power_supply/ ]; then
+    if ! test -d /sys/module/battery; then
+      exit 0
+    fi
     for FN in /sys/class/power_supply/*; do
        if test -d "${FN}" && test -r "${FN}/type"; then
            type="$(cat ${FN}/type)"
%%%%%%%

--- End Message ---
--- Begin Message ---
Bug #890543:
> > On a workstation system, on_ac_power gives 255 as exit code because it
> > was unable to determine the power source.

> > This would in turn make git think the system is on battery, and refuse
> > to automatically perform garbage collection.
> 
> Then it's a bug in git.

Merged to git/next:

commit 781262c5e7ad4a7813c528803117ed0d2e8c5172
Author: Adam Borowski <[email protected]>
Date:   Wed Feb 28 23:12:04 2018 +0100

    hooks/pre-auto-gc-battery: allow gc to run on non-laptops
    
    Desktops and servers tend to have no power sensor, thus on_ac_power returns
    255 ("unknown").  Thus, let's take any answer other than 1 ("battery") as
    no contraindication to run gc.
    
    If that tool returns "unknown", there's no point in querying other sources
    as it already queried them, and is smarter than us (can handle multiple
    adapters).
    
    Reported by: Xin Li <[email protected]>
    Signed-off-by: Adam Borowski <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>

diff --git a/contrib/hooks/pre-auto-gc-battery 
b/contrib/hooks/pre-auto-gc-battery
index 6a2cdebdb..7ba78c4df 100755
--- a/contrib/hooks/pre-auto-gc-battery
+++ b/contrib/hooks/pre-auto-gc-battery
@@ -17,7 +17,7 @@
 # ln -sf /usr/share/git-core/contrib/hooks/pre-auto-gc-battery \
 #      hooks/pre-auto-gc
 
-if test -x /sbin/on_ac_power && /sbin/on_ac_power
+if test -x /sbin/on_ac_power && (/sbin/on_ac_power;test $? -ne 1)
 then
        exit 0
 elif test "$(cat /sys/class/power_supply/AC/online 2>/dev/null)" = 1


I guess this bug is not urgent enough to pester the Debian maintainer of git
before it migrates the regular way.  So unless you complain, let's consider
this done.

On the other hand, it's possible there are other packages with a similar
problem.  Uses can be listed via
    https://codesearch.debian.net/search?q=on_ac_power
but the list of candidates to check looks scary.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ A dumb species has no way to open a tuna can.
⢿⡄⠘⠷⠚⠋⠀ A smart species invents a can opener.
⠈⠳⣄⠀⠀⠀⠀ A master species delegates.

--- End Message ---

Reply via email to