Bug#884824: etckeeper: daily autocommit is run even though AVOID_DAILY_AUTOCOMMITS=1

2023-07-27 Thread Bill Wohler
I just noticed some temporary crap was committed last night, and upon
investigation, found "daily autocommit" messages dating back to
2020-03-07 when I upgraded to bullseye. Who knows what other crap got
committed that I missed with a clean "git diff"? I recently upgraded to
bookworm.

I have AVOID_DAILY_AUTOCOMMITS=1 in /etc/etckeeper.conf to prevent these
evil commits since I'll check in my changes when they are good and
ready, and I'll have a much more helpful log message. Whatever it takes
to prevent these unwanted commits would be much appreciated.

-- 
Bill Wohler  aka 
http://www.newt.com/wohler/, GnuPG ID:610BD9AD



Bug#884824: etckeeper: daily autocommit is run even though AVOID_DAILY_AUTOCOMMITS=1

2020-04-17 Thread Timo Sigurdsson
Hi,

as mentioned in my last email, here is a patch that make etckeepker/daily honor 
the setting AVOID_DAILY_AUTOCOMMITS=1 in the configuration file and doesn't 
fail if the variable is unset. I also went ahead and removed the check from 
cron.daily/etckeeper so it's not performed twice when the cronjob is run. 
Please note, that this patch only applies cleanly if my patch sent for bug 
#883263 is applied first. But technically it's not required as it's just the 
context that is different.

Regards,

Timo>From 36864b49b56b20198ee01f302ebdedd3e15c9d58 Mon Sep 17 00:00:00 2001
From: Timo Sigurdsson 
Date: Fri, 17 Apr 2020 19:23:19 +0200
Subject: [PATCH] Fix Debian etckeeper bug #884824.

---
 cron.daily/etckeeper | 8 +++-
 etckeeper/daily  | 6 ++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/cron.daily/etckeeper b/cron.daily/etckeeper
index 3266faa..ade2a2a 100755
--- a/cron.daily/etckeeper
+++ b/cron.daily/etckeeper
@@ -5,9 +5,7 @@ if [ -d /run/systemd/system ] && [ -x /bin/systemctl ] && /bin/systemctl -q is-active etckeeper.timer; then
 	exit 0
 fi
 
-if [ -e /etc/etckeeper/daily ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
-	. /etc/etckeeper/etckeeper.conf
-	if [ "$AVOID_DAILY_AUTOCOMMITS" != "1" ]; then
-		/etc/etckeeper/daily
-	fi
+# The etckeeper/daily script checks if daily autocommits are disabled.
+if [ -x /etc/etckeeper/daily ]; then
+	/etc/etckeeper/daily
 fi
diff --git a/etckeeper/daily b/etckeeper/daily
index f98c6ad..276c84e 100755
--- a/etckeeper/daily
+++ b/etckeeper/daily
@@ -2,6 +2,12 @@
 # Script that can be run daily to autocommit /etc changes.
 set -e
 if [ -x /usr/bin/etckeeper ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
+	# check if daily autocommits are disabled (Debian bug #884824)
+	. /etc/etckeeper/etckeeper.conf
+	if [ "$AVOID_DAILY_AUTOCOMMITS" = "1" ]; then
+		exit 0
+	fi
+
 	# avoid autocommit if an install run is in progress
 	lockfile=/var/cache/etckeeper/packagelist.pre-install
 	if [ -e "$lockfile" ] && [ -n "$(find "$lockfile" -mtime +1)" ]; then
-- 
2.20.1



Bug#883263: Bug#884824: etckeeper: daily autocommit is run even though AVOID_DAILY_AUTOCOMMITS=1

2019-12-01 Thread Antoine Beaupré
On 2019-11-21 11:33:21, Luca Capello wrote:
> forcemerge 884824 904924
> severity 884824 important
> tags 884824 patch
> block 883263 by 884824
> thanks
>
> Hi there,
>
> On Wed, 20 Dec 2017 14:30:42 +1100, Martin Schwenke wrote:
>> Following a suggestion, I found that if I run:
>> 
>>   systemctl stop etckeeper.timer
>
> The systemd timer was activated just before you filed your report:
>
>   
>
> And I got hit as well since 2 days, i.e. since I upgraded my **work**
> machine from stretch to buster.
>
>> Then it is no longer listed by "systemctl list-units".
>> 
>> I should have spent more time reading systemctl(1):
>
> Nope, this is a bug in the /etc/etckeeper/daily shell script, which
> does not respect /etc/etckeeper/etckeeper.conf, the patch is simple:

[...]

I'm confused about which patch is necessary here (and by the multiple
overlapping bug reports). Mind clarifying that for me?

Thanks,

A.

-- 
The desire to sacrifice an entire lifetime to the noblest of ideals
serves no purpose if one works alone.
- Che Guevara



Bug#883263: Bug#884824: etckeeper: daily autocommit is run even though AVOID_DAILY_AUTOCOMMITS=1

2019-11-21 Thread Luca Capello
forcemerge 884824 904924
severity 884824 important
tags 884824 patch
block 883263 by 884824
thanks

Hi there,

On Wed, 20 Dec 2017 14:30:42 +1100, Martin Schwenke wrote:
> Following a suggestion, I found that if I run:
> 
>   systemctl stop etckeeper.timer

The systemd timer was activated just before you filed your report:

  

And I got hit as well since 2 days, i.e. since I upgraded my **work**
machine from stretch to buster.

> Then it is no longer listed by "systemctl list-units".
> 
> I should have spent more time reading systemctl(1):

Nope, this is a bug in the /etc/etckeeper/daily shell script, which
does not respect /etc/etckeeper/etckeeper.conf, the patch is simple:
=
root@harlock:/etc# git log -1
commit 22dae914f53724d6bd36cd7c4fdd8d03f41f6c97 (HEAD -> master)
Author: root 
Date:   Wed Nov 20 18:49:56 2019 +0100

daily autocommit
root@harlock:/etc# git reset 8454274b14e8401f0d2f7f23973d13f971ee79a9
Unstaged changes after reset:
Mcron.daily/local_report-pointage.sh
Metckeeper/daily
Mfstab
Miptables/rules.v4
root@harlock:/etc# git diff etckeeper/daily
diff --git a/etckeeper/daily b/etckeeper/daily
index f98c6ad..2d291c7 100755
--- a/etckeeper/daily
+++ b/etckeeper/daily
@@ -2,6 +2,10 @@
 # Script that can be run daily to autocommit /etc changes.
 set -e
 if [ -x /usr/bin/etckeeper ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
+   ## 
+   . /etc/etckeeper/etckeeper.conf
+   [ ${AVOID_DAILY_AUTOCOMMITS} -eq 0 ] || exit 0
+
# avoid autocommit if an install run is in progress
lockfile=/var/cache/etckeeper/packagelist.pre-install
if [ -e "$lockfile" ] && [ -n "$(find "$lockfile" -mtime +1)" ]; then
root@harlock:/etc# bash -x etckeeper/daily 
+ set -e
+ '[' -x /usr/bin/etckeeper ']'
+ '[' -e /etc/etckeeper/etckeeper.conf ']'
+ . /etc/etckeeper/etckeeper.conf
++ VCS=git
++ GIT_COMMIT_OPTIONS=
++ HG_COMMIT_OPTIONS=
++ BZR_COMMIT_OPTIONS=
++ DARCS_COMMIT_OPTIONS=-a
++ AVOID_DAILY_AUTOCOMMITS=1
++ AVOID_COMMIT_BEFORE_INSTALL=1
++ HIGHLEVEL_PACKAGE_MANAGER=apt
++ LOWLEVEL_PACKAGE_MANAGER=dpkg
++ PUSH_REMOTE=
+ '[' 1 -eq 0 ']'
+ exit 0
root@harlock:/etc# git status
On branch master
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

  modified:   cron.daily/local_report-pointage.sh
  modified:   etckeeper/daily
  modified:   fstab
  modified:   iptables/rules.v4

no changes added to commit (use "git add" and/or "git commit -a")
root@harlock:/etc# 
=

Thx, bye,
Gismo / Luca

-- 
Dr. Luca Capello
Ingénieur HPC
Division du Système et des Technologies de l'Information et de la Communication
Université de Genève | 24 rue Général-Dufour
Tél +41 22 379 72 42 | Bureau 151
https://hpc-community.unige.ch
mailto:luca.cape...@unige.ch


signature.asc
Description: PGP signature


Bug#884824: etckeeper: daily autocommit is run even though AVOID_DAILY_AUTOCOMMITS=1

2017-12-19 Thread Martin Schwenke
Following a suggestion, I found that if I run:

  systemctl stop etckeeper.timer

Then it is no longer listed by "systemctl list-units".

I should have spent more time reading systemctl(1):

  delete
   ...

   This command implicitly reloads the system manager configuration
   after completing the operation. Note that this command does not
   implicitly stop the units that are being disabled. If this is
   desired, either combine this command with the --now switch, or
   invoke the stop command with appropriate arguments later.

peace & happiness,
martin



Bug#884824: etckeeper: daily autocommit is run even though AVOID_DAILY_AUTOCOMMITS=1

2017-12-19 Thread Martin Schwenke
Package: etckeeper
Version: 1.18.7-1
Severity: normal

Dear Maintainer,

Some time ago I disabled daily autocommits for my /etc/ directory:

  commit 1e123419c83f254aa27b831f8b268a8f575211dc
  Author: Martin Schwenke 
  Date:   Tue Sep 8 10:51:19 2015 +1000

  etckeeper: Be less automatic

  diff --git a/etckeeper/etckeeper.conf b/etckeeper/etckeeper.conf
  index 2aec35e..fd9cfb8 100644
  --- a/etckeeper/etckeeper.conf
  +++ b/etckeeper/etckeeper.conf
  @@ -18,7 +18,7 @@ DARCS_COMMIT_OPTIONS="-a"

   # Uncomment to avoid etckeeper committing existing changes
   # to /etc automatically once per day.
  -#AVOID_DAILY_AUTOCOMMITS=1
  +AVOID_DAILY_AUTOCOMMITS=1

   # Uncomment the following to avoid special file warning
   # (the option is enabled automatically by cronjob regardless).
   @@ -27,7 +27,7 @@ DARCS_COMMIT_OPTIONS="-a"
   # Uncomment to avoid etckeeper committing existing changes to 
   # /etc before installation. It will cancel the installation,
   # so you can commit the changes by hand.
  -#AVOID_COMMIT_BEFORE_INSTALL=1
  +AVOID_COMMIT_BEFORE_INSTALL=1

   # The high-level package manager that's being used.
   # (apt, pacman-g2, yum, dnf, zypper etc)

This has worked until recently.

Now I see daily autocommits again.  When I check /var/log/syslog I
see:

  Dec 18 16:06:26 rover systemd[1]: Starting Autocommit of changes in /etc 
directory...
  Dec 18 16:06:27 rover systemd[1]: Started Autocommit of changes in /etc 
directory.

It appears that a systemd job is active:

  $ systemctl list-units | grep etckeeper
  etckeeper.timer   
loaded active waiting   Daily autocommit of changes in /etc 
directory  

However, the comment in /etc/etckeeper/etckeeper.conf.dpkg-dist says:

  # Etckeeper includes both a cron job and a systemd timer, which each
  # can commit exiting changes to /etc automatically once per day.
  # To enable the systemd timer, run: systemctl enable etckeeper.timer
  # The cron job is enabled by default; to disable it, uncomment this next line.
  #AVOID_DAILY_AUTOCOMMITS=1

I certainly haven't enabled the the systemd timer.

Note that I don't seem to be able to disable the systemd timer:

  root@rover:/etc# systemctl disable etckeeper.timer
  root@rover:/etc# systemctl list-units | grep etckeeper
  etckeeper.timer   
loaded active waiting   Daily autocommit of changes in /etc 
directory   

Clearly, I'm not smart enough to use something as excellent as
systemd.  ;-)

I think that, as documented, the systemd job should not be enabled by
default.

Alternatively, /etc/etckeeper/daily could be modified to honour
AVOID_DAILY_AUTOCOMMITS=1.  Then it would not matter if the systemd
job is active and is immortal.  In that case a Linux user with over 20
years experience would still be able to disable the daily autocommit
in an expected way.  ;-)

Thanks...

peace & happiness,
martin


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (990, 'stable'), (500, 'stable-updates'), (300, 
'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages etckeeper depends on:
ii  debconf [debconf-2.0]  1.5.65
ii  git1:2.15.1-1

Versions of packages etckeeper recommends:
ii  cron [cron-daemon]  3.0pl1-128.1

Versions of packages etckeeper suggests:
ii  sudo  1.8.21p2-2

-- Configuration Files:
/etc/etckeeper/etckeeper.conf changed:
VCS="git"
GIT_COMMIT_OPTIONS=""
HG_COMMIT_OPTIONS=""
BZR_COMMIT_OPTIONS=""
DARCS_COMMIT_OPTIONS="-a"
AVOID_DAILY_AUTOCOMMITS=1
AVOID_COMMIT_BEFORE_INSTALL=1
HIGHLEVEL_PACKAGE_MANAGER=apt
LOWLEVEL_PACKAGE_MANAGER=dpkg
PUSH_REMOTE=""


-- debconf information:
  etckeeper/purge: true