etckeeper icon indicating copy to clipboard operation
etckeeper copied to clipboard

Etckeeper warning because of special files

Open bessarabov opened this issue 15 years ago • 5 comments

I'm using etckeeper and it works great except for one thing. It shows errors when trying to commit:

etckeeper warning: special files could cause problems with git: ./sv/project_a/supervise/ok ./sv/project_a/supervise/control

As I understood this is because of file pre-commit.d/20warn-special-file.I've simply deleted it and after that I have no warnings. But I'm sure this is not the perfect solution =)

By the way, this behaviour is described in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529253

bessarabov avatar Sep 15 '10 09:09 bessarabov

What are those files? Pipes? Perhaps you can simply ignore them by creating a .gitignore?

Note: I am not the original author of etckeeper, this is just a fork I create to incorporate a few changes that now have been merged upstream. http://joey.kitenet.net/code/etckeeper/ is probably the site you are looking for :-)

wertarbyte avatar Sep 15 '10 09:09 wertarbyte

Yes, that files are pipes:

$ sudo ls -ls /etc/sv/project_a/supervise/control 0 prw------- 1 root root 0 2010-08-18 15:05 /etc/sv/project_a/supervise/control

I also thought about .gitignore. I've added that files to .gitignore, but the problem did't disappear.

Thank you for the information that you are not the original author. I've found his email and send him message about this problem.

I think that we should leave this issue unsolved. You never know, maybe someone will fork this project and pull the solution. =)

bessarabov avatar Sep 15 '10 10:09 bessarabov

Did someone find a solution for this issue? It is really annoying to get those warning every night, but I guess you know this problem =).

Avalarion avatar Aug 06 '13 06:08 Avalarion

The bug is fixed in etckeeper 0.55. The following patch solved it for me on Ubuntu 10.04 (derived from upstream commit, see https://github.com/joeyh/etckeeper/commit/ad3fbb8d31894bfbff30e143dc18e85eed5afd20

diff --git a/cron.daily/etckeeper b/cron.daily/etckeeper
index f0e71b2..91a5bc3 100755
--- a/cron.daily/etckeeper
+++ b/cron.daily/etckeeper
@@ -7,6 +7,8 @@ if [ -x /usr/sbin/etckeeper ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
                        hostname=`hostname -f 2>/dev/null || hostname`
                        export HGUSER=cron@$hostname
                fi
+               AVOID_SPECIAL_FILE_WARNING=1
+               export AVOID_SPECIAL_FILE_WARNING
                if etckeeper unclean; then
                        etckeeper commit "daily autocommit" >/dev/null
                fi
diff --git a/etckeeper/etckeeper.conf b/etckeeper/etckeeper.conf
index f810870..2d60a11 100644
--- a/etckeeper/etckeeper.conf
+++ b/etckeeper/etckeeper.conf
@@ -20,6 +20,10 @@ VCS="git"
 # to /etc automatically once per day.
 #AVOID_DAILY_AUTOCOMMITS=1

+# Uncomment the following to avoid special file warning
+# (the option is enabled automatically by cronjob regardless).
+#AVOID_SPECIAL_FILE_WARNING=1
+
 # Uncomment to avoid etckeeper committing existing changes to 
 # /etc before installation. It will cancel the installation,
 # so you can commit the changes by hand.
diff --git a/etckeeper/pre-commit.d/20warn-special-file b/etckeeper/pre-commit.d/20warn-special-file
index 665a3ce..60a6185 100755
--- a/etckeeper/pre-commit.d/20warn-special-file
+++ b/etckeeper/pre-commit.d/20warn-special-file
@@ -3,7 +3,7 @@ set -e

 if [ "$VCS" = git ] || [ "$VCS" = hg ] || [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then
        special=$(find -not -type d -not -type f -not -type l | grep -v '/\(.git\|.hg\|.bzr\|_darcs\)/') || true
-       if [ -n "$special" ]; then
+       if [ -n "$special" ] && [ -z "$AVOID_SPECIAL_FILE_WARNING" ]; then
                echo "etckeeper warning: special files could cause problems with $VCS:" >&2
                echo "$special" >&2
        fi

stucki avatar Oct 09 '13 10:10 stucki

And here is the same patch for Debian Squeeze:

diff --git a/cron.daily/etckeeper b/cron.daily/etckeeper
index e83b570..6d7ed45 100755
--- a/cron.daily/etckeeper
+++ b/cron.daily/etckeeper
@@ -5,6 +5,8 @@ if [ -x /usr/sbin/etckeeper ] && [ -e /etc/etckeeper/etckeeper.conf ]; then
    if [ "$AVOID_DAILY_AUTOCOMMITS" != "1" ]; then
        # avoid autocommit if an install run is in progress
        if [ ! -e /var/cache/etckeeper/packagelist.pre-install ]; then
+           AVOID_SPECIAL_FILE_WARNING=1
+           export AVOID_SPECIAL_FILE_WARNING
            if etckeeper unclean; then
                etckeeper commit "daily autocommit" >/dev/null
            fi
diff --git a/etckeeper/etckeeper.conf b/etckeeper/etckeeper.conf
index be8934d..c95f377 100644
--- a/etckeeper/etckeeper.conf
+++ b/etckeeper/etckeeper.conf
@@ -20,6 +20,10 @@ DARCS_COMMIT_OPTIONS="-a"
 # to /etc automatically once per day.
 #AVOID_DAILY_AUTOCOMMITS=1

+# Uncomment the following to avoid special file warning
+# (the option is enabled automatically by cronjob regardless).
+#AVOID_SPECIAL_FILE_WARNING=1
+
 # Uncomment to avoid etckeeper committing existing changes to 
 # /etc before installation. It will cancel the installation,
 # so you can commit the changes by hand.
diff --git a/etckeeper/pre-commit.d/20warn-special-file b/etckeeper/pre-commit.d/20warn-special-file
index f246fb1..00c1222 100755
--- a/etckeeper/pre-commit.d/20warn-special-file
+++ b/etckeeper/pre-commit.d/20warn-special-file
@@ -3,7 +3,7 @@ set -e

 if [ "$VCS" = git ] || [ "$VCS" = hg ] || [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then
    special=$(find . -not -type d -not -type f -not -type l | grep -v '/\(.git\|.hg\|.bzr\|_darcs\)/') || true
-   if [ -n "$special" ]; then
+   if [ -n "$special" ] && [ -z "$AVOID_SPECIAL_FILE_WARNING" ]; then
        echo "etckeeper warning: special files could cause problems with $VCS:" >&2
        echo "$special" >&2
    fi

stucki avatar Oct 09 '13 10:10 stucki