Page MenuHomeFreeBSD

ar: add error handling
ClosedPublic

Authored by emaste on Aug 3 2021, 6:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 29, 1:58 PM
Unknown Object (File)
Fri, Jun 28, 12:55 AM
Unknown Object (File)
Sat, Jun 22, 11:11 AM
Unknown Object (File)
Sun, Jun 9, 12:31 PM
Unknown Object (File)
Sat, Jun 8, 9:56 PM
Unknown Object (File)
Sat, Jun 1, 12:26 PM
Unknown Object (File)
May 29 2024, 7:27 AM
Unknown Object (File)
May 19 2024, 9:20 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.