Slackware This Forum is for the discussion of Slackware Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-31-2005, 01:33 PM
|
#1
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Rep:
|
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 02:25 PM.
|
|
|
|
10-31-2005, 02:12 PM
|
#2
|
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 4,679
Rep: 
|
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
|
|
|
|
10-31-2005, 02:21 PM
|
#3
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Original Poster
Rep:
|
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.
|
|
|
|
10-31-2005, 03:56 PM
|
#4
|
|
Senior Member
Registered: Sep 2004
Distribution: slackware
Posts: 1,684
Rep: 
|
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.
|
|
|
|
10-31-2005, 04:33 PM
|
#5
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Original Poster
Rep:
|
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?
|
|
|
|
10-31-2005, 07:49 PM
|
#6
|
|
Senior Member
Registered: Sep 2004
Distribution: slackware
Posts: 1,684
Rep: 
|
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 07:50 PM.
|
|
|
|
11-01-2005, 04:46 AM
|
#7
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Original Poster
Rep:
|
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.
|
|
|
|
11-01-2005, 05:04 AM
|
#8
|
|
Member
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265
Rep:
|
Off topic slightly, but does anyone know the probability that two different files will have the same MD5 checksum?
|
|
|
|
11-01-2005, 09:18 AM
|
#9
|
|
Member
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265
Rep:
|
OK, I'll assume that the "obvious" answer is the correct one: 1 in 2^128 (since MD5 generates a 128-bit checksum).
|
|
|
|
11-01-2005, 11:12 AM
|
#10
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Original Poster
Rep:
|
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
|
|
|
|
11-01-2005, 11:18 AM
|
#11
|
|
Member
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265
Rep:
|
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!
|
|
|
|
11-01-2005, 11:23 AM
|
#12
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Original Poster
Rep:
|
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?
|
|
|
|
11-01-2005, 01:00 PM
|
#13
|
|
Member
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265
Rep:
|
Even a byte-by-byte comparison can give the wrong answer if there are hardware failures. 
|
|
|
|
11-02-2005, 11:44 AM
|
#14
|
|
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507
Original Poster
Rep:
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:16 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|