On Sun, Jan 02, 2022 at 09:59:08PM -0500, Paul M. Foster wrote: > Regarding "patch", let's consider a "stock" config file from a fresh install > (call it NEW), and an existing config which is tweaked for my purposes (call > it OLD). Assume I want the stock config altered to conform to my > existing/working installation.
If you're reinstalling after a disk or system failure, you should be able to drop the config files from your backup onto the system, either before or after you install the software packages that use those files. The scenario you seem to be imagining involves reinstalling software packages and somehow ending up with a *different* version of the software than you had been running on the failed system. This isn't going to happen if you were running Debian stable, and you reinstall Debian stable. The only way it would be a concern is if you're *not* running Debian stable, or if you reinstall with something other than Debian stable. In those cases, well, you're kinda on your own. > To make patch work, I need a diff file, which I get from diffing OLD and > NEW. From there, I use patch and the diff to bring NEW to conform to OLD, > more or less. I proposed patch because I was imagning a scenario in which you're administering multiple systems, and you want to make the same change to the same file on a bunch of systems, BUT the file in question isn't identical across all systems. Maybe it's got a hostname or an IP address or something in it, and therefore you are supposed to "edit" the file with a text editor, find the right line, find the right column, and make your changes by hand, with immediate visual feedback to tell you that it looks "right". As long as the change you're making isn't within a couple lines of the varying part, the resulting diff should apply cleanly to all your systems. patch is also viable for the "stupid Docker user" case that we see all the time on IRC. In this scenario, the user (I can't even call them an administrator) has some pre-made Docker image, and they want to install it repeatedly on the same (virtual) machine, over and over, but this image hasn't been fully customized for their machine. So they want to make changes to it after they install it. The same changes. Every. Single. Time. (I have no idea why these people don't just make their change to the image that they're installing from.) (I also have no idea whey they're installing the same image multiple times. I suspect it's got something to do with setting up a pristine build environment...?) Anyway, for that scenario, a diff file applied by patch is safer than whatever atrocity they write using GNU sed. Then again, for that scenario, they could also just drop whole files onto the system, rather than trying to "edit" the image's stock files. Yet they don't seem to consider either of these solutions. Nope. It's always "how 2 sed??".