"etckeeper unclean" is broken

Bug #1096491 reported by Rolf Leggewie
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
etckeeper (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

I use etckeeper 0.61ubuntu2 and git 1:1.7.9.5-1 in precise. "etckeeper unclean" returns wrong information, in fact, I have never managed for it to tell me the directory contains uncommited changes.

$ sudo git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: .etckeeper
# deleted: cups/subscriptions.conf
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: .etckeeper
# modified: apt/sources.list
#
$ sudo etckeeper unclean
$

Tags: precise
Changed in etckeeper (Ubuntu):
importance: Undecided → Medium
Revision history for this message
agent 8131 (agent-8131) wrote :

I just ran into this. A better description is that etckeeper unclean is broken when using git.

# git status
# On branch master
nothing to commit (working directory clean)

# etckeeper unclean
# echo $?
1

Obviously that should return 0.

Changed in etckeeper (Ubuntu):
status: New → Confirmed
Revision history for this message
Tamas Papp (tomposmiko) wrote :

hi All,

I just run into this issue? It's 8 years old. Is there any update on this somewhere else?

Revision history for this message
Tamas Papp (tomposmiko) wrote :

csepcsop /etc # git status
On branch master
nothing to commit, working tree clean
csepcsop /etc # touch a
csepcsop /etc # git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
 a

nothing added to commit but untracked files present (use "git add" to track)
csepcsop /etc # etckeeper unclean
csepcsop /etc # echo $?
0
csepcsop /etc #

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Hi Tamas,

I just tried to reproduce what you mentioned in Ubuntu Kinetic (22.10) and I got the same results as you did. After going through etckeeper manpage, I see this is the expected behavior:

       unclean
              This returns true if the directory contains uncommitted changes.

In short, if you have uncommited changes it returns true (0) and if there is no uncommited change it returns false (returned 1 during my test):

root@etckeeper-test:/etc# git status
On branch master
nothing to commit, working tree clean
root@etckeeper-test:/etc# touch a
root@etckeeper-test:/etc# git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
 a

nothing added to commit but untracked files present (use "git add" to track)
root@etckeeper-test:/etc# etckeeper unclean
root@etckeeper-test:/etc# echo $?
0
root@etckeeper-test:/etc# rm a
root@etckeeper-test:/etc# git status
On branch master
nothing to commit, working tree clean
root@etckeeper-test:/etc# etckeeper unclean
root@etckeeper-test:/etc# echo $?
1

So I believe this is not a bug at all but expected behavior. Therefore, marking this bug as Invalid.

Changed in etckeeper (Ubuntu):
status: Confirmed → Invalid
Rolf Leggewie (r0lf)
Changed in etckeeper (Ubuntu):
status: Invalid → Confirmed
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.