Page MenuHomeFreeBSD

ar: add error handling
ClosedPublic

Authored by emaste on Aug 3 2021, 6:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 9:26 AM
Unknown Object (File)
Nov 13 2024, 8:06 PM
Unknown Object (File)
Nov 12 2024, 1:20 AM
Unknown Object (File)
Nov 12 2024, 1:15 AM
Unknown Object (File)
Nov 5 2024, 8:51 PM
Unknown Object (File)
Nov 4 2024, 1:04 AM
Unknown Object (File)
Oct 30 2024, 12:59 PM
Unknown Object (File)
Oct 16 2024, 4:17 AM
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

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

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
282

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?

350

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.