Page MenuHomeFreeBSD

tee: try opening as a UNIX socket if open(2) fails
ClosedPublic

Authored by kevans on Dec 24 2024, 10:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 20, 5:26 PM
Unknown Object (File)
Mon, Apr 7, 3:57 AM
Unknown Object (File)
Mar 3 2025, 6:50 AM
Unknown Object (File)
Feb 26 2025, 10:27 AM
Unknown Object (File)
Feb 25 2025, 1:02 PM
Unknown Object (File)
Feb 24 2025, 11:41 AM
Unknown Object (File)
Feb 20 2025, 10:52 PM
Unknown Object (File)
Feb 8 2025, 4:01 AM
Subscribers

Details

Summary

If we get EOPNOTSUPP from open() failing, then it may just be that we're
looking at a unix(4) socket instead of a normal file/device or whatnot.
Fallback to trying to open it as a unix(4) socket, which is a useful
feature that doesn't add much complexity.

Diff Detail

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

Event Timeline

I'd like to look at incorporating something like https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=117733, too, though the patch isn't available anymore.

Should we mention this in the man page? Not sure it's necessary, but if this is something that other tee implementations don't do, or something that they document, we ought to.

Add a note to the manpage that we'll also accept UNIX sockets. No other
implementation that I looked at seems to do this, but it would be handy.

This revision is now accepted and ready to land.Dec 26 2024, 1:36 PM
markj added inline comments.
usr.bin/tee/tests/tee_test.sh
87

Since the value of $unixsock is hard-coded here, maybe just get rid of the variable entirely?

usr.bin/tee/tests/tee_test.sh
72

No blank line before variables

This revision was automatically updated to reflect the committed changes.
kevans marked 2 inline comments as done.