Page MenuHomeFreeBSD

freebsd-update: re-edit files if merge conflict markers remain
ClosedPublic

Authored by emaste on Dec 14 2022, 5:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 3:31 AM
Unknown Object (File)
Oct 2 2024, 10:33 PM
Unknown Object (File)
Oct 2 2024, 3:06 PM
Unknown Object (File)
Oct 2 2024, 3:06 PM
Unknown Object (File)
Oct 2 2024, 3:06 PM
Unknown Object (File)
Oct 2 2024, 3:06 PM
Unknown Object (File)
Oct 2 2024, 3:06 PM
Unknown Object (File)
Oct 2 2024, 3:06 PM

Details

Summary

freebsd-update will open ${EDITOR} if conflicts occur while merging updates to config files. Inform the user if they've left conflict markers behind, and go back to editing the file.

PR: 185546
PR: 229689

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste created this revision.

Nice!

usr.sbin/freebsd-update/freebsd-update.sh
2550

I would also include =======.

usr.sbin/freebsd-update/freebsd-update.sh
2550

Hmmm... maybe within word boundaries (\<=======\>) and from the beginning of line (^) just to err on the side of caution?

add ======, anchor to beginning of line

usr.sbin/freebsd-update/freebsd-update.sh
2550

Those word delimiters (\< and \>) are not working for me, I should have said \b=======\b.

emaste added reviewers: cperciva, delphij.

update pattern yet again

This revision is now accepted and ready to land.Dec 15 2022, 12:32 AM

This appears like it will get suck in a infinite loop when it finds #PROBLEMS!==== in /etc/services.

It should have code that says something like "There still seem to be problems but is this ok?" as there can always be files that match whatever the <. = and > regex is used.

If anyone is doing some major work with this, I would love to see a "There are %d files needing merged by hand" along with "press ! for a shell" which drops the user into the proper area and suggests a diff command. When the answer to "does this look ok" is "N", it should try something other than bailing out. Also the select/edit prompt should have a edit/old/new option. If it is a system file, the users rarely wants the older file.

If there are too many changes, perhaps some instructions offering help about using the --currently-running option could be useful including files useful to figure out what the installed version is or at least provide some help via SCCS ids.

This appears like it will get suck in a infinite loop when it finds #PROBLEMS!==== in /etc/services.

Note that the regex is anchored to the beginning of the line, so will not match #PROBLEMS!==============================================================

It should have code that says something like "There still seem to be problems but is this ok?"

Yeah, good idea. Could be something like

Merge conflict markers remain in: ${F}
These must be resolved for the system to be functional.

Press Enter to return to editing this file, or type "ACCEPT"
to carry on with these conflict markers remaining in the file.

or rather,

to carry on with these lines remaining in the file.