You are not logged in.
Is there a quick pacman command doing a diff between the local file system and a pacman package?
Say I have installed a package foo and modified /etc/foo.conf. Now I want to find what's the difference between the file in my local file system and that in a clean package.
If there's not a quick pacman command, what would you use in this case?
Last edited by cyker (2014-10-10 05:18:46)
.
Offline
The original package foo.tar.xz is always there in /var/cache/pacman/pkg (unless you cleared it)
Fast solution to compare full package:(lists names of files which differ)
pacman -Qkk foo
OR
tar --diff -C / -f /var/cache/pacman/pkg/foo.tar.xzOnce you know names of file that differ, do per file comparison as follows:
tar -xOf /var/cache/pacman/pkg/foo.tar.gz etc/foo.conf | diff /etc/foo.conf -Last edited by amish (2014-10-10 05:17:06)
Offline
Thanks. Then it doesn't seem we have a handy tool right now. Actually it'd be good if it also accepts full-package comparison. I want this tool because sometimes my package doesn't work and I'd like to figure out what changes I made stopped it from working. The clean package should work so a diff can be helpful.
.
Offline
EDIT:
post moved to my previous post above
Last edited by amish (2014-10-10 05:18:04)
Offline
You could pacman -S the package and get .pacnew files, I guess.
Last edited by lucke (2014-10-10 04:45:56)
Offline
All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.
Offline
@loafer - possibly he does not want that.
Offline
Ok here is just one line code which compares full-package! (lists names of files which differ)
tar --diff -C / -f /var/cache/pacman/pkg/foo.tar.xzAfter that u can use old solution (in my previous post) to do per file comparison
This can help find files of interest. Some issues:
tar diff doesn't show the full text diff.
tar diff shows mod time diff and size diff, which are not quite interesting to me.
.
Offline
Yes I realized it later that the content difference is not shown. So updated my post accordingly.
Basically first command will help you know the files which differ. (mod time differs is what you need to look for)
2nd command will tell u exact difference.
You can also use:
pacman -Qkk fooMay be "tar" can add the feature in --diff command to compare the files contents too.
Last edited by amish (2014-10-10 05:31:18)
Offline
Well, this helps in a different way. If every package accurately lists its backup files then this command is very handy. I guess it doesn't care about non-backup files right now.
.
Offline
Yes I realized it later that the file difference is not shown. So updated my post accordingly.
Basically first command will help you know the files which differ. (size diference is what you need to look for)
2nd command will tell u exact difference.You can also use:
pacman -Qkk fooMay be "tar" can add the feature in --diff command to compare the files contents too.
pacman -Qkkis good. Almost solved this problem. Removing uninteresting mod time mismatches should be easy. Thanks!
.
Offline
Size difference does not always work! ![]()
Lets say original conf file had two lines:
Alert=true
#Alert=falseNow you changed it to:
#Alert=true
Alert=falseSo size will remain same!!
So mod time is possibly better way to check! ![]()
Offline
Size difference does not always work!
Lets say original conf file had two lines:
Alert=true #Alert=falseNow you changed it to:
#Alert=true Alert=falseSo size will remain same!!
So mod time is possibly better way to check!
Right. Actually diff is the best way to check but doesn't seem to be there.
.
Offline
Yup, wonder why --diff of tar is not extended to give actual diference!
Offline
If you want to create your own tool to check packages, then you can start with something like this. Current packages should have an mtree database with a list of checksums.
zcat /var/lib/pacman/local/filesystem-2014.07-1/mtree | sed -n 's/^\([^ ]*\).*sha256digest=\(\w*\)/\2 \1/p' | (cd / && sudo sha256sum --quiet -c)To clarify: That may be useful if you create a script to check one or two specific files from one package. If you do it manually, pacman -Qkk is simpler. When you have huge packages it may be preferrable to limit the checks to a few files, though.
Last edited by progandy (2014-10-10 06:47:48)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Thats too big command to remember!
Probably pacman -Qkk does the same internally.
Also he is looking for a way to find a "diff" easily.
Last edited by amish (2014-10-10 06:41:33)
Offline
See http://xyne.archlinux.ca/projects/pkg_scripts/ - pkg-extract_original may help:
$ type ddiff
ddiff is a function
ddiff ()
{
LC_ALL=C TZ=GMT0 diff -Naur $1 <(pkg-extract_original $1) | less
}e.g.
$ ddiff /etc/pacman.confOffline
Thats too big command to remember!
That's what functions and aliases are for.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline