pkg
pkg copied to clipboard
pkgsave use is overloaded
currently, .pkgsave has two use-cases:
- replace a file on the filesystem if it wasn't in a package before
- replace a configuration file it has been modified
i believe that the second use-case is flawed.
Most other packaging systems place the new file under a new extension.
Debian for instance will place new configuration files under /etc/foo/bar.conf.dpkg-new if non-interactive mode is enabled.
This is much, much more sensible. Especially considering vital files such as pkgbase's /etc/master.passwd and /etc/group.
This behaviour seems mostly limited to pkgbase, since in ports most config files don't actually exist, as only .sample files exist.
I propose that we change the behaviour and the extension for the second use-case:
we should place the new package's file as /etc/foo/bar.conf.pkgnew iif /etc/foo/bar.conf on disk differs from that file in new version of the package
:+1:. At the very least "pkgsave" is ambiguous and we need an "old" or "new" in there.
Recently I had problems with the pkgsave files and I started a thread here :
https://forums.freebsd.org/threads/how-to-tell-freebsd-to-stop-producing-pkgsave-files.87645/
maybe you will find useful to give a look. Anyway,I didn't fix my problems.
https://forums.freebsd.org/threads/how-to-tell-freebsd-to-stop-producing-pkgsave-files.87645
https://forums.freebsd.org/posts/594475 suggests:
…
find /usr/local -type f -name '*.pkgsave' | xargs rm -iNow it's going to ask if you want to remove each file individually.
With bfs(1), I tried bfs /usr/local -type f -name '*.pkgsave' | xargs rm -i
- the result was not interactive.
Similarly, not interactive with find(1):
root@mowa219-gjp4-8570p-freebsd:~ # find /usr/local -type f -name '*.pkgsave' | xargs rm -i
load: 2.25 cmd: find 15653 [running] 285.93r 2.99u 13.22s 6% 12780k
load: 0.73 cmd: find 15653 [zio->io_cv] 409.98r 4.20u 20.15s 6% 12776k
remove /usr/local/sbin/automount.pkgsave? remove /usr/local/sbin/pkg-static.pkgsave? remove /usr/local/share/wifimgr/icons/icon.png.pkgsave? remove …
I know,some good scripts have been elaborated to fix the problem,but they should be executed after the problem happened. I think it should be fixed at the root.
- the result was not interactive.
With exec(1) instead of xargs(1), and the different syntax:
root@mowa219-gjp4-8570p-freebsd:~ # sh
# bfs /usr/local -type f -name '*.pkgsave' -exec rm -i {} \;
remove /usr/local/sbin/automount.pkgsave? y
remove /usr/local/sbin/pkg-static.pkgsave? y
remove /usr/local/openssl/cert.pem.pkgsave? y
remove /usr/local/bin/pyserial-miniterm.pkgsave? y
remove /usr/local/bin/f2py3.pkgsave? y
remove /usr/local/bin/f2py.pkgsave? y
remove /usr/local/bin/wheel.pkgsave? y
remove /usr/local/bin/f2py3.8.pkgsave? y
remove /usr/local/bin/pyserial-ports.pkgsave? y
remove /usr/local/share/mime/globs.pkgsave? y
remove /usr/local/share/mime/XMLnamespaces.pkgsave? y
remove /usr/local/share/mime/version.pkgsave? y
remove /usr/local/share/mime/types.pkgsave? y
remove /usr/local/share/mime/subclasses.pkgsave? y
remove /usr/local/share/mime/globs2.pkgsave? y
remove /usr/local/share/mime/icons.pkgsave? y
remove /usr/local/share/mime/mime.cache.pkgsave? y
remove /usr/local/share/mime/magic.pkgsave? y
remove /usr/local/share/mime/treemagic.pkgsave? y
remove /usr/local/share/mime/aliases.pkgsave? y
remove /usr/local/share/mime/generic-icons.pkgsave? y
remove /usr/local/share/applications/mimeinfo.cache.pkgsave? y
remove /usr/local/etc/ssl/cert.pem.pkgsave? y
remove /usr/local/etc/man.d/dtrace-toolkit.conf.pkgsave? y
remove /usr/local/share/wifimgr/icons/icon.png.pkgsave? y
remove /usr/local/share/licenses/en-freebsd-doc-20210918,1/LICENSE.pkgsave? y
remove /usr/local/share/licenses/en-freebsd-doc-20210918,1/BSD2CLAUSE.pkgsave? y
remove /usr/local/share/licenses/en-freebsd-doc-20210918,1/catalog.mk.pkgsave? y
remove /usr/local/lib/python3.8/site-packages/pyparsing.py.pkgsave? y
remove /usr/local/lib/python3.8/site-packages/distutils-precedence.pth.pkgsave? y
remove /usr/local/lib/python3.7/site-packages/zipp.py.pkgsave? y
load: 0.70 cmd: bfs 17778 [zio->io_cv] 321.05r 1.45u 4.38s 5% 32168k
^C
# bfs /etc -type f -name '*.pkgsave' -exec rm -i {} \;
remove /etc/libmap.conf.pkgsave? y
# bfs /etc -type f -name '*.pkgsave' -exec rm -i {} \;
# bfs /lib -type f -name '*.pkgsave' -exec rm -i {} \;
remove /lib/libcxxrt.so.1.pkgsave? y
remove /lib/libssp.so.0.pkgsave? y
remove /lib/libncursesw.so.9.pkgsave? y
remove /lib/libc.so.7.pkgsave? y
remove /lib/libgcc_s.so.1.pkgsave? y
remove /lib/libedit.so.8.pkgsave? y
remove /lib/libm.so.5.pkgsave? y
remove /lib/libthr.so.3.pkgsave? y
# bfs /libexec -type f -name '*.pkgsave' -exec rm -i {} \;
remove /libexec/ld-elf.so.1.pkgsave? y
# bfs /jails -type f -name '*.pkgsave' -exec rm -i {} \;
remove /jails/thirteen/usr/local/sbin/pkg-static.pkgsave? y
# bfs /usr/lib -type f -name '*.pkgsave' -exec rm -i {} \;
remove /usr/lib/librt.so.1.pkgsave? y
remove /usr/lib/libc++.so.1.pkgsave? ^C
# bfs /usr/libexec -type f -name '*.pkgsave' -exec rm -i {} \;
# file /usr/libexec/ld-elf.so.1.pkgsave
/usr/libexec/ld-elf.so.1.pkgsave: symbolic link to ../../libexec/ld-elf.so.1
# bfs /usr/libexec -type l -name '*.pkgsave' -exec rm -i {} \;
remove /usr/libexec/ld-elf.so.1.pkgsave? y
# bfs /usr/libexec -type l -name '*.pkgsave' -exec rm -i {} \;
# ls -hln /libexec/ld-elf.so.1*
-r-xr-xr-x 1 0 0 117K Feb 19 02:32 /libexec/ld-elf.so.1
-r-xr-xr-x 1 0 0 117K Feb 17 22:33 /libexec/ld-elf.so.1.old
# exit
root@mowa219-gjp4-8570p-freebsd:~ # uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #33 main-n261014-cd406ac94d8b: Sun Feb 19 01:35:14 GMT 2023 grahamperrin@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1400081 1400081
root@mowa219-gjp4-8570p-freebsd:~ # pkg info -x sysutils/bfs
bfs-2.6.3
root@mowa219-gjp4-8570p-freebsd:~ #
… et cetera.
Instead of removing a lot of files by hand,I prefer this kind of solution :
https://forums.FreeBSD.org/threads/how-to-tell-freebsd-to-stop-producing-pkgsave-files.87645/post-594560
this is what I mean for "solving the problem at the root". But this is only an hack proposed by a system admin,not by a developer. I think it's a good idea if the discussion about what to do to fix the problem at the root can be developed further so that a final solution can be reached.
see https://reviews.freebsd.org/D27959 and https://reviews.freebsd.org/D27962
Did you give to me two reviews that are identical ? anyway,is the fix ready ? can I patch that file (usr.sbin/kldxref/kldxref.c) and my problem will go away ?
sorry about the bad paste
i updated the comment. from my point of view, they are ready, but I don't know what's missing to get them landed
Should I apply both patches or one only ? which one is better ?
rc: ignore .pkgsave files is easier to apply, and is the more generally useful one
Spun off to a mail list:
The archived version is difficult to read (loss of formatting), you'll find a better version at https://people.freebsd.org/~grahamperrin/better/.
They know what's the cause. There are two patches to try. Igalic says that he does not know why they haven't been accepted. Anyway,how the patch is supposed to work ? what should I do after having patched the file ? Maybe I should put in ignore list some files that I don't want to be duplicated ? if it works like this,I would like to know how to put in the ignore list every file that's executable. Can I do this ? For me its ok if it creates pkgsave files for the conf files. They can be useful. But if creates more copies of the executables,the system will break hardly.
first off, @igalic, as per their profile, goes by she (or they).
secondly, sometimes patches are just forgotten, it happens. i harbor no hard feelings about this, i, too, forgot about them.
and finally, you just gave me an idea of how to extend that patch further: have an rc.conf option that extends the ignore list
this number of pkgsave files have been drastrically reduced.