LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 10-31-2005, 02:33 PM   #1
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
etc-update for Slackware


I have started developing something like etc-update (from Gentoo) for Slackware. The purpose of the script is to look for ".new" configuration files and to find out whether they are identical with the old version or not.
If you are interested in contributing ideas, feel free to download the script from here. I'd appreciate your feedback and ideas.

Last edited by uselpa; 10-31-2005 at 03:25 PM.
 
Old 10-31-2005, 03:12 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,393

Rep: Reputation: Disabled
You know that the Slackware packages only leave .new files when they are different from the originals? The install script deletes any .new files if they are identical to the file that is found already installed on the computer.

Eric
 
Old 10-31-2005, 03:21 PM   #3
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Original Poster
Rep: Reputation: 46
No, I did not know that. Does this include checks of file modes, gid, uid in addition to contents?
When I did the upgrade from 10.1 to 10.2, I sure found some identical files if I am not mistaken.
 
Old 10-31-2005, 04:56 PM   #4
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 1,808

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally posted by uselpa
No, I did not know that. Does this include checks of file modes, gid, uid in addition to contents?
When I did the upgrade from 10.1 to 10.2, I sure found some identical files if I am not mistaken.
It checks md5sums. There is no way any identical files were left on your system. They must have been different. Even if only slightly.
 
Old 10-31-2005, 05:33 PM   #5
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Original Poster
Rep: Reputation: 46
Code:
root@slackw:/sbin$ grep -i md5sum *
installpkg:#  MD5SUM=`md5sum $package | cut -f 1 -d ' '`
installpkg:#  echo "PACKAGE MD5SUM: $MD5SUM" >> $ADM_DIR/packages/$shortname
The only reference I can find to md5 is in remarks. Can you tell me where the md5 check is performed?
 
Old 10-31-2005, 08:49 PM   #6
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 1,808

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally posted by uselpa
The only reference I can find to md5 is in remarks.
That's because you're looking in the wrong spot. Look under /var/log/scripts and 'cat' the script of any package which installs files under /etc.

For example, this is an extract from the udev package script:
Code:
config() {
  NEW="$1"
  OLD="`dirname $NEW`/`basename $NEW .new`"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
config etc/rc.d/rc.udev.new
HTH.

Last edited by rkelsen; 10-31-2005 at 08:50 PM.
 
Old 11-01-2005, 05:46 AM   #7
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Original Poster
Rep: Reputation: 46
OK, so it's not standard upgradepkg behaviour, but up to the post-install script. Thanks for the info.
Anyway, the case might happen for whatever reason so I want to be able to manage it.
 
Old 11-01-2005, 06:04 AM   #8
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Off topic slightly, but does anyone know the probability that two different files will have the same MD5 checksum?
 
Old 11-01-2005, 10:18 AM   #9
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
OK, I'll assume that the "obvious" answer is the correct one: 1 in 2^128 (since MD5 generates a 128-bit checksum).
 
Old 11-01-2005, 12:12 PM   #10
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Original Poster
Rep: Reputation: 46
Nobber, I don't know. What I know is that I don't trust md5. When I wrote a program to find duplicate files, I compared the files bytewise. All other programs I know of use hashed like md5 or sha1. In both, collisions exist.

Back to etc-update. As having completely identical files is obviously the exception, I added an 'act' mode. In act mode, you can compare and modify the config files. I guess it looks more like the Gentoo tool now.

Feedback is welcome. Have a look at the documentation for more explanation. And use with care.

The link is still the same
 
Old 11-01-2005, 12:18 PM   #11
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Quote:
Originally posted by uselpa
All other programs I know of use hashed like md5 or sha1. In both, collisions exist.
True, but the probability of a collision is vanishingly small. You're far more likely to be abducted by aliens on a wet Tuesday in May than to find an MD5 hash collision in your lifetime!
 
Old 11-01-2005, 12:23 PM   #12
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Original Poster
Rep: Reputation: 46
Quote:
Originally posted by Nobber
True, but the probability of a collision is vanishingly small. You're far more likely to be abducted by aliens on a wet Tuesday in May than to find an MD5 hash collision in your lifetime!
Here we go again.. why be less than certain if you can be 100% sure?
 
Old 11-01-2005, 02:00 PM   #13
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Even a byte-by-byte comparison can give the wrong answer if there are hardware failures.
 
Old 11-02-2005, 12:44 PM   #14
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Original Poster
Rep: Reputation: 46
Getting back to the subject, I have released a new version that now uses vimdiff, i.e. vim, to visually manage the differences in the configuration files. I have also added a transcript of an interactive session to the doc and hence to the homepage.

I think that the script is now getting close to usable. I'll stop advertising it here, but I do appreciate all feedback, positive or negative, provided that "grep -i md5" and "grep -i alien" are empty.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The best way to update slackware hyapadi Slackware 4 03-30-2005 03:19 AM
Slackware 10.0 update? carlosinfl Slackware 8 07-19-2004 10:08 PM
Slackware 10 update noobtesting Slackware 9 06-30-2004 04:11 PM
How Do I Update Slackware? AFI_Flame Slackware 19 05-21-2004 02:21 PM
Slackware Security Update: GDM security update phoeniXflame Slackware 2 08-26-2003 05:21 PM


All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration