Page MenuHomeFreeBSD

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

Authored by kevans on Dec 24 2024, 10:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 8, 4:01 AM
Unknown Object (File)
Wed, Feb 5, 12:01 AM
Unknown Object (File)
Wed, Jan 29, 11:46 PM
Unknown Object (File)
Fri, Jan 24, 4:45 PM
Unknown Object (File)
Fri, Jan 24, 6:28 AM
Unknown Object (File)
Fri, Jan 17, 10:00 PM
Unknown Object (File)
Jan 9 2025, 8:02 AM
Unknown Object (File)
Jan 3 2025, 2:59 AM
Subscribers

Details

Reviewers
des
emaste
markj
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 61326
Build 58210: arc lint + arc unit

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
85

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

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

No blank line before variables