Page MenuHomeFreeBSD

lorder: Clean up and improve robustness.
ClosedPublic

Authored by des on Feb 27 2024, 10:39 PM.
Tags
None
Referenced Files
F137475584: D44133.id135132.diff
Sun, Nov 23, 7:45 PM
F137475567: D44133.id135176.diff
Sun, Nov 23, 7:45 PM
F137475494: D44133.id135145.diff
Sun, Nov 23, 7:44 PM
F137475491: D44133.id.diff
Sun, Nov 23, 7:44 PM
F137475488: D44133.id135148.diff
Sun, Nov 23, 7:44 PM
F137474522: D44133.diff
Sun, Nov 23, 7:33 PM
Unknown Object (File)
Sat, Nov 15, 7:03 AM
Unknown Object (File)
Fri, Nov 14, 8:55 AM

Details

Summary
  • Properly parse (no) command-line options.
  • Ensure that errors go to stderr and result in a non-zero exit.
  • Drop the special-case code for a single argument, as it will produce the wrong outcome if the file does not exist or is corrupted.
  • Don't print anything until after we've collected all the data.
  • Always create all temporary files before setting the trap. This ensures that the trap can safely fire at any moment, regardless of any previous definition of T.
  • Use a temporary file rather than a pipe between nm and sed to ensure proper termination if nm fails due to a missing or invalid input.
  • The check for self-referential entries was conditional on testing our argument list against a regex looking for archives. This was a needless and unreliable optimization; make the check unconditional.
  • Document that lorder will not work properly if any of its inputs have spaces in their name.

MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

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

Event Timeline

des requested review of this revision.Feb 27 2024, 10:39 PM
des added a child revision: D44134: lorder: Add unit tests..

simplify trap, fix case where nm fails

don't print anything until later

allanjude added a subscriber: allanjude.

reviewed-by: allanjude

This revision is now accepted and ready to land.Feb 28 2024, 2:07 PM
This revision was automatically updated to reflect the committed changes.