Page MenuHomeFreeBSD

ar: add error handling
ClosedPublic

Authored by emaste on Aug 3 2021, 6:39 PM.
Tags
None
Referenced Files
F107385233: D31402.id93190.diff
Mon, Jan 13, 9:46 AM
F107384962: D31402.id93504.diff
Mon, Jan 13, 9:40 AM
F107384349: D31402.id93210.diff
Mon, Jan 13, 9:26 AM
F107379171: D31402.diff
Mon, Jan 13, 7:41 AM
Unknown Object (File)
Mon, Jan 6, 5:14 AM
Unknown Object (File)
Mon, Jan 6, 12:22 AM
Unknown Object (File)
Dec 5 2024, 9:26 AM
Unknown Object (File)
Nov 13 2024, 8:06 PM
Subscribers

Details

Summary

Previously ar and ranlib did not produce an error exit status in the case of a misisng file etc.

Bring over the error handling added by ELF Tool Chain after forking FreeBSD's ar.

Reported by: HardenedBSD IRC
Obtained from: elftoolchain ar
Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste requested review of this revision.Aug 3 2021, 6:39 PM
emaste created this revision.

Reported by: gehmehgeh on HardenedBSD IRC

Oh, actually:
Reported by: Shawn Webb

(https://lists.freebsd.org/archives/freebsd-toolchain/2021-August/000121.html)
I missed the mailing list post originally

markj added inline comments.
usr.bin/ar/acpyacc.y
194

Looks like this is just a related cleanup? There is a similar change in acplex.l that is not included here, EX_SOFTWARE -> EXIT_FAILURE.

662

There are quite a few more sysexits.h removals in upstream ar, not sure if the intent was to port them all?

usr.bin/ar/ar.c
283

EXIT_FAILURE here too? Or should we go further and eliminate the exit status parameter from bsdar_errc() and hard-code EXIT_FAILURE, like elftoolchain did?

351

None of these calls are checked?

usr.bin/ar/acpyacc.y
194

Right, I just compared usr.bin/ar with elftc files and updated exit status related parts (that I found) to match elftc. acpyacc.y could indeed be left unchanged, but I think converging on elftc is preferable.

662

Not a bad idea, perhaps a second pass.

LGTM aside from the one comment.

usr.bin/ar/read.c
163

Upstream ar returns EXIT_FAILURE in this case (r == ARCHIVE_FATAL check at the end of ar_read_archive()).

This revision is now accepted and ready to land.Aug 4 2021, 12:28 PM

One more fix from markj
Commit pending exp-run results

This revision now requires review to proceed.Aug 4 2021, 12:53 PM
This revision is now accepted and ready to land.Aug 4 2021, 12:54 PM

exp-run turned up one failing port, math/lapacke; I have a fix in D31492

This revision was automatically updated to reflect the committed changes.